incorrect error message ('-Werror=edantic') with -pedantic

Bug #1166105 reported by James Hunt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc
Fix Released
Medium
gcc-4.7 (Ubuntu)
Won't Fix
Undecided
Unassigned
gcc-defaults (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Specifying '-pedantic' and '-Werror' together with a file that triggers a pedantic warning results in an incorrect message:

$ gcc -Werror foo.c
foo.c: In function ‘main’:
foo.c:21:5: erreur: ‘for’ loop initial declarations are only allowed in C99 mode
foo.c:21:5: note: use option -std=c99 or -std=gnu99 to compile your code
$ gcc -pedantic -Werror foo.c
foo.c:14:6: erreur: ISO C90 doesn’t support unnamed structs/unions [-Werror=edantic]
foo.c: In function ‘main’:
foo.c:21:5: erreur: ‘for’ loop initial declarations are only allowed in C99 mode
foo.c:21:5: note: use option -std=c99 or -std=gnu99 to compile your code
cc1: all warnings being treated as errors
$ gcc -Werror -pedantic foo.c
foo.c:14:6: erreur: ISO C90 doesn’t support unnamed structs/unions [-Werror=edantic]
foo.c: In function ‘main’:
foo.c:21:5: erreur: ‘for’ loop initial declarations are only allowed in C99 mode
foo.c:21:5: note: use option -std=c99 or -std=gnu99 to compile your code
cc1: all warnings being treated as errors

Note that '-Werror=edantic' is truncated. Presumably, it should be showing '-Werror=pedantic'?

Note however that both '-Werror=edantic' and '-Werror=pedantic' are (currently) invalid gcc options.

ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: gcc 4:4.7.2-1ubuntu8
ProcVersionSignature: Ubuntu 3.8.0-16.26-generic 3.8.5
Uname: Linux 3.8.0-16-generic i686
NonfreeKernelModules: nvidia
ApportVersion: 2.9.2-0ubuntu5
Architecture: i386
Date: Mon Apr 8 10:36:45 2013
InstallationDate: Installed on 2010-10-21 (900 days ago)
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release i386 (20101007)
MarkForUpload: True
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=C
 SHELL=/bin/bash
SourcePackage: gcc-defaults
UpgradeStatus: Upgraded to raring on 2012-12-20 (108 days ago)

Revision history for this message
James Hunt (jamesodhunt) wrote :
Revision history for this message
Matthias Klose (doko) wrote :

From the GCC 4.8 release notes:

The new option -Wpedantic is an alias for -pedantic, which is now deprecated. The forms -Wno-pedantic, -Werror=pedantic, and -Wno-error=pedantic work in the same way as for any other -W option. One caveat is that -Werror=pedantic is not equivalent to -pedantic-errors, since the latter makes into errors some warnings that are not controlled by -Wpedantic, and the former only affects diagnostics that are disabled when using -Wno-pedantic.

Won't fix for 4.7.

affects: gcc-defaults (Ubuntu) → gcc-4.7 (Ubuntu)
Changed in gcc-4.7 (Ubuntu):
status: New → Won't Fix
Revision history for this message
James Hunt (jamesodhunt) wrote :

Hi doko - the main problem here is that gcc is incorrectly showing the name of the -W option: as shown it is incorrect as it is missing the leading 'p' of 'pedantic':

-Werror=edantic
                 ^
                 |
       should be 'pedantic', not 'edantic'

Revision history for this message
James Hunt (jamesodhunt) wrote :

/me sighs at lack of verbatim text input in lp :-)

Revision history for this message
Matthias Klose (doko) wrote :

still a won't fix for 4.7

Changed in gcc:
importance: Unknown → Medium
status: Unknown → Fix Released
Revision history for this message
Matthias Klose (doko) wrote :

fixed in 4.8 and later

Changed in gcc-defaults (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.