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:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (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 A6A82210FC361 for ; Mon, 18 Jun 2018 13:49:23 -0700 (PDT) Received: by mail-wr0-x242.google.com with SMTP id e18-v6so18236111wrs.5 for ; Mon, 18 Jun 2018 13:49:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=M+yksFsRvSv6WIoSuWp7TArclNAyv1Op3UW0ccwIdqs=; b=eU1q3iPl83xuhZ9ipukfxkwRGylUpih0wF3kHD2ztIXlZzgSkB1QHoInieoNPaMBG/ 1NX1Oxy1OK2nyiZ5boqtVXkkaPrD+3cDfSm7PU3qPm44meHWjhp5MgOpldlodqfFV/g3 P6bSid57Ix4Bz0eeN7kk0+nd5FLi2w9a+eugk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=M+yksFsRvSv6WIoSuWp7TArclNAyv1Op3UW0ccwIdqs=; b=oQYMrXzE0JhNyMF439EiD8XrfJMxp7AlehTyCriWN0LgMcpBYIEm3oaRI2BKYKWJGe EWzbFUnX5zsS7SEyvr2O9W+i6HP5skZAdH9x6xyOmpLxABcXdM1sG0vN8c1q+tbQxZNR H5t44zc1L0CNuU7T54rD6NNp0BCEUvA5zhSYv7vgTMcZlOr6rV46wnxaO+ChHOFpk12Z XG89TR6rKsKSnS2nStmnO9/MncmQVtNBXOrR7fsNI2EmYu3Cd63zdo1fsRNDL/JPigY9 lJ7mDj5a2jnjVbJKiG4KGVjC20LoQfzZNORvtb4/gfaA4SnJ6naRzc3YMn6PGZtb4Sjv 8jug== X-Gm-Message-State: APt69E1ooJx8R1aQzaT62HgGWRLIx6FwG0GVs5i+FwSqA6sNFoueDBhc XXSmbLJquYcXBH21Zx6c8G5LeGpc4ns= X-Google-Smtp-Source: ADUXVKLZrZWEySpI6sohgUd9mTk/mvhX4kz+8TWxI/FNII867WQxXiugkpdwyZaSza9df064RFqHFQ== X-Received: by 2002:adf:ba8f:: with SMTP id p15-v6mr12381751wrg.139.1529354961762; Mon, 18 Jun 2018 13:49:21 -0700 (PDT) Received: from dogfood.home ([2a01:cb1d:112:6f00:50d8:cb10:b6d:abf0]) by smtp.gmail.com with ESMTPSA id t10-v6sm15130164wrq.74.2018.06.18.13.49.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 13:49:20 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, Ard Biesheuvel Date: Mon, 18 Jun 2018 22:49:18 +0200 Message-Id: <20180618204918.31835-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 Subject: [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 20:49:24 -0000 Clang complains about left shifting a negative value being undefined. 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. 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