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

            Bug ID: 71610
           Summary: Improve location for "warning: ISO C restricts
                    enumerator values to range of ‘int’ [-Wpedantic]"?
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ch3root at openwall dot com
  Target Milestone: ---

Only the first token of the offending value is underlined for this warning.
Underlining all the value (like in clang) seems to be better.

Source code:

----------------------------------------------------------------------
int main()
{
  enum { c = -3000000000 };
}
----------------------------------------------------------------------

Results:

----------------------------------------------------------------------
$ gcc -std=c11 -pedantic -Wall -Wextra -O3 test.c && ./a.out
test.c: In function ‘main’:
test.c:3:14: warning: ISO C restricts enumerator values to range of ‘int’
[-Wpedantic]
   enum { c = -3000000000 };
              ^
----------------------------------------------------------------------

gcc version: gcc (GCC) 7.0.0 20160616 (experimental)

For comparison:

----------------------------------------------------------------------
$ clang -std=c11 -Weverything -O3 test.c && ./a.out
test.c:3:10: warning: ISO C restricts enumerator values to range of 'int'
(-3000000000 is too small) [-Wpedantic]
  enum { c = -3000000000 };
         ^   ~~~~~~~~~~~
1 warning generated.
----------------------------------------------------------------------

clang version: clang version 3.9.0 (trunk 271312)

Reply via email to