[Bug c/65405] New: improve locations of diagnostics in c-pragma.c
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Mar 12 17:26:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65405
Bug ID: 65405
Summary: improve locations of diagnostics in c-pragma.c
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: manu at gcc dot gnu.org
Created attachment 35021
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35021&action=edit
patch
#pragma GCC diagnostic
#pragma GCC diagnostic warn
#pragma GCC diagnostic warning
#pragma GCC diagnostic warning "-Wfoo"
Now:
test.c:1:9: warning: missing [error|warning|ignored] after ‘#pragma GCC
diagnostic’ [-Wpragmas]
#pragma GCC diagnostic
^
test.c:2:9: warning: expected [error|warning|ignored|push|pop] after ‘#pragma
GCC diagnostic’ [-Wpragmas]
#pragma GCC diagnostic warn
^
test.c:3:9: warning: missing option after ‘#pragma GCC diagnostic’ kind
[-Wpragmas]
#pragma GCC diagnostic warning
^
test.c:4:9: warning: unknown option after ‘#pragma GCC diagnostic’ kind
[-Wpragmas]
#pragma GCC diagnostic warning "-Wfoo"
^
After the patch:
test.c:1:23: warning: missing [error|warning|ignored] after ‘#pragma GCC
diagnostic’ [-Wpragmas]
#pragma GCC diagnostic
^
test.c:2:24: warning: expected [error|warning|ignored|push|pop] after ‘#pragma
GCC diagnostic’ [-Wpragmas]
#pragma GCC diagnostic warn
^
test.c:3:31: warning: missing option after ‘#pragma GCC diagnostic’ kind
[-Wpragmas]
#pragma GCC diagnostic warning
^
test.c:4:32: warning: unknown option after ‘#pragma GCC diagnostic’ kind
[-Wpragmas]
#pragma GCC diagnostic warning "-Wfoo"
^
And in general, the whole c-pragma.c needs to stop using input_location and
warning() and use explicit locations and warning_at().
More information about the Gcc-bugs
mailing list