From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A0666210F928E for ; Mon, 18 Jun 2018 14:58:03 -0700 (PDT) Received: by mail-wm0-x243.google.com with SMTP id p11-v6so18305525wmc.4 for ; Mon, 18 Jun 2018 14:58:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8NkCDjO7jYc9KkXCSfJuIApuKoryAEF6pEARR/LDVyY=; b=iiqCdyqLHmozCVb2pykxifATmXpiJpLCPW7nq9RIf2cXNiODG8jT87K64FPJddWfr3 MKVcseXiZuXTjjvxx6rMnHGKodsG5sLQUp6ZxhPtff6PiXlzjK6lcrq8qQl2FTI32KQ7 Pln1MJ4/8Uj5R97OZywoZVrj+5sNVhwwu1rHI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8NkCDjO7jYc9KkXCSfJuIApuKoryAEF6pEARR/LDVyY=; b=fa0FGnExS5yYtsmssJMkHyBGZljRf+OmjnSSV8NaeuaPDcHIqhTkKDIdl1lc3rmWkU umkq8HQSQQ+u1ZSeoCLF+Eh4BxOhl32NM9h1nNNvufgiXZztMeUhMa4nA8gklKoUR4V0 QVsWrlkBRbYQADhLgNzMSNGqVwX0TL7ddIVBTEkOi3W8O00+Rm6TnVl1KzgRvCpTc/lJ Bt6Ie9JWpZ4+ExXVJDlCTLDLktruaKAmZSmaPSQ+MZK5Znjv2ZME/HQ7ATjy/B5oo4E2 IFSC0DCMa9DJ4iubmsA5R2F6gatAuygXFzJrRVXPp1RjczpfmHDdASLKQObxgCrHua+k 1cqA== X-Gm-Message-State: APt69E31qJviYL6sHyMU6vh3BW4a7bGdHFezyRyiUaHPzbbWEP6KKCaG IWdU07D0xU5g8YZBEW+j4TEa2Q== X-Google-Smtp-Source: ADUXVKLrYj3eauMqo3Al9cq62PXR/CLyi6DkugPmlccLHQuTHJwKq+93By8n8J8xIfWdsv+9UOmtmA== X-Received: by 2002:a1c:6d2:: with SMTP id 201-v6mr9512220wmg.47.1529359081873; Mon, 18 Jun 2018 14:58:01 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id s191-v6sm11835061wmd.27.2018.06.18.14.58.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 14:58:00 -0700 (PDT) Date: Mon, 18 Jun 2018 22:57:59 +0100 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org Message-ID: <20180618215758.vsoetpww4ax64v6g@bivouac.eciton.net> References: <20180618204918.31835-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <20180618204918.31835-1-ard.biesheuvel@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH] EmbeddedPkg/GdbSerialLib: avoid left shift of negative quantity X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2018 21:58:04 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jun 18, 2018 at 10:49:18PM +0200, Ard Biesheuvel wrote: > Clang complains about left shifting a negative value being undefined. As well it should. > EmbeddedPkg/Library/GdbSerialLib/GdbSerialLib.c:151:30: > error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value] > OutputData = (UINT8)((~DLAB<<7)|((BreakSet<<6)|((Parity<<3)|((StopBits<<2)| Data)))); > > Redefine all bit pattern constants as unsigned to work around this. So, I'm totally OK with this and Reviewed-by: Leif Lindholm but ... would it be worth fixing up BIT0-31 in Base.h and use those? / Leif > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > --- > EmbeddedPkg/Library/GdbSerialLib/GdbSerialLib.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/EmbeddedPkg/Library/GdbSerialLib/GdbSerialLib.c b/EmbeddedPkg/Library/GdbSerialLib/GdbSerialLib.c > index 069d87ca780d..7931d1ac4e2b 100644 > --- a/EmbeddedPkg/Library/GdbSerialLib/GdbSerialLib.c > +++ b/EmbeddedPkg/Library/GdbSerialLib/GdbSerialLib.c > @@ -40,11 +40,11 @@ > //--------------------------------------------- > // UART Register Bit Defines > //--------------------------------------------- > -#define LSR_TXRDY 0x20 > -#define LSR_RXDA 0x01 > -#define DLAB 0x01 > -#define ENABLE_FIFO 0x01 > -#define CLEAR_FIFOS 0x06 > +#define LSR_TXRDY 0x20U > +#define LSR_RXDA 0x01U > +#define DLAB 0x01U > +#define ENABLE_FIFO 0x01U > +#define CLEAR_FIFOS 0x06U > > > > -- > 2.17.1 >