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

            Bug ID: 95280
           Summary: poor warning for attribute used on a function argument
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

GCC warns when attribute used is specified on a function argument (e.g., as a
mistake instead of unused) but the warning is devoid of any useful information:

$ cat z.c && gcc -S -Wall -Wextra z.c
int f (int __attribute__ ((used)) i);
z.c:1:1: warning: ‘used’ attribute ignored [-Wattributes]
    1 | int f (int __attribute__ ((used)) i);
      | ^~~


In contrast, Clang issues a much more informative message:

z.c:1:28: warning: 'used' attribute only applies to variables with non-local
      storage, functions, and Objective-C methods [-Wignored-attributes]
int f (int __attribute__ ((used)) i);
                           ^
1 warning generated.

Reply via email to