fix signed and unsigned comparision in macros in public headers
authorSzabolcs Nagy <nsz@port70.net>
Tue, 11 Feb 2014 09:51:16 +0000 (10:51 +0100)
committerSzabolcs Nagy <nsz@port70.net>
Tue, 11 Feb 2014 09:51:16 +0000 (10:51 +0100)
gcc -Wsign-compare warns about expanded macros that were defined in
standard headers (before gcc 4.8) which can make builds fail that
use -Werror. changed macros: WIFSIGNALED, __CPU_op_S

include/sched.h
include/stdlib.h
include/sys/wait.h

index 6a6b2fc..105dac9 100644 (file)
@@ -78,7 +78,7 @@ int __sched_cpucount(size_t, const cpu_set_t *);
 int sched_getaffinity(pid_t, size_t, cpu_set_t *);
 int sched_setaffinity(pid_t, size_t, const cpu_set_t *);
 
 int sched_getaffinity(pid_t, size_t, cpu_set_t *);
 int sched_setaffinity(pid_t, size_t, const cpu_set_t *);
 
-#define __CPU_op_S(i, size, set, op) ( (i)/8 >= (size) ? 0 : \
+#define __CPU_op_S(i, size, set, op) ( (i)/8U >= (size) ? 0 : \
        ((set)->__bits[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) )
 
 #define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=)
        ((set)->__bits[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) )
 
 #define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=)
index 1e67b89..f034c6e 100644 (file)
@@ -93,7 +93,7 @@ size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
 #define WSTOPSIG(s) WEXITSTATUS(s)
 #define WIFEXITED(s) (!WTERMSIG(s))
 #define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
 #define WSTOPSIG(s) WEXITSTATUS(s)
 #define WIFEXITED(s) (!WTERMSIG(s))
 #define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
-#define WIFSIGNALED(s) (((s)&0xffff)-1 < 0xffu)
+#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
 
 int posix_memalign (void **, size_t, size_t);
 int setenv (const char *, const char *, int);
 
 int posix_memalign (void **, size_t, size_t);
 int setenv (const char *, const char *, int);
index c794f5d..50c5c70 100644 (file)
@@ -50,7 +50,7 @@ pid_t wait4 (pid_t, int *, int, struct rusage *);
 #define WCOREDUMP(s) ((s) & 0x80)
 #define WIFEXITED(s) (!WTERMSIG(s))
 #define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
 #define WCOREDUMP(s) ((s) & 0x80)
 #define WIFEXITED(s) (!WTERMSIG(s))
 #define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
-#define WIFSIGNALED(s) (((s)&0xffff)-1 < 0xffu)
+#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
 #define WIFCONTINUED(s) ((s) == 0xffff)
 
 #ifdef __cplusplus
 #define WIFCONTINUED(s) ((s) == 0xffff)
 
 #ifdef __cplusplus