Remove the sed fixup of va_arg() after xification, as it's not needed for VAX
authorNick Downing <downing.nick@gmail.com>
Thu, 2 Feb 2017 12:30:32 +0000 (23:30 +1100)
committerNick Downing <downing.nick@gmail.com>
Thu, 2 Feb 2017 12:30:32 +0000 (23:30 +1100)
bin/csh/doprnt.c
lib/libc/stdio/doprnt.c
xify/cc.sh
xify/xify.c

index b53b2c4..70a8b78 100644 (file)
@@ -62,7 +62,7 @@ static char sccsid[] = "@(#)doprnt.c  5.35 (Berkeley) 6/27/88";
 
 #define        ARG() \
        _ulong = flags&LONGINT ? va_arg(argp, long) : \
-           flags&SHORTINT ? va_arg(argp, short) : va_arg(argp, int);
+           /*flags&SHORTINT ? va_arg(argp, short) :*/ va_arg(argp, int);
 
 #define        todigit(c)      ((c) - '0')
 #define        tochar(n)       ((n) + '0')
index 29a1eff..177b96d 100644 (file)
@@ -58,7 +58,7 @@ static char sccsid[] = "@(#)doprnt.c  5.35 (Berkeley) 6/27/88";
 
 #define        ARG() \
        _ulong = flags&LONGINT ? va_arg(argp, long) : \
-           flags&SHORTINT ? va_arg(argp, short) : va_arg(argp, int);
+           /*flags&SHORTINT ? va_arg(argp, short) :*/ va_arg(argp, int);
 
 #define        todigit(c)      ((c) - '0')
 #define        tochar(n)       ((n) + '0')
index 69c38c8..05827bc 100755 (executable)
@@ -240,31 +240,51 @@ then
         continue
       fi
 
+#      j=
+#      if test -z "$xflag"
+#      then
+## a bit horrible because we cannot redirect sed output to $tmp.c conditionally
+#        if test -n "$debug"
+#        then
+#          echo $xify $tmp_i "|"sed -e "'s/va_arg(x_argp, x_\\\\(unsigned_\\\\)\\\\?\\\\(short\\\\|int\\\\|long\\\\))/_va_arg_\\\\1\\\\2(x_argp)/g'" ">"$tmp.c
+#        fi
+#        if ! $xify $tmp_i |sed -e 's/va_arg(x_argp, x_\(unsigned_\)\?\(short\|int\|long\))/_va_arg_\1\2(x_argp)/g' >$tmp.c
+#        then
+#          cflag=1
+#          eflag=1
+#          continue
+#        fi
+#      else
+#        if test -n "$debug"
+#        then
+#          echo $xify $tmp_i "|"sed -e "'s/va_arg(x_argp, x_\\(unsigned_\\)\\?\\(short\\|int\\|long\\))/_va_arg_\\1\\2(x_argp)/g'"
+#        fi
+#        if ! $xify $tmp_i |sed -e 's/va_arg(x_argp, x_\(unsigned_\)\?\(short\|int\|long\))/_va_arg_\1\2(x_argp)/g'
+#        then
+#          cflag=1
+#          eflag=1
+#          continue
+#        fi
+#        cflag=1
+#        continue
+#      fi
       j=
       if test -z "$xflag"
       then
-# a bit horrible because we cannot redirect sed output to $tmp.c conditionally
-        if test -n "$debug"
-        then
-          echo $xify $tmp_i "|"sed -e "'s/va_arg(x_argp, x_\\\\(unsigned_\\\\)\\\\?\\\\(short\\\\|int\\\\|long\\\\))/_va_arg_\\\\1\\\\2(x_argp)/g'" ">"$tmp.c
-        fi
-        if ! $xify $tmp_i |sed -e 's/va_arg(x_argp, x_\(unsigned_\)\?\(short\|int\|long\))/_va_arg_\1\2(x_argp)/g' >$tmp.c
-        then
-          cflag=1
-          eflag=1
-          continue
-        fi
-      else
-        if test -n "$debug"
-        then
-          echo $xify $tmp_i "|"sed -e "'s/va_arg(x_argp, x_\\(unsigned_\\)\\?\\(short\\|int\\|long\\))/_va_arg_\\1\\2(x_argp)/g'"
-        fi
-        if ! $xify $tmp_i |sed -e 's/va_arg(x_argp, x_\(unsigned_\)\?\(short\|int\|long\))/_va_arg_\1\2(x_argp)/g'
-        then
-          cflag=1
-          eflag=1
-          continue
-        fi
+        j=" $tmp.c"
+      fi
+      if test -n "$debug"
+      then
+        echo $xify $tmp_i$j
+      fi
+      if ! $xify $tmp_i$j
+      then
+        cflag=1
+        eflag=1
+        continue
+      fi
+      if test -n "$xflag"
+      then
         cflag=1
         continue
       fi
index 925b66f..b41d6c8 100644 (file)
@@ -91,19 +91,14 @@ int main(argc, argv) int argc; char **argv; {
   else if ((fout = fopen(argv[2], "w")) == 0)
     abort();
 
-  fputs("#include <stdint.h>\n\
+  fputs("\
+#include <stdint.h>\n\
 typedef int16_t x_short;\n\
 typedef int32_t x_int;\n\
 typedef int32_t x_long;\n\
 typedef uint16_t x_unsigned_short;\n\
 typedef uint32_t x_unsigned_int;\n\
-typedef uint32_t x_unsigned_long;\n\
-#define _va_arg_short(argp) va_arg(argp, int)\n\
-#define _va_arg_int(argp) va_arg(argp, int)\n\
-#define _va_arg_long(argp) va_arg(argp, int)\n\
-#define _va_arg_unsigned_short(argp) va_arg(argp, unsigned int)\n\
-#define _va_arg_unsigned_int(argp) va_arg(argp, unsigned int)\n\
-#define _va_arg_unsigned_long(argp) va_arg(argp, unsigned int)\n", fout);
+typedef uint32_t x_unsigned_long;\n", fout);
 
   while (fgets(buf, sizeof(buf), fin)) {
     p = buf;
@@ -435,9 +430,11 @@ typedef uint32_t x_unsigned_long;\n\
           if (p[l] == ';') {
             ++l;
             if (typedef_state == 3) {
+#if 0
  fwrite("typedef: ", 9, 1, stderr);
  fwrite(typedef_str_data, typedef_str_len, 1, stderr);
  putc('\n', stderr);
+#endif
               if ((q = malloc(typedef_str_len)) == 0)
                 abort();
               memcpy(q, typedef_str_data, typedef_str_len);