public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/61081] New: excessive warnings: right-hand operand of comma expression has no effect
@ 2014-05-06 18:05 peter_e at gmx dot net
  2014-05-06 18:29 ` [Bug c/61081] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: peter_e at gmx dot net @ 2014-05-06 18:05 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-02-10 21:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-06 18:05 [Bug c/61081] New: excessive warnings: right-hand operand of comma expression has no effect peter_e at gmx dot net
2014-05-06 18:29 ` [Bug c/61081] " mpolacek at gcc dot gnu.org
2014-05-06 18:33 ` peter_e at gmx dot net
2014-05-06 19:03   ` Marek Polacek
2014-05-06 19:03 ` polacek at redhat dot com
2014-05-08  0:17 ` peter_e at gmx dot net
2014-05-16 20:19 ` peter_e at gmx dot net
2014-05-23 15:39 ` mpolacek at gcc dot gnu.org
2014-06-25 19:16 ` manu at gcc dot gnu.org
2015-02-10 21:01 ` [Bug target/61081] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).