incorrect error message ('-Werror=edantic') with -pedantic
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
ProcVersionSign
Uname: Linux 3.8.0-16-generic i686
NonfreeKernelMo
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_
LANG=C
SHELL=/bin/bash
SourcePackage: gcc-defaults
UpgradeStatus: Upgraded to raring on 2012-12-20 (108 days ago)
Changed in gcc: | |
importance: | Unknown → Medium |
status: | Unknown → Fix Released |
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.