On Thu, Jul 04, 2019 at 01:27:27PM +0200, Florian Weimer wrote:
> Implicit function declarations were removed from C99, more than twenty
> years ago.  So far, GCC only warns about them because there were too
> many old configure scripts where an error would lead to incorrect
> configure check failures.
> 
> I can try to fix the remaining configure scripts in Fedora and submit
> the required changes during this summer and fall.
> 
> I would appreciate if GCC 10 refused to declare functions implicitly by
> default.

[ The warning for it is enabled by default with -std=c99 or later, and
with -Wall as well.  And people still ignore that?  Wow. ]

We already have an option for that (-Werror=implicit-function-declaration),
and it is an error by default with -pedantic-errors already.  If you are
asking to make it an error by default, I second that; there needs to be a
wat to turn it off though.  Maybe it should be an error for c99 and later
only, anyway?

> According to my observations, lack of an error diagnostic has turned
> into a major usability issue.  For bugs related to pointer truncation,
> we could perhaps change the C front end to produce a hard error if an
> int value returned from an implicitly declared function is converted to
> a pointer.

No, if we allow implicit declarations at all, your proposal would error
on valid (but improbable :-) ) code.  We should only ever give hard
errors if we *know* something is wrong.

> Implicit int we should remove as well.  Checking configure scripts for
> both issues at the same time would not be much more work.

We could enable -Wimplicit-int by default for c99 and later, maybe even
its -Werror- version.  This conflicts with at least -fms-extensions it,
seems, dunno what to do there.


Segher

Reply via email to