On Thu, 2014-02-27 at 10:14 +0100, David Brown wrote:
> On 27/02/14 07:50, Mingjie Xing wrote:
> > Hello,
> > 
> > I'm wondering if it's a good idea to turn on some warnings by default
> > (or even promote them to error), such as -Wreturn-type on C.  This
> > would help programmers to avoid some mistakes.
> > 
> > Regards,
> > Mingjie
> > 
> 
> Personally, I think gcc should issue a warning if it is run without at
> least "-Wall" (or "-Wno-all"), telling the user that they have forgotten
> to enable warnings.  /That/ would help people avoid mistakes.  It should
> also warn if there is no optimisation level, to stop people accidentally
> generating big and slow code.


I totally agree with you. Perhaps in next release (after 4.9) we might
add something more in the spec file to enable e.g. Linux distribution
makers (or users compiling and configuring GCC from its source tarball)
to give that feature.

Maybe a way to tell in the spec file that -Wall (or some other global
and configurable option) is passed by default, unless some other options
is given to override it.

So, for people wanting -Wall without asking it explicitly it would be
possible to configure their spec file to have that. For other people
wanting maximal compatibility with the behavior of previous GCC versions
they would avoid hacking the spec file.

Look e.g. on stackoverflow.com the large amount of questions asked by
newbies users of GCC (or beginners in C programming) which could have
been avoided (or at least noticed) by -Wall....

BTWX, when I teach some courses and have students use GCC I require them
to pass -Wall and to do the necessary to avoid any warnings.

Regards.
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***


Reply via email to