This is sources Bugzilla
Bugzilla Version 2.17.5
Bugzilla Bug 1392
  warning on WIFEXITED(const int) et al: assignment of read-only member Last modified: 2005-10-14 06:14:48
     Query page      Enter new bug
Bug#: 1392   Hardware:   Reporter: Martin Sebor <sebor@roguewave.com>
Host: Target: Build:
Product:     Add CC:
Component:   Version:   CC:
Remove selected CCs
Status: RESOLVED   Priority:  
Resolution: FIXED   Severity:  
Assigned To: GOTO Masanori <gotom@debian.or.jp>   Target Milestone:  
Flags: Requestee:
  backport ()
  examined ()
  testsuite ()
Summary:
Keywords:

Attachment Description Type Created Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 1392 depends on: Show dependency tree
Show dependency graph
Bug 1392 blocks:

Additional Comments:


Leave as RESOLVED FIXED
Reopen bug
Mark bug as VERIFIED

View Bug Activity   |   Format For Printing


Description:   Last confirmed: 0000-00-00 00:00 Opened: 2005-09-29 17:49
$ 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'

------- Additional Comment #1 From cvs-commit@gcc.gnu.org 2005-09-29 20:44 -------
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


------- Additional Comment #2 From Martin Sebor 2005-09-29 21:56 -------
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

------- Additional Comment #3 From cvs-commit@gcc.gnu.org 2005-09-29 22:03 -------
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


------- Additional Comment #4 From Ulrich Drepper 2005-10-14 06:14 -------
Apparently the sources have been adjusted.

     Query page      Enter new bug
Actions: New | Query | bug # | Reports | Requests   New Account | Log In