Re: C/C++ PATCH to implement -Wmultistatement-macros (PR c/80116)

2017-07-17 Thread Marek Polacek
On Mon, Jul 17, 2017 at 10:15:40AM +0200, Gerald Pfeifer wrote: > On Sat, 10 Jun 2017, Gerald Pfeifer wrote: > > I'm curious to see how many issues this is going to find in real-world > > code out there! > > This is a bit anecdotal, but your code did find one real issue in Wine: > > https://

Re: C/C++ PATCH to implement -Wmultistatement-macros (PR c/80116)

2017-07-17 Thread Gerald Pfeifer
On Sat, 10 Jun 2017, Gerald Pfeifer wrote: > I'm curious to see how many issues this is going to find in real-world > code out there! This is a bit anecdotal, but your code did find one real issue in Wine: https://www.winehq.org/pipermail/wine-patches/2017-July/163551.html (and https://www.w

Re: C/C++ PATCH to implement -Wmultistatement-macros (PR c/80116)

2017-06-26 Thread David Malcolm
On Mon, 2017-06-26 at 11:40 +0200, Marek Polacek wrote: > On Mon, Jun 19, 2017 at 12:01:06PM +0200, Marek Polacek wrote: > > On Tue, Jun 13, 2017 at 03:29:32PM +, Joseph Myers wrote: > > > On Tue, 13 Jun 2017, Marek Polacek wrote: > > > > > > > * c-parser.c (c_parser_if_body): Set the

Re: C/C++ PATCH to implement -Wmultistatement-macros (PR c/80116)

2017-06-26 Thread Marek Polacek
On Mon, Jun 19, 2017 at 12:01:06PM +0200, Marek Polacek wrote: > On Tue, Jun 13, 2017 at 03:29:32PM +, Joseph Myers wrote: > > On Tue, 13 Jun 2017, Marek Polacek wrote: > > > > > * c-parser.c (c_parser_if_body): Set the location of the > > > body of the conditional after parsing all the la

Re: C/C++ PATCH to implement -Wmultistatement-macros (PR c/80116)

2017-06-19 Thread Marek Polacek
On Tue, Jun 13, 2017 at 03:29:32PM +, Joseph Myers wrote: > On Tue, 13 Jun 2017, Marek Polacek wrote: > > > * c-parser.c (c_parser_if_body): Set the location of the > > body of the conditional after parsing all the labels. Call > > warn_for_multistatement_macros. > > (c_parser

Re: C/C++ PATCH to implement -Wmultistatement-macros (PR c/80116)

2017-06-13 Thread Joseph Myers
On Tue, 13 Jun 2017, Marek Polacek wrote: > * c-parser.c (c_parser_if_body): Set the location of the > body of the conditional after parsing all the labels. Call > warn_for_multistatement_macros. > (c_parser_else_body): Likewise. > (c_parser_switch_statement): Likewi

Re: C/C++ PATCH to implement -Wmultistatement-macros (PR c/80116)

2017-06-13 Thread Marek Polacek
On Sat, Jun 10, 2017 at 12:03:18AM +0200, Gerald Pfeifer wrote: > On Thu, 8 Jun 2017, David Malcolm wrote: > > How about: > > > > "Warn about unsafe multiple statement macros that appear to be guarded > > by a clause such as if, else, while, or for, in which only the first > > statement is actuall

Re: C/C++ PATCH to implement -Wmultistatement-macros (PR c/80116)

2017-06-13 Thread Marek Polacek
On Thu, Jun 08, 2017 at 01:24:09PM -0400, David Malcolm wrote: > On Thu, 2017-06-08 at 18:49 +0200, Marek Polacek wrote: > > This is the hopefully last incarnation of the patch. The change from > > the > > last time[0] is simpy that I've added a new test and the warning has > > been > > renamed to

Re: C/C++ PATCH to implement -Wmultistatement-macros (PR c/80116)

2017-06-09 Thread Jason Merrill
On Thu, Jun 8, 2017 at 9:49 AM, Marek Polacek wrote: > Jason - how about the C++ parts? The C++ parts are OK. Jason

Re: C/C++ PATCH to implement -Wmultistatement-macros (PR c/80116)

2017-06-09 Thread Gerald Pfeifer
On Thu, 8 Jun 2017, David Malcolm wrote: > How about: > > "Warn about unsafe multiple statement macros that appear to be guarded > by a clause such as if, else, while, or for, in which only the first > statement is actually guarded after the macro is expanded." > > or somesuch? Yes, I like this.

Re: C/C++ PATCH to implement -Wmultistatement-macros (PR c/80116)

2017-06-08 Thread Martin Sebor
On 06/08/2017 11:24 AM, David Malcolm wrote: On Thu, 2017-06-08 at 18:49 +0200, Marek Polacek wrote: This is the hopefully last incarnation of the patch. The change from the last time[0] is simpy that I've added a new test and the warning has been renamed to -Wmultistatement-macros. David - an

Re: C/C++ PATCH to implement -Wmultistatement-macros (PR c/80116)

2017-06-08 Thread David Malcolm
On Thu, 2017-06-08 at 18:49 +0200, Marek Polacek wrote: > This is the hopefully last incarnation of the patch. The change from > the > last time[0] is simpy that I've added a new test and the warning has > been > renamed to -Wmultistatement-macros. > > David - any another comments? Thanks for wo

C/C++ PATCH to implement -Wmultistatement-macros (PR c/80116)

2017-06-08 Thread Marek Polacek
This is the hopefully last incarnation of the patch. The change from the last time[0] is simpy that I've added a new test and the warning has been renamed to -Wmultistatement-macros. David - any another comments? Joseph - how about the C parts? Jason - how about the C++ parts? Thanks, [0] https