$ cat t.c && gcc -c t.c #include <sys/wait.h> int foo () { const int status = 0; WIFEXITED (status); WEXITSTATUS (status); WIFSIGNALED (status); WTERMSIG (status); WIFSTOPPED (status); WSTOPSIG (status); WIFCONTINUED (status); } t.c: In function `foo': t.c:7: warning: assignment of read-only member `__in' t.c:8: warning: assignment of read-only member `__in' t.c:9: warning: assignment of read-only member `__in' t.c:10: warning: assignment of read-only member `__in' t.c:11: warning: assignment of read-only member `__in' t.c:12: warning: assignment of read-only member `__in'
Subject: Bug 1392 CVSROOT: /cvs/glibc Module name: libc Changes by: roland@sources.redhat.com 2005-09-29 20:44:44 Modified files: posix/sys : wait.h Log message: 2005-09-29 Roland McGrath <roland@redhat.com> [BZ #1392] * posix/sys/wait.h (__WAIT_INT): Rewrite using an initializer, in case __typeof yields a const-qualified type. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/posix/sys/wait.h.diff?cvsroot=glibc&r1=1.37&r2=1.38
FWIW, looking at the patch, the definition of __WAIT_INT() looks like it might generate a warning with -Wcast-qual. I suggest to change the cast to (const int*). $ cat t.cpp && gcc -Wcast-qual t.cpp #define __WAIT_INT(status) (*(int *) &(status)) int main () { const int status = 0; return __WAIT_INT(status); } t.cpp: In function `int main()': t.cpp:6: warning: cast from `const int*' to `int*' discards qualifiers from pointer target type
Subject: Bug 1392 CVSROOT: /cvs/glibc Module name: libc Changes by: roland@sources.redhat.com 2005-09-29 22:03:14 Modified files: posix/sys : wait.h Log message: 2005-09-29 Roland McGrath <roland@redhat.com> [BZ #1392] * posix/sys/wait.h [!__GNUC__ || __cplusplus] (__WAIT_INT): Use const. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/posix/sys/wait.h.diff?cvsroot=glibc&r1=1.38&r2=1.39
Apparently the sources have been adjusted.