https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70186

            Bug ID: 70186
           Summary: RFE: better handling of misspelled attributes
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

From a discussion on IRC:

  t.c:3:8: warning: ‘visbility’ attribute directive ignored [-Wattributes]
  struct S *foo __attribute__ ((visbility("hidden")));
         ^
Note the misspelling of the attribute name:
  "visbility"
should have read:
  "visibility"

The reported location of the diagnostic is also suboptimal; it should underline
the attribute, either:

  struct S *foo __attribute__ ((visbility("hidden")));
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

or:

  struct S *foo __attribute__ ((visbility("hidden")));
                                ^~~~~~~~~~~~~~~~~~~

Ideally we should use Levenshtein and emit a hint and a fixit:

  t.c:3:8: warning: ‘visbility’ attribute directive ignored; did you mean
'visibility'? [-Wattributes]
  struct S *foo __attribute__ ((visbility("hidden")));
                                ^~~~~~~~~~~~~~~~~~~
                                ---------
                                visibility

or somesuch.

Reply via email to