Re: [Tinycc-devel] __LINE__ and #line undelying type

2021-04-16 Thread Vincent Lefevre
On 2021-04-16 14:52:50 +0100, Edmund Grimley Evans wrote: > Riddle me this: > > $ gcc --version | head -n 1 > gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 > $ printf '#line 60129542143\n__LINE__' | gcc -E - | grep -v ^# > 4294967295 > $ printf '#line 60129542144\n__LINE__' | gcc -E - | grep -v ^#

Re: [Tinycc-devel] __LINE__ and #line undelying type

2021-04-16 Thread Edmund Grimley Evans
Riddle me this: $ gcc --version | head -n 1 gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 $ printf '#line 60129542143\n__LINE__' | gcc -E - | grep -v ^# 4294967295 $ printf '#line 60129542144\n__LINE__' | gcc -E - | grep -v ^# :1:7: warning: line number out of range 0 $ gdb (gdb) p/x 60129542143 $1

Re: [Tinycc-devel] __LINE__ and #line undelying type

2021-04-16 Thread Vincent Lefevre
On 2021-04-16 07:11:27 +0200, Christian Jullien wrote: > C standard says nothing about line int overflow so tcc can't be > declared as wrong. I've looked at the C standard, and I could see nowhere that an implementation is allowed to restrict the line number to the int type. Actually, it more or

Re: [Tinycc-devel] __LINE__ and #line undelying type

2021-04-16 Thread Vincent Lefevre
On 2021-04-16 07:11:27 +0200, Christian Jullien wrote: > Even more strange, __LINE__ type changes as it overflows on clang, and gcc: > > int > main() { > #line 2147483647 > printf("__LINE__: %s\n", TYPEOF(__LINE__)); > #line 30 > printf("__LINE__: %s\n", TYPEOF(__LINE__)); > } > >

Re: [Tinycc-devel] __LINE__ and #line undelying type

2021-04-15 Thread Christian Jullien
ge- From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of Christian Jullien Sent: Friday, April 16, 2021 07:11 To: tinycc-devel@nongnu.org Subject: Re: [Tinycc-devel] __LINE__ and #line undelying type Even more strange, __LINE__ type changes as it overflo

Re: [Tinycc-devel] __LINE__ and #line undelying type

2021-04-15 Thread Christian Jullien
org] On Behalf Of Elijah Stone Sent: Friday, April 16, 2021 06:42 To: jull...@eligis.com; tinycc-devel@nongnu.org Subject: Re: [Tinycc-devel] __LINE__ and #line undelying type On Fri, 16 Apr 2021, Christian Jullien wrote: > C standard says: > _ _LINE_ _ The presumed line number (within the curre

Re: [Tinycc-devel] __LINE__ and #line undelying type

2021-04-15 Thread Elijah Stone
On Fri, 16 Apr 2021, Christian Jullien wrote: C standard says: _ _LINE_ _ The presumed line number (within the current source file) of the current source line (an integer constant). So, it should be a signed integer (same as int on your running architecture which is internally either int32_t

Re: [Tinycc-devel] __LINE__ and #line undelying type

2021-04-15 Thread Christian Jullien
ims4:~ $ tcc -std=c11 foo.c -o foo && ./foo __LINE__: int unsigned: unsigned int signed: int -Original Message- From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of Yakov Sent: Friday, April 16, 2021 03:18 To: Tinycc-devel@nongnu.org Su

[Tinycc-devel] __LINE__ and #line undelying type

2021-04-15 Thread Yakov
I remember #line was limited to 65535 on tcc recently, but now it is limited to 294967295 (max int32), when this was changed? Also I think it should be 42949672965 instead (max uint32) as in GCC and Clang. ___ Tinycc-devel mailing list