EmbeddedPkg/GdbSerialLib: avoid left shift of negative quantity
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 18 Jun 2018 20:46:36 +0000 (22:46 +0200)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 18 Jun 2018 22:05:26 +0000 (00:05 +0200)
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 <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
EmbeddedPkg/Library/GdbSerialLib/GdbSerialLib.c

index 069d87c..7931d1a 100644 (file)
 //---------------------------------------------\r
 // UART Register Bit Defines\r
 //---------------------------------------------\r
-#define LSR_TXRDY               0x20\r
-#define LSR_RXDA                0x01\r
-#define DLAB                    0x01\r
-#define ENABLE_FIFO             0x01\r
-#define CLEAR_FIFOS             0x06\r
+#define LSR_TXRDY               0x20U\r
+#define LSR_RXDA                0x01U\r
+#define DLAB                    0x01U\r
+#define ENABLE_FIFO             0x01U\r
+#define CLEAR_FIFOS             0x06U\r
 \r
 \r
 \r