[Bug preprocessor/90476] prepossessor should error if #line 0

2019-10-22 Thread jg at jguk dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90476

--- Comment #9 from Jonny Grant  ---
Maybe it could say

warning: line number out of range 1 - 2147483647

[Bug preprocessor/90476] prepossessor should error if #line 0

2019-10-22 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90476

Martin Sebor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||msebor at gcc dot gnu.org
 Resolution|--- |WORKSFORME

--- Comment #8 from Martin Sebor  ---
C makes it a constraint that in the #line directive: 

The digit sequence shall not specify zero, nor a number greater than
2147483647.

Both GCC and G++ issue a pedantic warning for the directive so I think they
both do the right thing and already implement the requested behavior.  There
could be a warning option to control this warning separately from others but
that seems like a separate issue that applies to a number of other warnings as
well. 

gcc -O2 -S -Wall -Wextra -Wpedantic -xc++ /build/tmp/a.c
pr90476.c:1:7: warning: line number out of range
1 | #line 0
  |   ^
pr90476.c: error: ‘mytypo’ does not name a type

With that I think this can be resolved.

[Bug preprocessor/90476] prepossessor should error if #line 0

2019-10-22 Thread jg at jguk dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90476

--- Comment #7 from Jonny Grant  ---
Could someone confirm this please.