string literal concatenation in _Static_assert

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

string literal concatenation in _Static_assert

UnknownGamer40464 .
this snippet:

#include <stdio.h>

int main(void){
   char s[] = "foo" "bar";
   puts(s);
   _Static_assert(1==1,"foo" "bar");
}

While running fine in gcc, clang, etc. fails to compile in tcc and it seems to be because compile-time string literal concatenation is not being performed inside static asserts.

In both cases, the concatenation for s is performed as expected, it is inside _Static_assert when this problem arises.

I get the exact error message "-:6: error: ')' expected (got ""bar"")"

Using "tcc -run -", but the same error occurs in a file as well.

I am using the latest mob, "tinycc-2690425".

Sorry if I'm misunderstanding something.

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: string literal concatenation in _Static_assert

Christian Jullien-3

Thanks for reporting this issue.

Related to this one, I see that static_assert is also missing from assert.h on Windows.

 

From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=[hidden email]] On Behalf Of UnknownGamer40464 .
Sent: Tuesday, January 14, 2020 04:37
To: [hidden email]
Subject: [Tinycc-devel] string literal concatenation in _Static_assert

 

this snippet:

 

#include <stdio.h>

 

int main(void){

   char s[] = "foo" "bar";

   puts(s);

   _Static_assert(1==1,"foo" "bar");

}

 

While running fine in gcc, clang, etc. fails to compile in tcc and it seems to be because compile-time string literal concatenation is not being performed inside static asserts.

 

In both cases, the concatenation for s is performed as expected, it is inside _Static_assert when this problem arises.

 

I get the exact error message "-:6: error: ')' expected (got ""bar"")"

 

Using "tcc -run -", but the same error occurs in a file as well.

 

I am using the latest mob, "tinycc-2690425".

 

Sorry if I'm misunderstanding something.


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: string literal concatenation in _Static_assert

uso ewin
Hello,

I think I've fix this issue on my github repository:
https://github.com/cosmo-ray/tcc/commit/37af768f4524923d349f473e0b7884602069e368

Can you please review it ?

If no one answer I'll wait a week and push it.

Thanks,

Matthias

On Tue, Jan 14, 2020 at 7:23 AM Christian Jullien <[hidden email]> wrote:

>
> Thanks for reporting this issue.
>
> Related to this one, I see that static_assert is also missing from assert.h on Windows.
>
>
>
> From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=[hidden email]] On Behalf Of UnknownGamer40464 .
> Sent: Tuesday, January 14, 2020 04:37
> To: [hidden email]
> Subject: [Tinycc-devel] string literal concatenation in _Static_assert
>
>
>
> this snippet:
>
>
>
> #include <stdio.h>
>
>
>
> int main(void){
>
>    char s[] = "foo" "bar";
>
>    puts(s);
>
>    _Static_assert(1==1,"foo" "bar");
>
> }
>
>
>
> While running fine in gcc, clang, etc. fails to compile in tcc and it seems to be because compile-time string literal concatenation is not being performed inside static asserts.
>
>
>
> In both cases, the concatenation for s is performed as expected, it is inside _Static_assert when this problem arises.
>
>
>
> I get the exact error message "-:6: error: ')' expected (got ""bar"")"
>
>
>
> Using "tcc -run -", but the same error occurs in a file as well.
>
>
>
> I am using the latest mob, "tinycc-2690425".
>
>
>
> Sorry if I'm misunderstanding something.
>
> _______________________________________________
> Tinycc-devel mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel