From 08729612699f5441992c35287737a58f412961b3 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 4 Dec 2012 12:48:52 +0900 Subject: [PATCH] Do a little bit of cleanup. --- tools/qfcc/include/cpp.h | 2 +- tools/qfcc/include/debug.h | 4 ---- tools/qfcc/include/function.h | 1 + tools/qfcc/include/grab.h | 1 + tools/qfcc/include/method.h | 4 ++-- tools/qfcc/include/obj_file.h | 2 +- tools/qfcc/include/qfcc.h | 10 ---------- tools/qfcc/source/debug.c | 15 ++------------- tools/qfcc/source/def.c | 1 + tools/qfcc/source/function.c | 1 - tools/qfcc/source/method.c | 1 + tools/qfcc/source/qc-lex.l | 1 + tools/qfcc/source/qfcc.c | 2 ++ tools/qfcc/source/qp-lex.l | 1 + tools/qfcc/source/struct.c | 1 + tools/qfcc/source/stub.c | 2 -- 16 files changed, 15 insertions(+), 34 deletions(-) diff --git a/tools/qfcc/include/cpp.h b/tools/qfcc/include/cpp.h index 274ee3d54..6b599b439 100644 --- a/tools/qfcc/include/cpp.h +++ b/tools/qfcc/include/cpp.h @@ -37,7 +37,7 @@ void parse_cpp_name (void); void add_cpp_def (const char *arg); void intermediate_file (struct dstring_s *ifile, const char *filename, const char *ext, int local); -FILE * preprocess_file (const char *filename, const char *ext); +FILE *preprocess_file (const char *filename, const char *ext); extern const char *cpp_name; extern struct dstring_s *tempname; diff --git a/tools/qfcc/include/debug.h b/tools/qfcc/include/debug.h index b04663661..a5d5b5a1f 100644 --- a/tools/qfcc/include/debug.h +++ b/tools/qfcc/include/debug.h @@ -33,12 +33,8 @@ #include "QF/pr_debug.h" -void push_source_file (void); -void pop_source_file (void); void line_info (char *text); -pr_auxfunction_t *new_auxfunction (void); pr_lineno_t *new_lineno (void); -struct ddef_s *new_local (void); extern int lineno_base; diff --git a/tools/qfcc/include/function.h b/tools/qfcc/include/function.h index 1842a09f5..d627debfe 100644 --- a/tools/qfcc/include/function.h +++ b/tools/qfcc/include/function.h @@ -32,6 +32,7 @@ #define __function_h /** \defgroup qfcc_function Internal function structures. + \ingroup qfcc */ #include "QF/pr_comp.h" diff --git a/tools/qfcc/include/grab.h b/tools/qfcc/include/grab.h index 721c7714f..a55ce3b74 100644 --- a/tools/qfcc/include/grab.h +++ b/tools/qfcc/include/grab.h @@ -36,5 +36,6 @@ extern int grab_other; int do_grab (char *token); void add_frame_macro (char *token); +void clear_frame_macros (void); #endif//__grab_h diff --git a/tools/qfcc/include/method.h b/tools/qfcc/include/method.h index 16176a309..ef51e1579 100644 --- a/tools/qfcc/include/method.h +++ b/tools/qfcc/include/method.h @@ -54,12 +54,12 @@ typedef struct selector_s { typedef struct methodlist_s { method_t *head; method_t **tail; - int count; ///< used only for emitting + int count; ///< used only for emitting int instance; ///< used only for emitting } methodlist_t; typedef struct keywordarg_s { - // the first two fields match the first two fiels of param_t in + // the first two fields match the first two fields of param_t in // functionl.h struct keywordarg_s *next; const char *selector; diff --git a/tools/qfcc/include/obj_file.h b/tools/qfcc/include/obj_file.h index 7d37fa737..c409bff89 100644 --- a/tools/qfcc/include/obj_file.h +++ b/tools/qfcc/include/obj_file.h @@ -67,7 +67,7 @@ typedef struct qfo_header_s { pr_int_t num_funcs; ///< number of function records pr_int_t num_lines; ///< number of line records pr_int_t num_loose_relocs; ///< number of loose relocation records - ///< included in num_relocs + ///< (included in num_relocs) } qfo_header_t; typedef enum qfos_type_e { diff --git a/tools/qfcc/include/qfcc.h b/tools/qfcc/include/qfcc.h index c0adf073c..f95e01af7 100644 --- a/tools/qfcc/include/qfcc.h +++ b/tools/qfcc/include/qfcc.h @@ -86,19 +86,10 @@ typedef struct pr_info_s { struct pr_lineno_s *linenos; int linenos_size; int num_linenos; - - ddef_t *locals; - int locals_size; - int num_locals; } pr_info_t; extern pr_info_t pr; - -extern char destfile[]; - -extern struct symtab_s *current_symtab; - #define GETSTR(s) (pr.strings->strings + (s)) #define D_var(t, d) ((d)->space->data[(d)->offset].t##_var) #define D_FLOAT(d) D_var (float, d) @@ -118,7 +109,6 @@ extern struct symtab_s *current_symtab; const char *strip_path (const char *filename); -void clear_frame_macros (void); extern FILE *qc_yyin; extern FILE *qp_yyin; int qc_yyparse (void); diff --git a/tools/qfcc/source/debug.c b/tools/qfcc/source/debug.c index 22fcd4f51..b7ce5a87f 100644 --- a/tools/qfcc/source/debug.c +++ b/tools/qfcc/source/debug.c @@ -53,7 +53,7 @@ int lineno_base; static srcline_t *free_srclines; -void +static void push_source_file (void) { srcline_t *srcline; @@ -64,7 +64,7 @@ push_source_file (void) pr.srcline_stack = srcline; } -void +static void pop_source_file (void) { srcline_t *tmp; @@ -125,14 +125,3 @@ new_lineno (void) memset (&pr.linenos[pr.num_linenos], 0, sizeof (pr_lineno_t)); return &pr.linenos[pr.num_linenos++]; } - -ddef_t * -new_local (void) -{ - if (pr.num_locals == pr.locals_size) { - pr.locals_size += 1024; - pr.locals = realloc (pr.locals, pr.locals_size * sizeof (ddef_t)); - } - memset (&pr.locals[pr.num_locals], 0, sizeof (ddef_t)); - return &pr.locals[pr.num_locals++]; -} diff --git a/tools/qfcc/source/def.c b/tools/qfcc/source/def.c index 84a30d15a..0ee88b95d 100644 --- a/tools/qfcc/source/def.c +++ b/tools/qfcc/source/def.c @@ -53,6 +53,7 @@ #include "function.h" #include "options.h" #include "reloc.h" +#include "shared.h" #include "strpool.h" #include "struct.h" #include "symtab.h" diff --git a/tools/qfcc/source/function.c b/tools/qfcc/source/function.c index d81f32e30..f08b35d97 100644 --- a/tools/qfcc/source/function.c +++ b/tools/qfcc/source/function.c @@ -560,7 +560,6 @@ begin_function (symbol_t *sym, const char *nicename, symtab_t *parent, if (options.code.debug) { pr_lineno_t *lineno = new_lineno (); sym->s.func->line_info = lineno - pr.linenos; - sym->s.func->local_defs = pr.num_locals; } build_scope (sym, parent); diff --git a/tools/qfcc/source/method.c b/tools/qfcc/source/method.c index 717241014..ab1c873a8 100644 --- a/tools/qfcc/source/method.c +++ b/tools/qfcc/source/method.c @@ -55,6 +55,7 @@ #include "method.h" #include "options.h" #include "reloc.h" +#include "shared.h" #include "strpool.h" #include "struct.h" #include "symtab.h" diff --git a/tools/qfcc/source/qc-lex.l b/tools/qfcc/source/qc-lex.l index 9cb0e3027..aa076dc42 100644 --- a/tools/qfcc/source/qc-lex.l +++ b/tools/qfcc/source/qc-lex.l @@ -53,6 +53,7 @@ #include "options.h" #include "pragma.h" #include "qfcc.h" +#include "shared.h" #include "strpool.h" #include "struct.h" #include "symtab.h" diff --git a/tools/qfcc/source/qfcc.c b/tools/qfcc/source/qfcc.c index 10a502e1f..ba7610929 100644 --- a/tools/qfcc/source/qfcc.c +++ b/tools/qfcc/source/qfcc.c @@ -76,6 +76,7 @@ #include "emit.h" #include "expr.h" #include "function.h" +#include "grab.h" #include "idstuff.h" #include "linker.h" #include "method.h" @@ -83,6 +84,7 @@ #include "opcodes.h" #include "options.h" #include "reloc.h" +#include "shared.h" #include "strpool.h" #include "struct.h" #include "symtab.h" diff --git a/tools/qfcc/source/qp-lex.l b/tools/qfcc/source/qp-lex.l index 4dda1d1d7..e1c837c98 100644 --- a/tools/qfcc/source/qp-lex.l +++ b/tools/qfcc/source/qp-lex.l @@ -39,6 +39,7 @@ #include "expr.h" #include "grab.h" #include "qfcc.h" +#include "shared.h" #include "strpool.h" #include "symtab.h" #include "type.h" diff --git a/tools/qfcc/source/struct.c b/tools/qfcc/source/struct.c index 6adfb6872..ba6407a36 100644 --- a/tools/qfcc/source/struct.c +++ b/tools/qfcc/source/struct.c @@ -55,6 +55,7 @@ #include "obj_type.h" #include "qfcc.h" #include "reloc.h" +#include "shared.h" #include "strpool.h" #include "struct.h" #include "symtab.h" diff --git a/tools/qfcc/source/stub.c b/tools/qfcc/source/stub.c index b9810f2b9..954472b49 100644 --- a/tools/qfcc/source/stub.c +++ b/tools/qfcc/source/stub.c @@ -28,7 +28,5 @@ void encode_type (struct dstring_s *str, type_t *type) {} codespace_t *codespace_new (void) {return 0;} void codespace_addcode (codespace_t *codespace, struct dstatement_s *code, int size) {} int function_parms (function_t *f, byte *parm_size) {return 0;} -pr_auxfunction_t *new_auxfunction (void) {return 0;} -ddef_t *new_local (void) {return 0;} void def_to_ddef (def_t *def, ddef_t *ddef, int aux) {} expr_t *warning (expr_t *e, const char *fmt, ...) {return 0;}