On 14/04/15 04:47, Sergey Korshunoff wrote:
Hi!
2015-04-13 15:01 GMT, Daniel Holden <address@hidden>:
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.
In the mob branch there is a flag PARSE_FLAG_ASM_FILE (in
tcc_add_file_internal) turned on before calling tcc_assmble. What is
needed in tcc_assemble is to keep it when changing parse_flags. Then
your patch must check PARSE_FLAG_ASM_FILE and not a PARSE_FLAG_ASM.
PARSE_FLAG_ASM_FILE is introduced to solve problems of the
preprocessor (different rules of the # parsing)
First version of the your patch is pushed to mob by me (with you as
the autor of the patch in comments). Only addons of the new patch must
be pushed to the mob. Your patch contain a \r chars. Is this chars
are removed by git?
Ah, sorry Sergey, I hadn't noticed that you had already included an
earlier version of the patch. [Daniel, look on the mob branch for
commit dcb36587 ("-fdollar-in-identifiers switch which enables '$'
in identifiers", 12-04-2015)]
I notice that the mob branch does not contain Daniel's test '56_dollars.c'.
Since I had it laying around, I decided to hack the Makefile:
$ git diff
diff --git a/tests/tests2/Makefile b/tests/tests2/Makefile
index 35ab3c1..4334e75 100644
--- a/tests/tests2/Makefile
+++ b/tests/tests2/Makefile
@@ -76,6 +76,7 @@ TESTS = \
54_goto.test \
55_lshift_type.test \
56_btype_excess-1.test \
+ 56_dollars.test \
57_btype_excess-2.test \
58_function_redefinition.test \
59_function_array.test \
$
It should probably be called '76_dollars.c' by now! Now test:
$ make test
...
Test: 56_btype_excess-1...
Test: 56_dollars...
--- 56_dollars.expect 2015-04-13 17:39:08.787672483 +0100
+++ 56_dollars.output 2015-04-14 10:52:04.232805798 +0100
@@ -1,14 +1 @@
-fred=10
-joe=20
-henry=30
-fred2=10
-joe2=20
-henry2=30
-fred10=100
-joe_10=2
-local=10
-a100$=100
-a$$=1000
-a$c$b=2121
-$100=10000
-$$$=money
+56_dollars.c:3: error: invalid macro name '$'
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
$
HTH
ATB,
Ramsay Jones
_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel