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: Ramsay Jones
Subject: Re: [Tinycc-devel] Dollar Sign in Identifiers Extension
Date: Mon, 13 Apr 2015 18:29:32 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 13/04/15 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.
> 

Of course, I forgot that you said you had to hack the Makefile before
you could test on 64-bit systems ... sorry about that! :(

I will try it on a 32-bit system later ...

ATB,
Ramsay Jones

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




reply via email to

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