This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/61081] New: excessive warnings: right-hand operand of comma expression has no effect


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61081

            Bug ID: 61081
           Summary: excessive warnings: right-hand operand of comma
                    expression has no effect
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: peter_e at gmx dot net

OS X has the following system header definitions:

#define sigaddset(set, signo)   (*(set) |= __sigbits(signo), 0)
#define sigdelset(set, signo)   (*(set) &= ~__sigbits(signo), 0)
#define sigismember(set, signo) ((*(set) & __sigbits(signo)) != 0)
#define sigemptyset(set)    (*(set) = 0, 0)
#define sigfillset(set)     (*(set) = ~(sigset_t)0, 0)

gcc 4.9 with -Wall with complain about any use thereof with the newly
introduced

    right-hand operand of comma expression has no effect

I think the above programming patterns is common and legitimate in macros
(search engines bring up similar cases) and without an elegant alternative. 
Warning about the right-hand expression having no effect is incorrect because
it supplies the return value of the expression (unlike the left-hand side).

I suggest that this warning be removed, or at least moved away from -Wall.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]