scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 04a23f827762c3430fb2002d9eeca96bbad775ef
parent cffac6768dcdad6bf8fadf8686b89c389a60dc22
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue,  5 Jun 2012 23:11:23 +0200

Removed compiling warning

This commit removes some warning due to lost inclusions and incorrect
definition of user_opt, which was defined in a header included in different
places (so there were more of one definition of the same variable).

Diffstat:
Mcc.h | 13++++++++-----
Mlex.c | 1+
Mmain.c | 3++-
Msyntax.h | 1+
Mtypes.c | 1+
5 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/cc.h b/cc.h @@ -5,12 +5,15 @@ extern unsigned linenum; extern unsigned columnum; extern const char *filename; -struct { - unsigned implicit_int : 1; - unsigned c99 : 1; - unsigned useless_typename : 1; -} user_opt; +struct user_opt { + unsigned char implicit_int; + unsigned char c99; + unsigned char useless_typename; +}; + + +extern struct user_opt user_opt; extern void warning(const char *fmt, ...); extern void error(const char *fmt, ...); diff --git a/lex.c b/lex.c @@ -4,6 +4,7 @@ #include <string.h> #include <ctype.h> +#include "cc.h" #include "symbol.h" #include "tokens.h" diff --git a/main.c b/main.c @@ -1,12 +1,13 @@ #include <stddef.h> +#include "cc.h" #include "tokens.h" #include "syntax.h" extern void open_file(const char *file); extern void init_lex(); - +struct user_opt user_opt; diff --git a/syntax.h b/syntax.h @@ -6,4 +6,5 @@ extern unsigned char nested_level; extern void compound(void); extern void expr(void); extern unsigned char decl(void); +extern void type_name(void); #endif diff --git a/types.c b/types.c @@ -2,6 +2,7 @@ #include <assert.h> #include <stdlib.h> +#include "cc.h" #include "tokens.h" #include "types.h"