path: root/include
diff options
authorRich Felker <>2018-03-10 20:45:49 -0500
committerRich Felker <>2018-03-12 20:04:59 -0400
commit919ad8d5fbb1caa18c3719304ffeeb0e0dde1bb5 (patch)
tree132067179a5e418dd3f565e001a249824c48d268 /include
parenteb5ae94016f0e3e4fb7d0715346b09335f14655d (diff)
explicitly use signed keyword to define intNN_t and derivative types
standing alone, both the signed and int keywords identify the same type, a (signed) int. however the C language has an exception where, when the lone keyword int is used to declare a bitfield, it's implementation-defined whether the bitfield is signed or unsigned. C11 footnote 125 extends this implementation-definedness to typedefs, and DR#315 extends it to other integer types (for which support with bitfields is implementation-defined). while reasonable ABIs (all the ones we support) define bitfields as signed by default, GCC and compatible compilers offer an option -funsigned-bitfields to change the default. while any signed types defined without explicit use of the signed keyword are affected, the stdint.h types, especially intNN_t, have a natural use in bitfields. ensure that bitfields defined with these types always have the correct signedness regardless of compiler & flags used. see also GCC PR 83294.
Diffstat (limited to 'include')
1 files changed, 4 insertions, 4 deletions
diff --git a/include/ b/include/
index 6a9c105f..622ca01d 100644
--- a/include/
+++ b/include/
@@ -7,10 +7,10 @@ TYPEDEF _Addr regoff_t;
TYPEDEF _Reg register_t;
TYPEDEF signed char int8_t;
-TYPEDEF short int16_t;
-TYPEDEF int int32_t;
-TYPEDEF _Int64 int64_t;
-TYPEDEF _Int64 intmax_t;
+TYPEDEF signed short int16_t;
+TYPEDEF signed int int32_t;
+TYPEDEF signed _Int64 int64_t;
+TYPEDEF signed _Int64 intmax_t;
TYPEDEF unsigned char uint8_t;
TYPEDEF unsigned short uint16_t;
TYPEDEF unsigned int uint32_t;