tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Dollar Sign in Identifiers Extension


From: Daniel Holden
Subject: Re: [Tinycc-devel] Dollar Sign in Identifiers Extension
Date: Mon, 13 Apr 2015 16:01:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

Hi,

I've attached a new patch which tests for dollars in identifiers in C.

I've added a new parsing flag `PARSE_FLAG_ASM` to block the use of dollar identifiers when parsing asm. This could probably be combined with the `PARSE_FLAG_ASM_COMMENTS` flag.

Currently the flag only blocks identifiers in asm _starting_ with a dollar. I think this is the only syntactically valid place in which dollars occurring could conflict with gas asm, but they might appear inside identifiers if the programmer is either referencing a symbol with a dollar in _or_ if they've made a syntax error. I'll look into it more and do some more testing.

I'm on 64 bit and I have to hack the makefiles to run the assembly tests because they are written in 32-bit x86. Does anyone have a 32-bit machine they are testing tcc on?

- Dan


On 11/04/15 14:09, Sergey Korshunoff wrote:
Hi!
although in almost all cases it is enabled by default
This can be done by using FD_INVERT insteed of 0 in the patch. But
keeping an old behavior of the tcc is safer (I think).

so they also provide "-fno-dollars-in-identifiers"
this works in tcc too.  Try to test.


2015-04-11 14:49 GMT+03:00, Daniel Holden <address@hidden>:
Hi,

I like the idea of using std=c99 to disable. I believe this is how
gcc/clang handle it. But ultimately I don't mind too much. gcc/clang use
the switch "-fdollars-in-identifiers" (I've attached a modified patch)
although in almost all cases it is enabled by default so they also
provide "-fno-dollars-in-identifiers".

https://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html

I'm mainly interested in this change because I'm working on a new
version of my library Cello: http://libcello.org/ which uses `$` and
several variations of as macros. There is also RayLanguage which also
uses it as a macro for a kind of ObjC style message passing:
https://github.com/kojiba/RayLanguage . But I can also put together some
test cases using it in the various ways (variable, function, macro,
define, etc) so make sure it is completely covered.

Thanks,

Dan

On 11/04/2015 10:00, Thomas Preud'homme wrote:
Le samedi 11 avril 2015, 06:14:04 Sergey Korshunoff a écrit :
Hi! A modified version of the patch is attached.
Looks good at quick look. I'm not sure about the switch, we already
accept
some gnu extension without any switch for that. Or maybe introduce a more
general switch for all C extensions. You could enable it by default en
disable
it if std=c99 for instance?

Best regards,

Thomas


_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

Attachment: dollars-in-identifiers.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]