error: "no newline at end of file"
Manuel López-Ibáñez
lopezibanez@gmail.com
Tue Mar 27 22:50:00 GMT 2007
On 27/03/07, Joe Buck <Joe.Buck@synopsys.com> wrote:
> On Tue, Mar 27, 2007 at 02:23:47PM +0100, Manuel López-Ibáñez wrote:
> > On 27/03/07, Martin Michlmayr <tbm@cyrius.com> wrote:
> > >* Manuel López-Ibáñez <lopezibanez@gmail.com> [2007-03-27 14:08]:
> > >> C++ preprocessor emits errors by default for nonconformant code,
> > >> following the C++ frot-end default behaviour. Users can use the
> > >> -fpermissive option to downgrade these diagnostics from errors to
> > >> warnings.
> > >
> > >s/frot-end/front-end/
> > >
> > >I'm not sure whether "nonconformant code" is specific enough. Apart
> > >from this, it looks good.
> >
> > It comes from the definition of fpermissive in invoke.texi.
>
> Users aren't going to know from this language what has changed. Manuel,
> since you're the guy who has been studying the warnings lately: which
> other preprocessor diagnostics, other than "no newline at end of file",
> are affected by this change?
>
> I would suggest language like:
>
> Certain nonconformant code detected by the C++ preprocessor, such as
> "no newline at end of file", that were formerly warnings are now hard
> errors. Users can use the -fpermissive option to downgrade these
> diagnostics from errors to warnings.
>
> If there are two or three more, the affected diagnostics could be listed
> as bullet items.
>
There aren't two or three. Any pedwarn has become an error. That is
how the C++ front-end works. Perhaps it is not how the C++ front-end
was intended to work but I have checked the C++ front-end code and it
does indeed emit errors for pedwarns even when -pedantic was not given
in the command line.
manuel@gcc05:~/src/trunk$ cat /home/manuel/src/test.cc
extern void f(void);
static void f(void);
manuel@gcc05:~/src/trunk$ /n/b01/guerby/release/3.4.6/bin/g++ -c ~/src/test.cc
/home/manuel/src/test.cc:3: error: `void f()' was declared `extern'
and later `static'
/home/manuel/src/test.cc:1: error: previous declaration of `void f()'
manuel@gcc05:~/src/trunk$ /n/b01/guerby/release/3.4.6/bin/g++
-fpermissive -c ~/src/test.cc
/home/manuel/src/test.cc:3: warning: `void f()' was declared `extern'
and later `static'
/home/manuel/src/test.cc:1: warning: previous declaration of `void f()'
In GCC 4.3 the C++ preprocessor works like the C++ front-end, pedwarns
are errors by default. Now, if the C++ front-end behaviour was already
incorrect, that is a different issue altogether. Fixing this in both
the C++ front-end and preprocessor seems fairly simple to me, if that
is what we really want to do but it is going to change from errors to
warnings a lot of pedwarns that have been errors since GCC 3.4.6 at
least.
I think we should consider this first and once there is a decision
made, we can think about what to say in the changes page and what to
do with the nonewline warning.
Cheers,
Manuel.
More information about the Gcc
mailing list