This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/65405] New: improve locations of diagnostics in c-pragma.c


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().

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]