On Fri, Jul 17, 2015 at 8:34 PM, Eric Pruitt wrote:
>
> You forgot the attachments.
Lol, sorry, again:
patch 1: whitespace fixes
patch 2: make fp of type FILE * and use needed includes
patch 3: fix missing ;
From fdcb684addcb71b6067b6668bd0e723277e22544 Mon Sep 17 00:00:00 2001
From: Hiltjo Posthuma
Date: Fri, 17 Jul 2015 20:28:56 +0200
Subject: [PATCH 1/3] whitespace fixes
---
cc1/cc1.h | 1 -
cc1/cpp.c | 26 +-
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/cc1/cc1.h b/cc1/cc1.h
index 7095cf2..6a9d9aa 100644
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -13,7 +13,6 @@ typedef struct caselist Caselist;
typedef struct node Node;
typedef struct input Input;
-
struct type {
unsigned char op; /* type builder operator */
unsigned char ns;
diff --git a/cc1/cpp.c b/cc1/cpp.c
index 534585a..3e10e2e 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -59,17 +59,17 @@ icpp(void)
static void
nextcpp(void)
{
-next();
-if (yytoken == EOFTOK)
+ next();
+ if (yytoken == EOFTOK)
error("unterminated argument list invoking macro \"%s\"",
- macroname);
-if (yylen + 1 > arglen)
-error("argument overflow invoking macro \"%s\"",
- macroname);
-memcpy(argp, yytext, yylen);
-argp += yylen;
-*argp++ = ' ';
-arglen -= yylen + 1;
+ macroname);
+ if (yylen + 1 > arglen)
+ error("argument overflow invoking macro \"%s\"",
+ macroname);
+ memcpy(argp, yytext, yylen);
+ argp += yylen;
+ *argp++ = ' ';
+ arglen -= yylen + 1;
}
static void
@@ -171,7 +171,7 @@ copymacro(char *bp, char *s, size_t bufsiz, char *arglist[])
s += 2;
}
}
-*bp = '\0';
+ *bp = '\0';
return;
@@ -201,8 +201,8 @@ expand(char *begin, Symbol *sym)
macroname = sym->name;
if (!parsepars(arguments, arglist, atoi(s)))
return 0;
-for (n = 0; n < atoi(s); ++n)
-fprintf(stderr, "PAR%d:%s\n", n, arglist[n]);
+ for (n = 0; n < atoi(s); ++n)
+ fprintf(stderr, "PAR%d:%s\n", n, arglist[n]);
copymacro(buffer, s+3, INPUTSIZ-1, arglist);
--
2.3.0
From 88eb60a95be178120f204bc80d6a011cece4522b Mon Sep 17 00:00:00 2001
From: Hiltjo Posthuma
Date: Fri, 17 Jul 2015 20:29:28 +0200
Subject: [PATCH 2/3] make fp of type FILE * and use needed includes
---
cc1/cc1.h| 2 +-
cc1/decl.c | 1 +
cc1/symbol.c | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/cc1/cc1.h b/cc1/cc1.h
index 6a9d9aa..5a18e21 100644
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -73,7 +73,7 @@ struct yystype {
struct input {
char *fname;
- void *fp;
+ FILE *fp;
char *line, *begin, *p;
struct input *next;
unsigned short nline;
diff --git a/cc1/decl.c b/cc1/decl.c
index 9d6ff98..ded6ee4 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -1,6 +1,7 @@
#include
#include
+#include
#include
#include "../inc/sizes.h"
diff --git a/cc1/symbol.c b/cc1/symbol.c
index 57eb7ac..c869cd6 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -1,5 +1,6 @@
#include
+#include
#include
#include
--
2.3.0
From a81a19be94c21fffa5b92aeb6bd484f50f5e62c0 Mon Sep 17 00:00:00 2001
From: Hiltjo Posthuma
Date: Fri, 17 Jul 2015 20:29:58 +0200
Subject: [PATCH 3/3] fix missing ;
---
cc1/cpp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cc1/cpp.c b/cc1/cpp.c
index 3e10e2e..4df8244 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -447,7 +447,7 @@ ifclause(int isdef)
if (cppctx == NR_COND-1)
error("too much nesting levels of conditional inclusion");
- n = cppctx++
+ n = cppctx++;
if (yytoken != IDEN) {
error("no macro name given in #%s directive",
(isdef) ? "ifdef" : "ifndef");
--
2.3.0