changeset 929:949ed26efba9

remove unnecessary code in mc-macro.c
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 13 Apr 2014 10:35:57 +0900
parents 96c53f76b360
children e4b2a7cce237
files Makefile mc-macro.c mc-parse.c
diffstat 3 files changed, 4 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sun Apr 13 10:21:40 2014 +0900
+++ b/Makefile	Sun Apr 13 10:35:57 2014 +0900
@@ -1,4 +1,4 @@
-GCC = gcc
+GCC = clang
 CC = $(GCC) -std=c99 $(CCEXT) $(M)  -fgnu89-inline 
 # -O3
 # MCFLAG = -DUSE_CODE_KEYWORD
--- a/mc-macro.c	Sun Apr 13 10:21:40 2014 +0900
+++ b/mc-macro.c	Sun Apr 13 10:35:57 2014 +0900
@@ -40,7 +40,7 @@
 static void macro_define0();
 static int macro_args(char **pchptr);
 static int macro_function(int macrop,char **pchptr,NMTBL *nptr,int history);
-static void local_define(char *macro,char *value, char *name);
+static void local_define(char *macro,char *value);
 static int macro_eval(int macrop,char *body0,int history,int local_only);
 static char * mappend0(int lists,char **result);
 static int macro_processing();
@@ -887,22 +887,6 @@
     return reverse0(args);
 }
 
-extern int current_scope;
-
-char *
-shallow_scope(int scope, char *name) 
-{
-    scope = car(scope);
-    for(int i = scope;i;i = cadr(i)) {
-        NMTBL *n = ncaddr(i);
-        if (!neqname(name,n->nm)) {
-            return ncaddr(car(i))->nm;
-        }
-    }
-    return name;
-}
-
-
 /* output macro expansion 
 
    This is a recursive interpreter. 
@@ -934,12 +918,10 @@
     // define all arguments locally
     //    #define arg0 arg0_value
     //    #define arg1 arg2_value ....
-    int upper = current_scope;
     enter_scope();
     while(args) {
         mappend0(reverse0(car(evalues)),&macro);
-        char *shallow =  shallow_scope(upper,scaddr(values));
-        local_define(scaddr(args),macro, shallow);
+        local_define(scaddr(args),macro);
         args = cadr(args);
         evalues = cadr(evalues);
         values = cadr(values);
@@ -958,15 +940,13 @@
  */
 
 static void
-local_define(char *macro,char *value, char *name)
+local_define(char *macro,char *value)
 {
     NMTBL *nptr0,*nlist;
     while(*macro==' '||*macro=='\t') macro++;
     nptr0 = name_space_search(nlist=get_name(macro,0,DEF),MACRO);
     nptr0 = make_local_scope(nlist,nptr0,MACRO);
-    nptr0->ty = 1; //mark for local define (else 0 )
     nptr0->nm = value;
-    nptr0->u.nm = name;  // shallow value for concatenation
 }
 
 static void
--- a/mc-parse.c	Sun Apr 13 10:21:40 2014 +0900
+++ b/mc-parse.c	Sun Apr 13 10:35:57 2014 +0900
@@ -72,7 +72,6 @@
 static struct cheap *nptr_pool,*nptr_pool0;
 static NMTBL *free_nptr_list;
 
-extern int current_scope;         // scope unwinder
 int current_scope;         // scope unwinder
 
 int attribute;                    // current attribte list