Re: [C PATCH] Better diagnostics for C++ comments in C90 (PR c/61854)

2014-09-17 Thread Marek Polacek
On Tue, Sep 16, 2014 at 10:32:51PM +, Joseph S. Myers wrote: This is getting closer, but it looks like you still treat it as a line comment when being skipped for C90, when actually it's not safe to treat it like that; you have to produce a '/' preprocessing token and continue

Re: [C PATCH] Better diagnostics for C++ comments in C90 (PR c/61854)

2014-09-17 Thread Joseph S. Myers
On Wed, 17 Sep 2014, Marek Polacek wrote: Sure, updated. Bootstrap in progress, regtested on x86_64-linux, ok for trunk? 2014-09-17 Marek Polacek pola...@redhat.com PR c/61854 libcpp/ * init.c (struct lang_flags): Remove cplusplus_comments. (cpp_set_lang):

Re: [C PATCH] Better diagnostics for C++ comments in C90 (PR c/61854)

2014-09-16 Thread Joseph S. Myers
On Mon, 15 Sep 2014, Marek Polacek wrote: On Mon, Sep 15, 2014 at 05:49:25PM +, Joseph S. Myers wrote: On Mon, 15 Sep 2014, Marek Polacek wrote: We must be careful to properly handle code such as 1 //**/ 2, which has a different meaning in C90 and GNU90 mode. New testcases test

[C PATCH] Better diagnostics for C++ comments in C90 (PR c/61854)

2014-09-15 Thread Marek Polacek
PR 61854 points out that using // comments in C90 mode without GNU extensions enabled results in a suboptimal error such as: error: expected expression before ‘/’ token This patch improves this diagnostics, so that the compiler now says C++ style comments are forbidden in C90. We must be careful

Re: [C PATCH] Better diagnostics for C++ comments in C90 (PR c/61854)

2014-09-15 Thread Joseph S. Myers
On Mon, 15 Sep 2014, Marek Polacek wrote: We must be careful to properly handle code such as 1 //**/ 2, which has a different meaning in C90 and GNU90 mode. New testcases test this. I don't think there's sufficient allowance here for other valid cases. It's valid to have // inside #if 0 in

Re: [C PATCH] Better diagnostics for C++ comments in C90 (PR c/61854)

2014-09-15 Thread Marek Polacek
On Mon, Sep 15, 2014 at 05:49:25PM +, Joseph S. Myers wrote: On Mon, 15 Sep 2014, Marek Polacek wrote: We must be careful to properly handle code such as 1 //**/ 2, which has a different meaning in C90 and GNU90 mode. New testcases test this. I don't think there's sufficient