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 17:51:13 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

Hi Ramsey,

Thanks for trying it. The patch I made is from stable download here http://bellard.org/tcc/ Sorry if that is wrong. Where can I get the mob branch?

Thanks,

Dan

On 13/04/2015 18:16, Ramsay Jones wrote:
On 13/04/15 16:01, Daniel Holden wrote:
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?

Your patch does not apply to the mob branch:

   $ git apply ../dollars-in-identifiers.patch
   ../dollars-in-identifiers.patch:36: trailing whitespace.
../dollars-in-identifiers.patch:40: trailing whitespace.
           || (parse_flags & PARSE_FLAG_ASM)) goto parse_simple;
   ../dollars-in-identifiers.patch:41: trailing whitespace.
../dollars-in-identifiers.patch:135: trailing whitespace. ../dollars-in-identifiers.patch:138: trailing whitespace. error: patch failed: tcc.h:528
   error: tcc.h: patch does not apply
   error: patch failed: libtcc.c:1423
   error: libtcc.c: patch does not apply
   error: patch failed: tccpp.c:2178
   error: tccpp.c: patch does not apply
   error: patch failed: ./tests/tests2/Makefile:67
   error: ./tests/tests2/Makefile: patch does not apply
   $

... but I'm guessing you already know that!

Applying your patch instead to the master branch:

   $ git apply ../dollars-in-identifiers.patch
   ../dollars-in-identifiers.patch:36: trailing whitespace.
../dollars-in-identifiers.patch:40: trailing whitespace.
           || (parse_flags & PARSE_FLAG_ASM)) goto parse_simple;
   ../dollars-in-identifiers.patch:41: trailing whitespace.
../dollars-in-identifiers.patch:135: trailing whitespace. ../dollars-in-identifiers.patch:138: trailing whitespace. warning: squelched 3 whitespace errors
   warning: 8 lines add whitespace errors.
   $

... shows that you are introducing some whitespace errors
(although the number of lines doesn't seem to tally!).

After 'git apply'-ing your patch and staging ('git add'-ing)
your changes (including the new files), then:

   $ git diff --cached --check
   tccpp.c:2181: trailing whitespace.
   +
   tccpp.c:2185: trailing whitespace.
   +        || (parse_flags & PARSE_FLAG_ASM)) goto parse_simple;
   tccpp.c:2186: trailing whitespace.
   +
   tests/tests2/56_dollars.c:20: trailing whitespace.
   +
   tests/tests2/56_dollars.c:23: trailing whitespace.
   +
   tests/tests2/56_dollars.c:24: trailing whitespace.
   +   int $ = 10;
   tests/tests2/56_dollars.c:30: trailing whitespace.
   +
   tests/tests2/56_dollars.c:42: new blank line at EOF.
   $

(you can't see the red highlight on the trailing whitespace in
an email, of course! ;)

Note: so far this is on an 64-bit system, I was going to try on
a 32-bit system later.

After running:

   $ make clean
   ...
   $ ./configure
   ...
   $ make
   ...
   $ make test
   ...
   Test: 56_dollars...
   56_dollars.c:14: error: '$' undeclared
   make[2]: *** [56_dollars.test] Error 1
   make[2]: Leaving directory `/home/ramsay/tinycc/tests/tests2'
   make[1]: *** [moretests] Error 2
   make[1]: Leaving directory `/home/ramsay/tinycc/tests'
   make: *** [test] Error 2
   $

So, I'm obviously doing something wrong, sorry! :(

I suspect it's not worth trying on 32-bit, if I can't get it
to work on a 64-bit system.

ATB,
Ramsay Jones



_______________________________________________
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.




reply via email to

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