Bug 483082 - Option -std=c99 breaks -Werror
Summary: Option -std=c99 breaks -Werror
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 11
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-01-29 16:30 UTC by David Nečas
Modified: 2010-06-28 11:10 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-06-28 11:10:07 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description David Nečas 2009-01-29 16:30:40 UTC
Description of problem:
Some compiler warnings can no longer be turned into errors with -Werror= in the -std=c99 or -std=gnu99 modes.  It seems that are those reported in C99 mode by default but not reported in C89 mode.  I have not checked all such cases though.

Version-Release number of selected component (if applicable):
gcc-4.3.2-7.x86_64

How reproducible:
Always.

Steps to Reproduce:
1.  Create the following file implicit.c

=========================================
static i;

int
main(void) {
	return foo();
}
================================

2. Run

gcc -std=c99 -Werror=implicit-function-declaration -Werror=implicit-int -Werror=implicit -c implicit.c

3. For comparison, also try

gcc -Werror=implicit-function-declaration -Werror=implicit-int -Werror=implicit -c implicit.c
gcc -std=c99 -c implicit.c
gcc -c implicit.c


Actual results:
implicit.c:1: warning: type defaults to ‘int’ in declaration of ‘i’
implicit.c: In function ‘main’:
implicit.c:5: warning: implicit declaration of function ‘foo’

and zero exit status of gcc.


Expected results:
implicit.c:1: error: type defaults to ‘int’ in declaration of ‘i’
implicit.c: In function ‘main’:
implicit.c:5: error: implicit declaration of function ‘foo’

and non-zero exit status of gcc.

Comment 1 Jakub Jelinek 2009-02-11 11:16:23 UTC
I'm not convinced this is a bug.  In -std=c99 mode -Wimplicit-int vs. -Wno-implicit-int doesn't affect the type defaults to warning, the warning is unconditional.  Which obviously means -Werror=implicit-int doesn't affect it either.  Use -Werror to make it into error, or -pedantic-errors.

Comment 2 David Nečas 2009-02-11 12:34:08 UTC
-Werror makes all warnings errors.  Obviously, one can want to make some warnings errors but not all warnings.  That's why -Werror=* exists: to turn specific warnings to errors.  And this feature is broken.

If this broken behaviour is intended, then

`-Werror='
     Make the specified warning into an error.  The specifier for a
     warning is appended, for example `-Werror=switch' turns the
     warnings controlled by `-Wswitch' into errors.  This switch takes a
     negative form, to be used to negate `-Werror' for specific
     warnings, for example `-Wno-error=switch' makes `-Wswitch'
     warnings not be errors, even when `-Werror' is in effect.  You can
     use the `-fdiagnostics-show-option' option to have each
     controllable warning amended with the option which controls it, to
     determine what to use with this option.

     Note that specifying `-Werror='FOO automatically implies `-W'FOO.
     However, `-Wno-error='FOO does not imply anything.

is an incorrect description of what -Werror=* does.

Comment 3 David Nečas 2009-02-11 12:41:36 UTC
Sorry for the double reply...  I forgot to note this:

-Wno-implicit (for instance) still controls printing of the warning.  Just the default choice is to print the warning in C99 mode, whereas it is ignored by default in C89 mode.

Permitting to control the same warning with -Wno-* but not permitting to control it with -Werror=* does not seem consistent to me.

Comment 4 Bug Zapper 2009-11-18 12:44:44 UTC
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 5 David Nečas 2009-11-18 12:55:56 UTC
With gcc-4.4.1-2.fc11.x86_64 in F11, the implicit function declaration produces an error which is an improvement.  But the first implicit int still cannot be made an error, whereas it can be without -std=c99.  So I'm leaving it open an F11 bug, have not tried F12 yet.

gcc-4.4.1-2.fc11.x86_64 result:

implicit.c:1: warning: type defaults to ‘int’ in declaration of ‘i’
implicit.c: In function ‘main’:
implicit.c:5: error: implicit declaration of function ‘foo’

Comment 6 Bug Zapper 2010-04-27 12:49:36 UTC
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 7 Bug Zapper 2010-06-28 11:10:07 UTC
Fedora 11 changed to end-of-life (EOL) status on 2010-06-25. Fedora 11 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.