scc

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

commit 3fe7aa67651c02c0d54098b6c32c1db012e56170
parent 711bace8774f91a3254ae7ef98166a2b2906f353
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 29 Jul 2012 09:38:29 +0200

Changed user options to shorter forms

Previous one were too much verbose.

Diffstat:
Mcc.h | 9++++-----
Mdecl.c | 5+++--
Mmain.c | 2+-
Mtypes.c | 4++--
4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/cc.h b/cc.h @@ -7,14 +7,13 @@ extern const char *filename; struct user_opt { - unsigned char implicit_int; + unsigned char implicit; unsigned char c99; - unsigned char useless_typename; - unsigned char typeqlf_repeat; + unsigned char useless; + unsigned char repeat; }; - -extern struct user_opt user_opt; +extern struct user_opt options; extern void warning(const char *fmt, ...); extern void error(const char *fmt, ...); diff --git a/decl.c b/decl.c @@ -133,7 +133,7 @@ static unsigned char listdcl(register struct ctype *tp) declarator(); new = decl_type(tp); if (!new->type) { - warning_error(user_opt.implicit_int, + warning_error(options.implicit, "type defaults to 'int' in declaration of '%s'", yytext); } else if (new->type == FTN && yytoken == '{') { @@ -159,7 +159,7 @@ unsigned char decl(void) warning("data definition has no type or storage class"); } if (yytoken == ';') { - warning_error(user_opt.useless_typename, + warning_error(options.useless, "useless type name in empty declaration"); } else if (listdcl(tp)) { /* in case of not being a function */ expect(';'); @@ -171,4 +171,5 @@ unsigned char decl(void) void type_name() { + } diff --git a/main.c b/main.c @@ -6,7 +6,7 @@ #include "syntax.h" extern void open_file(const char *file); -struct user_opt user_opt; +struct user_opt options; diff --git a/types.c b/types.c @@ -169,12 +169,12 @@ void ctype(struct ctype *cp, unsigned char mod) cp->c_reg = 1; return; case CONST: - if (user_opt.typeqlf_repeat && cp->c_reg) + if (options.repeat && cp->c_reg) goto duplicated; cp->c_const = 1; return; case VOLATILE: - if (user_opt.typeqlf_repeat && cp->c_volatile) + if (options.repeat && cp->c_volatile) goto duplicated; cp->c_volatile = 1; return;