瀏覽代碼

Rework smallint machinery so that it will reliably fail to compile
even if arch overrides smallint size. Makes it easier to spot bugs
on such arches.

Denis Vlasenko 17 年之前
父節點
當前提交
eed923be3e
共有 2 個文件被更改,包括 6 次插入8 次删除
  1. 4 4
      include/unistd.h
  2. 2 4
      libc/sysdeps/linux/i386/bits/wordsize.h

+ 4 - 4
include/unistd.h

@@ -1109,11 +1109,11 @@ __END_DECLS
 
 
 #ifdef UCLIBC_INTERNAL
-#ifndef smallint /* if arch didn't override it in bits/wordsize.h */
-typedef int smallint;
-typedef unsigned smalluint;
-#define smallint smallint
+#ifndef smallint_type /* if arch didn't override it in bits/wordsize.h */
+#define smallint_type int
 #endif
+typedef signed smallint_type smallint;
+typedef unsigned smallint_type smalluint;
 #endif
 
 

+ 2 - 4
libc/sysdeps/linux/i386/bits/wordsize.h

@@ -19,9 +19,7 @@
 #define __WORDSIZE	32
 
 #ifdef UCLIBC_INTERNAL
-#ifndef smallint
-typedef signed char smallint;
-typedef unsigned char smalluint;
-#define smallint smallint
+#ifndef smallint_type
+#define smallint_type char
 #endif
 #endif