Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-22 Thread Vincent Lefevre
On 2024-11-21 17:13:56 +0100, grischka via Tinycc-devel wrote: > On 11/21/24 14:39, Domingo Alvarez Duarte wrote: > > Thanks fo reply ! > > > > Again even if it's valid C code it's clear that it has several drawbacks > > pointed so far by other comments on this thread and if there is a more > > cl

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-21 Thread grischka via Tinycc-devel
On 11/21/24 14:39, Domingo Alvarez Duarte wrote: Thanks fo reply ! Again even if it's valid C code it's clear that it has several drawbacks pointed so far by other comments on this thread and if there is a more clean/clear/elegant way to express it why not talk/try it out ? For sure the drawba

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-21 Thread Steffen Nurpmeso
Domingo Alvarez Duarte wrote in : |Thanks fo reply ! | |Again even if it's valid C code it's clear that it has several drawbacks |pointed so far by other comments on this thread and if there is a more |clean/clear/elegant way to express it why not talk/try it out ? Yes. After having used

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-21 Thread Domingo Alvarez Duarte
Thanks fo reply ! Again even if it's valid C code it's clear that it has several drawbacks pointed so far by other comments on this thread and if there is a more clean/clear/elegant way to express it why not talk/try it out ? Cheers ! On 21/11/24 14:36, avih via Tinycc-devel wrote: Fow what

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-21 Thread avih via Tinycc-devel
I can't speak for the maintainers of tcc (which I'm not), but I agree with the current state that adding the compiler flag is enough, and if more compilers need it, then it would be very simple to change "configure" to support it, e.g. replace: if test "$cc_name" = "clang"; then ... fi with:

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-21 Thread avih via Tinycc-devel
Fow what it's worth, when compiling with clang, the "configure" script adds to the compiler flag: -Wno-string-plus-int exactly to suppress this warning, because it's stupid, and it's valid C code, and the developers of tcc know that string + int is adding to the pointer and not to the number i

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-21 Thread Vincent Lefevre
On 2024-11-21 10:25:41 +0100, Domingo Alvarez Duarte wrote: > After Vicent Lefevre message I looked again at it and did the experimental > change sown bellow, the original code is a bit problematic because it has > "9" hardcoded in "#define __TINYC__ 9%.2s\n" and was using a substring of > "0.9.28r

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-21 Thread Domingo Alvarez Duarte
Changed again to incorporate good suggestions: #define TCC_VERSION_MAJOR "0" #define TCC_VERSION_SUB "9" #define TCC_VERSION_MINOR "28" #define TCC_VERSION_SUFFIX "rc" #define TCC_VERSION TCC_VERSION_MAJOR "." TCC_VERSION_SUB "." TCC_VERSION_MINOR TCC_VERSION_SUFFIX cstr_prin

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-21 Thread Vincent Lefevre
On 2024-11-21 11:33:21 +0100, Domingo Alvarez Duarte wrote: > I changed it to: > > > > #define TCC_VERSION_MAJOR "0" > #define TCC_VERSION_SUB "9" > #define TCC_VERSION_MINOR "28" This is often called MAJOR.MINOR.PATCH or MAJOR.MINOR.MICRO, but in the case of tinycc, the "9" isn't really mi

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-21 Thread Domingo Alvarez Duarte
Hello ian ! You've got the idea and thanks for improving it ! On 21/11/24 11:04, ian wrote: Hi #define TCC_VERSION_MAJOR "0.9."🤣 *0* is the major version, 9 is a subversion, 28 is the minor version. If you wanna have clear code : #define TCC_VERSION_MAJOR "0" #define TCC_VERSION_SUB ".9" #d

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-21 Thread Domingo Alvarez Duarte
I changed it to: #define TCC_VERSION_MAJOR "0" #define TCC_VERSION_SUB "9" #define TCC_VERSION_MINOR "28" #define TCC_RELEASE_CANDIDATE "rc" #define TCC_VERSION TCC_VERSION_MAJOR "." TCC_VERSION_SUB "." TCC_VERSION_MINOR TCC_RELEASE_CANDIDATE cstr_printf(cs, "#define __TINYC_

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-21 Thread ian
Hi #define TCC_VERSION_MAJOR "0.9."🤣 *0* is the major version, 9 is a subversion, 28 is the minor version. If you wanna have clear code : #define TCC_VERSION_MAJOR "0" #define TCC_VERSION_SUB ".9" #define TCC_VERSION_MINOR ".28" #define TCC_RELEASE_CANDIDATE "rc" #define TCC_VERSION TCC_VERSION

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-21 Thread Domingo Alvarez Duarte
After Vicent Lefevre message I looked again at it and did the experimental change sown bellow, the original code is a bit problematic because it has "9" hardcoded in "#define __TINYC__ 9%.2s\n" and was using a substring of "0.9.28rc", not the best solution but a bit more clear in my opinion.

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-20 Thread Vincent Lefevre
On 2024-11-20 13:01:44 +0100, Domingo Alvarez Duarte wrote: > The fact that tinycc is handling this issue doesn't mean that it's doing it > properly. The code is correct. But perhaps adding a cast like cstr_printf(cs, "#define __TINYC__ 9%.2s\n", TCC_VERSION + 4); to cstr_printf(cs, "#defin

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-20 Thread Domingo Alvarez Duarte
The fact that tinycc is handling this issue doesn't mean that it's doing it properly. On 20/11/24 12:56, Yao Zi via Tinycc-devel wrote: echo "__TINYC__" | ./tcc -E -xc - ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/

Re: [Tinycc-devel] Warning/bug detected by clang

2024-11-20 Thread Yao Zi via Tinycc-devel
On Wed, Nov 20, 2024 at 12:15:34PM +0100, Domingo Alvarez Duarte wrote: > While testing building tinycc with several compilers I'm getting this > warning from "zig cc" (clang 18): > > > > tccpp.c:3589:62: warning: adding 'int' to a string does not append to the > string [-Wstring-plus-int] >

[Tinycc-devel] Warning/bug detected by clang

2024-11-20 Thread Domingo Alvarez Duarte
While testing building tinycc with several compilers I'm getting this warning from "zig cc" (clang 18): tccpp.c:3589:62: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]  3589 | cstr_printf(cs, "#define __TINYC__ 9%.2s\n", TCC_VERSION + 4);   |