I'll push a patch.

bug:

----------------------------------------------------------------------
#define hexCh(c (c >= 10 ? 'a' + c - 10 : '0' + c)
  hexCh(c);

out:
jiang@jiang:~/test$ ./tcc -E c4.c
# 1 "c4.c"

(c >= 10 ? 'a' + c - 10 : '0' + c);
---------------------------------------------------------------

#define hexCh(c/3) (c >= 10 ? 'a' + c - 10 : '0' + c)
hexCh(c);

out:
jiang@jiang:~/test$ ./tcc -E c4.c
# 1 "c4.c"

/3) (c >= 10 ? 'a' + c - 10 : '0' + c);
jiang@jiang:~/test$

after patch:

# 1 "c4.c"
c4.c:1: error: may not appear in macro parameter list: "("
jiang@jiang:~/test$



jiang@jiang:~/test$ ./tcc -E c4.c
# 1 "c4.c"
c4.c:1: error: may not appear in macro parameter list: "/"
jiang@jiang:~/test$



-------------------------------------------------------------------------
    [email protected]:weixiao/tinycc.git

Thank you for reminding

jiang

? 2014?06?23? 09:50, [email protected] ??:
Hey jiang,

For each of these three patches, please explain the following:

1) When run with the version of tcc without your patch, what behavior do you get? What does the C99 spec tell us we should get?
2) How does the proposed patch alter the behavior of tcc?

Also, it appears you did not read the links I provided about how to write good commit messages. Please re-read those and write better ones.

Thanks!
David


On Sun, Jun 22, 2014 at 3:41 AM, jiang <[email protected] <mailto:[email protected]>> wrote:

    Here is a patch to push
    I hope to help you.

    jiang

    _______________________________________________
    Tinycc-devel mailing list
    [email protected] <mailto:[email protected]>
    https://lists.nongnu.org/mailman/listinfo/tinycc-devel




--
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan
" tinycc is a great project, and I am honored to join a project  "
commit 87373cd0ec7f5b0c0de77565090bf9710d7107a0
Author: jiang <[email protected]>
Date:   Mon Jun 16 16:43:40 2014 +0800

    #define bug fixes
    bug:
    #define hexCh(c (c >= 10 ? 'a' + c - 10 : '0' + c)
    hexCh(c);

diff --git a/tccpp.c b/tccpp.c
index 053fd57..dfbc857 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -1253,16 +1253,15 @@ ST_FUNC void parse_define(void)
                 next_nomacro();
             }
             if (varg < TOK_IDENT)
-                tcc_error("badly punctuated parameter list");
+                tcc_error("may not appear in macro parameter list: \"%s\"", 
get_tok_str(varg, NULL));
             s = sym_push2(&define_stack, varg | SYM_FIELD, is_vaargs, 0);
             *ps = s;
             ps = &s->next;
             if (tok != ',')
-                break;
+                continue;
             next_nomacro();
         }
-        if (tok == ')')
-            next_nomacro_spc();
+        next_nomacro_spc();
         t = MACRO_FUNC;
     }
     tok_str_new(&str);
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to