changeset 914:f7803d618f36

fix
author kono
date Thu, 10 Apr 2014 11:30:54 +0900
parents 553cd297b0a8
children 0b55a3ab50d3
files mc-macro.c mc-tree.c test/macro.c
diffstat 3 files changed, 26 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mc-macro.c	Wed Apr 09 21:21:26 2014 +0900
+++ b/mc-macro.c	Thu Apr 10 11:30:54 2014 +0900
@@ -292,6 +292,7 @@
     // should check filep over flow (sigh...)
     (filep+1)->inc = end;
     (filep+1)->name0 = name;
+    if (lsrc) { printf("## file %s\n", name); }
     return ( (filep+1)->fcb = fp );
 }
 
@@ -1045,10 +1046,12 @@
             default:
                 if (prev_concat) {
                     prev_concat = 0;
-                    macro = nptrm->u.nm;
+                    // macro = nptrm->u.nm;
+                    macro = nptrm->nm;
                 } else if (next_concat(c,body)) {
                     prev_concat = 1;
-                    macro = nptrm->u.nm;
+                    // macro = nptrm->u.nm;
+                    macro = nptrm->nm;
                 }  
                 if (macro==0 || !macro[0]) 
                     macro = nptrm->nm;
--- a/mc-tree.c	Wed Apr 09 21:21:26 2014 +0900
+++ b/mc-tree.c	Thu Apr 10 11:30:54 2014 +0900
@@ -209,7 +209,21 @@
     case AS+BAND: *name = "&="; *args="ee"; *order=1; break;
     case AS+EOR: *name = "^="; *args="ee"; *order=1; break;
     case AS+BOR: *name = "|="; *args="ee"; *order=1; break;
-    default: found = 0;
+    case RESTRICT: *name = "restrict"; *args=""; *order=1; break;
+    case TYPEOF: *name = "typeof"; *args="e"; *order=1; break;
+    case BUILTIN_TYPES_COMPATIBLE_P: *name = "__builtin_types_compatible_p"; *args="e"; *order=1; break;
+    case FOR: *name = "for"; *args="eee"; *order=1; break;
+    case IF: *name = "if"; *args="ee"; *order=1; break;
+    case SWITCH: *name = "switch"; *args="ee"; *order=1; break;
+    case CASE: *name = "case"; *args="e"; *order=1; break;
+    case DEFAULT: *name = "default"; *args=""; *order=1; break;
+    case WHILE: *name = "while"; *args="ee"; *order=1; break;
+    case GOTO: *name = "goto"; *args="e"; *order=1; break;
+    case DO: *name = "do"; *args="ee"; *order=1; break;
+
+    default: 
+    found = 0;
+
 fprintf(stderr,"Unknown ID %d [%d]in find node\n",id,OP(id));
 
     }
--- a/test/macro.c	Wed Apr 09 21:21:26 2014 +0900
+++ b/test/macro.c	Thu Apr 10 11:30:54 2014 +0900
@@ -58,10 +58,12 @@
 #define name(a,b)   name_##b(a)
 
 #define names(a,b)   name_ ## b(a)
+#define names1(x,y)   names(x,y)
 
 #define name_hoge(c)   (c+a)
-
-#define hoge000(a)    (a+a) /*  hoge
+#define name_aho(c)   (c*a)
+#define hoge000(a)    (a+a) 
+#define aho000(a)    (a*a) /*  hoge
   comment 
 */
 
@@ -104,8 +106,8 @@
     printf("#0103:%d\n",name(3,hoge));
     printf("#0104:%d\n",names(3,hoge));
     printf("#0105:%d\n",hoge000(3));
-    f();
-    return 0;
+    printf("#0106:%d\n",names1(4,aho));
+    f(); return 0;
 }
 
 /* For GCC 2.7 and later, we can use specific type-size attributes.  */