Mercurial > hg > index.cgi
changeset 374:8e25147c2aa8
Clean up various "externs"
Apparently some compilers seriously choke on the "extern" keyword in some
circumstances where GCC does not. Remove most instances of "extern" to guard
against that.
Thanks to Erik G <erik@6809.org> for the patch.
author | William Astle <lost@l-w.ca> |
---|---|
date | Mon, 13 Jul 2015 20:31:56 -0600 |
parents | 00fced888c5d |
children | 71f507f404f1 |
files | lwasm/input.h lwasm/insn_gen.c lwasm/insn_logicmem.c lwasm/instab.c lwasm/instab.h lwasm/lwasm.c lwasm/lwasm.h lwasm/main.c lwasm/pass1.c lwasm/pseudo.c lwlib/lw_alloc.c lwlib/lw_alloc.h lwlib/lw_cmdline.c lwlib/lw_cmdline.h lwlib/lw_error.c lwlib/lw_error.h lwlib/lw_expr.h lwlib/lw_free.c lwlib/lw_realloc.c lwlib/lw_stack.h lwlib/lw_string.c lwlib/lw_string.h lwlib/lw_stringlist.h |
diffstat | 23 files changed, 228 insertions(+), 283 deletions(-) [+] |
line wrap: on
line diff
--- a/lwasm/input.h Wed Jun 24 19:39:13 2015 -0600 +++ b/lwasm/input.h Mon Jul 13 20:31:56 2015 -0600 @@ -29,15 +29,15 @@ int magic; } input_stack_entry; -extern void input_stack_push(asmstate_t *as, input_stack_entry *se); -extern input_stack_entry *input_stack_pop(asmstate_t *as, int magic, int (*fn)(input_stack_entry *e, void *data), void *data); +void input_stack_push(asmstate_t *as, input_stack_entry *se); +input_stack_entry *input_stack_pop(asmstate_t *as, int magic, int (*fn)(input_stack_entry *e, void *data), void *data); -extern void input_init(asmstate_t *as); -extern void input_openstring(asmstate_t *as, char *s, char *str); -extern void input_open(asmstate_t *as, char *s); -extern char *input_readline(asmstate_t *as); -extern char *input_curspec(asmstate_t *as); -extern FILE *input_open_standalone(asmstate_t *as, char *s, char **rfn); +void input_init(asmstate_t *as); +void input_openstring(asmstate_t *as, char *s, char *str); +void input_open(asmstate_t *as, char *s); +char *input_readline(asmstate_t *as); +char *input_curspec(asmstate_t *as); +FILE *input_open_standalone(asmstate_t *as, char *s, char **rfn); struct ifl { @@ -45,6 +45,6 @@ struct ifl *next; }; -extern struct ifl *ifl_head; +struct ifl *ifl_head; #endif
--- a/lwasm/insn_gen.c Wed Jun 24 19:39:13 2015 -0600 +++ b/lwasm/insn_gen.c Mon Jul 13 20:31:56 2015 -0600 @@ -27,12 +27,12 @@ #include "lwasm.h" #include "instab.h" -extern void insn_indexed_parse_aux(asmstate_t *as, line_t *l, char **p); -extern void insn_indexed_resolve_aux(asmstate_t *as, line_t *l, int force, int elen); -extern void insn_indexed_emit_aux(asmstate_t *as, line_t *l); +void insn_indexed_parse_aux(asmstate_t *as, line_t *l, char **p); +void insn_indexed_resolve_aux(asmstate_t *as, line_t *l, int force, int elen); +void insn_indexed_emit_aux(asmstate_t *as, line_t *l); -extern void insn_parse_indexed_aux(asmstate_t *as, line_t *l, char **p); -extern void insn_resolve_indexed_aux(asmstate_t *as, line_t *l, int force, int elen); +void insn_parse_indexed_aux(asmstate_t *as, line_t *l, char **p); +void insn_resolve_indexed_aux(asmstate_t *as, line_t *l, int force, int elen); // "extra" is required due to the way OIM, EIM, TIM, and AIM work void insn_parse_gen_aux(asmstate_t *as, line_t *l, char **p, int elen)
--- a/lwasm/insn_logicmem.c Wed Jun 24 19:39:13 2015 -0600 +++ b/lwasm/insn_logicmem.c Mon Jul 13 20:31:56 2015 -0600 @@ -29,9 +29,9 @@ #include "lwasm.h" #include "instab.h" -extern void insn_parse_gen_aux(asmstate_t *as, line_t *l, char **optr, int elen); -extern void insn_resolve_gen_aux(asmstate_t *as, line_t *l, int force, int elen); -extern void insn_emit_gen_aux(asmstate_t *as, line_t *l, int extra); +void insn_parse_gen_aux(asmstate_t *as, line_t *l, char **optr, int elen); +void insn_resolve_gen_aux(asmstate_t *as, line_t *l, int force, int elen); +void insn_emit_gen_aux(asmstate_t *as, line_t *l, int extra); // for aim, oim, eim, tim PARSEFUNC(insn_parse_logicmem)
--- a/lwasm/instab.c Wed Jun 24 19:39:13 2015 -0600 +++ b/lwasm/instab.c Mon Jul 13 20:31:56 2015 -0600 @@ -21,99 +21,98 @@ Contains the instruction table for assembling code */ #include <stdlib.h> -#define __instab_c_seen__ #include "instab.h" // inherent -extern PARSEFUNC(insn_parse_inh); +PARSEFUNC(insn_parse_inh); #define insn_resolve_inh NULL -extern EMITFUNC(insn_emit_inh); +EMITFUNC(insn_emit_inh); // inherent 6800 mode -extern PARSEFUNC(insn_parse_inh6800); +PARSEFUNC(insn_parse_inh6800); #define insn_resolve_inh6800 NULL -extern EMITFUNC(insn_emit_inh6800); +EMITFUNC(insn_emit_inh6800); // register to register -extern PARSEFUNC(insn_parse_rtor); +PARSEFUNC(insn_parse_rtor); #define insn_resolve_rtor NULL -extern EMITFUNC(insn_emit_rtor); +EMITFUNC(insn_emit_rtor); // TFM and variants -extern PARSEFUNC(insn_parse_tfmrtor); +PARSEFUNC(insn_parse_tfmrtor); #define insn_resolve_tfmrtor NULL -extern EMITFUNC(insn_emit_tfmrtor); -extern PARSEFUNC(insn_parse_tfm); +EMITFUNC(insn_emit_tfmrtor); +PARSEFUNC(insn_parse_tfm); #define insn_resolve_tfm NULL -extern EMITFUNC(insn_emit_tfm); +EMITFUNC(insn_emit_tfm); // register list -extern PARSEFUNC(insn_parse_rlist); +PARSEFUNC(insn_parse_rlist); #define insn_resolve_rlist NULL -extern EMITFUNC(insn_emit_rlist); +EMITFUNC(insn_emit_rlist); // indexed -extern PARSEFUNC(insn_parse_indexed); -extern RESOLVEFUNC(insn_resolve_indexed); -extern EMITFUNC(insn_emit_indexed); +PARSEFUNC(insn_parse_indexed); +RESOLVEFUNC(insn_resolve_indexed); +EMITFUNC(insn_emit_indexed); // generic 32 bit immediate -extern PARSEFUNC(insn_parse_gen32); -extern RESOLVEFUNC(insn_resolve_gen32); -extern EMITFUNC(insn_emit_gen32); +PARSEFUNC(insn_parse_gen32); +RESOLVEFUNC(insn_resolve_gen32); +EMITFUNC(insn_emit_gen32); // generic 16 bit immediate -extern PARSEFUNC(insn_parse_gen16); -extern RESOLVEFUNC(insn_resolve_gen16); -extern EMITFUNC(insn_emit_gen16); +PARSEFUNC(insn_parse_gen16); +RESOLVEFUNC(insn_resolve_gen16); +EMITFUNC(insn_emit_gen16); // generic 8 bit immediate -extern PARSEFUNC(insn_parse_gen8); -extern RESOLVEFUNC(insn_resolve_gen8); -extern EMITFUNC(insn_emit_gen8); +PARSEFUNC(insn_parse_gen8); +RESOLVEFUNC(insn_resolve_gen8); +EMITFUNC(insn_emit_gen8); // generic no immediate -extern PARSEFUNC(insn_parse_gen0); -extern RESOLVEFUNC(insn_resolve_gen0); -extern EMITFUNC(insn_emit_gen0); +PARSEFUNC(insn_parse_gen0); +RESOLVEFUNC(insn_resolve_gen0); +EMITFUNC(insn_emit_gen0); // logic memory -extern PARSEFUNC(insn_parse_logicmem); -extern RESOLVEFUNC(insn_resolve_logicmem); -extern EMITFUNC(insn_emit_logicmem); +PARSEFUNC(insn_parse_logicmem); +RESOLVEFUNC(insn_resolve_logicmem); +EMITFUNC(insn_emit_logicmem); // 8 bit immediate only -extern PARSEFUNC(insn_parse_imm8); +PARSEFUNC(insn_parse_imm8); #define insn_resolve_imm8 NULL -extern EMITFUNC(insn_emit_imm8); +EMITFUNC(insn_emit_imm8); // bit to bit ops -extern PARSEFUNC(insn_parse_bitbit); +PARSEFUNC(insn_parse_bitbit); #define insn_resolve_bitbit NULL -extern EMITFUNC(insn_emit_bitbit); +EMITFUNC(insn_emit_bitbit); // 8 bit relative -extern PARSEFUNC(insn_parse_rel8); +PARSEFUNC(insn_parse_rel8); #define insn_resolve_rel8 NULL -extern EMITFUNC(insn_emit_rel8); +EMITFUNC(insn_emit_rel8); // 16 bit relative -extern PARSEFUNC(insn_parse_rel16); +PARSEFUNC(insn_parse_rel16); #define insn_resolve_rel16 NULL -extern EMITFUNC(insn_emit_rel16); +EMITFUNC(insn_emit_rel16); // generic 8/16 bit relative -extern PARSEFUNC(insn_parse_relgen); -extern RESOLVEFUNC(insn_resolve_relgen); -extern EMITFUNC(insn_emit_relgen); +PARSEFUNC(insn_parse_relgen); +RESOLVEFUNC(insn_resolve_relgen); +EMITFUNC(insn_emit_relgen); // MACRO pseudo op -extern PARSEFUNC(pseudo_parse_macro); +PARSEFUNC(pseudo_parse_macro); #define pseudo_resolve_macro NULL #define pseudo_emit_macro NULL // ENDM pseudo op -extern PARSEFUNC(pseudo_parse_endm); +PARSEFUNC(pseudo_parse_endm); #define pseudo_resolve_endm NULL #define pseudo_emit_endm NULL @@ -121,215 +120,215 @@ #define pseudo_resolve_noop NULL #define pseudo_emit_noop NULL -extern PARSEFUNC(pseudo_parse_dts); +PARSEFUNC(pseudo_parse_dts); #define pseudo_resolve_dts NULL -extern EMITFUNC(pseudo_emit_dts); +EMITFUNC(pseudo_emit_dts); -extern PARSEFUNC(pseudo_parse_dtb); +PARSEFUNC(pseudo_parse_dtb); #define pseudo_resolve_dtb NULL -extern EMITFUNC(pseudo_emit_dtb); +EMITFUNC(pseudo_emit_dtb); -extern PARSEFUNC(pseudo_parse_end); +PARSEFUNC(pseudo_parse_end); #define pseudo_resolve_end NULL -extern EMITFUNC(pseudo_emit_end); +EMITFUNC(pseudo_emit_end); -extern PARSEFUNC(pseudo_parse_fcb); +PARSEFUNC(pseudo_parse_fcb); #define pseudo_resolve_fcb NULL -extern EMITFUNC(pseudo_emit_fcb); +EMITFUNC(pseudo_emit_fcb); -extern PARSEFUNC(pseudo_parse_fdb); +PARSEFUNC(pseudo_parse_fdb); #define pseudo_resolve_fdb NULL -extern EMITFUNC(pseudo_emit_fdb); +EMITFUNC(pseudo_emit_fdb); -extern PARSEFUNC(pseudo_parse_fdbs); +PARSEFUNC(pseudo_parse_fdbs); #define pseudo_resolve_fdbs NULL -extern EMITFUNC(pseudo_emit_fdbs); +EMITFUNC(pseudo_emit_fdbs); -extern PARSEFUNC(pseudo_parse_fqb); +PARSEFUNC(pseudo_parse_fqb); #define pseudo_resolve_fqb NULL -extern EMITFUNC(pseudo_emit_fqb); +EMITFUNC(pseudo_emit_fqb); -extern PARSEFUNC(pseudo_parse_fcc); +PARSEFUNC(pseudo_parse_fcc); #define pseudo_resolve_fcc NULL -extern EMITFUNC(pseudo_emit_fcc); +EMITFUNC(pseudo_emit_fcc); -extern PARSEFUNC(pseudo_parse_fcs); +PARSEFUNC(pseudo_parse_fcs); #define pseudo_resolve_fcs NULL -extern EMITFUNC(pseudo_emit_fcs); +EMITFUNC(pseudo_emit_fcs); -extern PARSEFUNC(pseudo_parse_fcn); +PARSEFUNC(pseudo_parse_fcn); #define pseudo_resolve_fcn NULL -extern EMITFUNC(pseudo_emit_fcn); +EMITFUNC(pseudo_emit_fcn); -extern PARSEFUNC(pseudo_parse_rmb); -extern RESOLVEFUNC(pseudo_resolve_rmb); -extern EMITFUNC(pseudo_emit_rmb); +PARSEFUNC(pseudo_parse_rmb); +RESOLVEFUNC(pseudo_resolve_rmb); +EMITFUNC(pseudo_emit_rmb); -extern PARSEFUNC(pseudo_parse_rmd); -extern RESOLVEFUNC(pseudo_resolve_rmd); -extern EMITFUNC(pseudo_emit_rmd); +PARSEFUNC(pseudo_parse_rmd); +RESOLVEFUNC(pseudo_resolve_rmd); +EMITFUNC(pseudo_emit_rmd); -extern PARSEFUNC(pseudo_parse_rmq); -extern RESOLVEFUNC(pseudo_resolve_rmq); -extern EMITFUNC(pseudo_emit_rmq); +PARSEFUNC(pseudo_parse_rmq); +RESOLVEFUNC(pseudo_resolve_rmq); +EMITFUNC(pseudo_emit_rmq); -extern PARSEFUNC(pseudo_parse_zmb); -extern RESOLVEFUNC(pseudo_resolve_zmb); -extern EMITFUNC(pseudo_emit_zmb); +PARSEFUNC(pseudo_parse_zmb); +RESOLVEFUNC(pseudo_resolve_zmb); +EMITFUNC(pseudo_emit_zmb); -extern PARSEFUNC(pseudo_parse_zmd); -extern RESOLVEFUNC(pseudo_resolve_zmd); -extern EMITFUNC(pseudo_emit_zmd); +PARSEFUNC(pseudo_parse_zmd); +RESOLVEFUNC(pseudo_resolve_zmd); +EMITFUNC(pseudo_emit_zmd); -extern PARSEFUNC(pseudo_parse_zmq); -extern RESOLVEFUNC(pseudo_resolve_zmq); -extern EMITFUNC(pseudo_emit_zmq); +PARSEFUNC(pseudo_parse_zmq); +RESOLVEFUNC(pseudo_resolve_zmq); +EMITFUNC(pseudo_emit_zmq); -extern PARSEFUNC(pseudo_parse_org); +PARSEFUNC(pseudo_parse_org); #define pseudo_resolve_org NULL #define pseudo_emit_org NULL -extern PARSEFUNC(pseudo_parse_equ); +PARSEFUNC(pseudo_parse_equ); #define pseudo_resolve_equ NULL #define pseudo_emit_equ NULL -extern PARSEFUNC(pseudo_parse_set); +PARSEFUNC(pseudo_parse_set); #define pseudo_resolve_set NULL #define pseudo_emit_set NULL -extern PARSEFUNC(pseudo_parse_setdp); +PARSEFUNC(pseudo_parse_setdp); #define pseudo_resolve_setdp NULL #define pseudo_emit_setdp NULL -extern PARSEFUNC(pseudo_parse_ifp1); +PARSEFUNC(pseudo_parse_ifp1); #define pseudo_resolve_ifp1 NULL #define pseudo_emit_ifp1 NULL -extern PARSEFUNC(pseudo_parse_ifp2); +PARSEFUNC(pseudo_parse_ifp2); #define pseudo_resolve_ifp2 NULL #define pseudo_emit_ifp2 NULL -extern PARSEFUNC(pseudo_parse_ifne); +PARSEFUNC(pseudo_parse_ifne); #define pseudo_resolve_ifne NULL #define pseudo_emit_ifne NULL -extern PARSEFUNC(pseudo_parse_ifeq); +PARSEFUNC(pseudo_parse_ifeq); #define pseudo_resolve_ifeq NULL #define pseudo_emit_ifeq NULL -extern PARSEFUNC(pseudo_parse_iflt); +PARSEFUNC(pseudo_parse_iflt); #define pseudo_resolve_iflt NULL #define pseudo_emit_iflt NULL -extern PARSEFUNC(pseudo_parse_ifle); +PARSEFUNC(pseudo_parse_ifle); #define pseudo_resolve_ifle NULL #define pseudo_emit_ifle NULL -extern PARSEFUNC(pseudo_parse_ifgt); +PARSEFUNC(pseudo_parse_ifgt); #define pseudo_resolve_ifgt NULL #define pseudo_emit_ifgt NULL -extern PARSEFUNC(pseudo_parse_ifge); +PARSEFUNC(pseudo_parse_ifge); #define pseudo_resolve_ifge NULL #define pseudo_emit_ifge NULL -extern PARSEFUNC(pseudo_parse_ifdef); +PARSEFUNC(pseudo_parse_ifdef); #define pseudo_resolve_ifdef NULL #define pseudo_emit_ifdef NULL -extern PARSEFUNC(pseudo_parse_ifndef); +PARSEFUNC(pseudo_parse_ifndef); #define pseudo_resolve_ifndef NULL #define pseudo_emit_ifndef NULL -extern PARSEFUNC(pseudo_parse_ifstr); +PARSEFUNC(pseudo_parse_ifstr); #define pseudo_resolve_ifstr NULL #define pseudo_emit_ifstr NULL -extern PARSEFUNC(pseudo_parse_endc); +PARSEFUNC(pseudo_parse_endc); #define pseudo_resolve_endc NULL #define pseudo_emit_endc NULL -extern PARSEFUNC(pseudo_parse_else); +PARSEFUNC(pseudo_parse_else); #define pseudo_resolve_else NULL #define pseudo_emit_else NULL -extern PARSEFUNC(pseudo_parse_pragma); +PARSEFUNC(pseudo_parse_pragma); #define pseudo_resolve_pragma NULL #define pseudo_emit_pragma NULL -extern PARSEFUNC(pseudo_parse_starpragma); +PARSEFUNC(pseudo_parse_starpragma); #define pseudo_resolve_starpragma NULL #define pseudo_emit_starpragma NULL -extern PARSEFUNC(pseudo_parse_starpragmapush); +PARSEFUNC(pseudo_parse_starpragmapush); #define pseudo_resolve_starpragmapush NULL #define pseudo_emit_starpragmapush NULL -extern PARSEFUNC(pseudo_parse_starpragmapop); +PARSEFUNC(pseudo_parse_starpragmapop); #define pseudo_resolve_starpragmapop NULL #define pseudo_emit_starpragmapop NULL -extern PARSEFUNC(pseudo_parse_section); +PARSEFUNC(pseudo_parse_section); #define pseudo_resolve_section NULL #define pseudo_emit_section NULL -extern PARSEFUNC(pseudo_parse_endsection); +PARSEFUNC(pseudo_parse_endsection); #define pseudo_resolve_endsection NULL #define pseudo_emit_endsection NULL -extern PARSEFUNC(pseudo_parse_error); +PARSEFUNC(pseudo_parse_error); #define pseudo_resolve_error NULL #define pseudo_emit_error NULL -extern PARSEFUNC(pseudo_parse_warning); +PARSEFUNC(pseudo_parse_warning); #define pseudo_resolve_warning NULL #define pseudo_emit_warning NULL -extern PARSEFUNC(pseudo_parse_os9); +PARSEFUNC(pseudo_parse_os9); #define pseudo_resolve_os9 NULL -extern EMITFUNC(pseudo_emit_os9); +EMITFUNC(pseudo_emit_os9); -extern PARSEFUNC(pseudo_parse_mod); +PARSEFUNC(pseudo_parse_mod); #define pseudo_resolve_mod NULL -extern EMITFUNC(pseudo_emit_mod); +EMITFUNC(pseudo_emit_mod); -extern PARSEFUNC(pseudo_parse_emod); +PARSEFUNC(pseudo_parse_emod); #define pseudo_resolve_emod NULL -extern EMITFUNC(pseudo_emit_emod); +EMITFUNC(pseudo_emit_emod); -extern PARSEFUNC(pseudo_parse_extdep); +PARSEFUNC(pseudo_parse_extdep); #define pseudo_resolve_extdep NULL #define pseudo_emit_extdep NULL -extern PARSEFUNC(pseudo_parse_extern); +PARSEFUNC(pseudo_parse_extern); #define pseudo_resolve_extern NULL #define pseudo_emit_extern NULL -extern PARSEFUNC(pseudo_parse_export); +PARSEFUNC(pseudo_parse_export); #define pseudo_resolve_export NULL #define pseudo_emit_export NULL -extern PARSEFUNC(pseudo_parse_includebin); +PARSEFUNC(pseudo_parse_includebin); #define pseudo_resolve_includebin NULL -extern EMITFUNC(pseudo_emit_includebin); +EMITFUNC(pseudo_emit_includebin); -extern PARSEFUNC(pseudo_parse_include); +PARSEFUNC(pseudo_parse_include); #define pseudo_resolve_include NULL #define pseudo_emit_include NULL -extern PARSEFUNC(pseudo_parse_align); -extern RESOLVEFUNC(pseudo_resolve_align); -extern EMITFUNC(pseudo_emit_align); +PARSEFUNC(pseudo_parse_align); +RESOLVEFUNC(pseudo_resolve_align); +EMITFUNC(pseudo_emit_align); -extern PARSEFUNC(pseudo_parse_fill); -extern RESOLVEFUNC(pseudo_resolve_fill); -extern EMITFUNC(pseudo_emit_fill); +PARSEFUNC(pseudo_parse_fill); +RESOLVEFUNC(pseudo_resolve_fill); +EMITFUNC(pseudo_emit_fill); -extern PARSEFUNC(pseudo_parse_struct); +PARSEFUNC(pseudo_parse_struct); #define pseudo_resolve_struct NULL #define pseudo_emit_struct NULL -extern PARSEFUNC(pseudo_parse_endstruct); +PARSEFUNC(pseudo_parse_endstruct); #define pseudo_resolve_endstruct NULL #define pseudo_emit_endstruct NULL
--- a/lwasm/instab.h Wed Jun 24 19:39:13 2015 -0600 +++ b/lwasm/instab.h Mon Jul 13 20:31:56 2015 -0600 @@ -54,8 +54,6 @@ #define RESOLVEFUNC(fn) void (fn)(asmstate_t *as, line_t *l, int force) #define EMITFUNC(fn) void (fn)(asmstate_t *as, line_t *l) -#ifndef __instab_c_seen__ extern instab_t instab[]; -#endif //__instab_c_seen__ #endif //__instab_h_seen__
--- a/lwasm/lwasm.c Wed Jun 24 19:39:13 2015 -0600 +++ b/lwasm/lwasm.c Mon Jul 13 20:31:56 2015 -0600 @@ -19,8 +19,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */ -#define ___lwasm_c_seen___ - #include <stdio.h> #include <stdarg.h> #include <string.h> @@ -1000,8 +998,8 @@ this does any passes and other gymnastics that might be useful to see if an expression reduces early */ -extern void do_pass3(asmstate_t *as); -extern void do_pass4_aux(asmstate_t *as, int force); +void do_pass3(asmstate_t *as); +void do_pass4_aux(asmstate_t *as, int force); void lwasm_interim_reduce(asmstate_t *as) {
--- a/lwasm/lwasm.h Wed Jun 24 19:39:13 2015 -0600 +++ b/lwasm/lwasm.h Mon Jul 13 20:31:56 2015 -0600 @@ -95,7 +95,6 @@ PRAGMA_6809 = 0x4000 // 6809/6309 assembly mode }; - enum { section_flag_bss = 1, // BSS section @@ -388,50 +387,42 @@ int exprwidth; // the bit width of the expression being evaluated }; -#ifndef ___symbol_c_seen___ - -extern struct symtabe *register_symbol(asmstate_t *as, line_t *cl, char *sym, lw_expr_t value, int flags); -extern struct symtabe *lookup_symbol(asmstate_t *as, line_t *cl, char *sym); - -#endif +struct symtabe *register_symbol(asmstate_t *as, line_t *cl, char *sym, lw_expr_t value, int flags); +struct symtabe *lookup_symbol(asmstate_t *as, line_t *cl, char *sym); void lwasm_register_error(asmstate_t *as, line_t *cl, lwasm_errorcode_t err); void lwasm_register_error2(asmstate_t *as, line_t *cl, lwasm_errorcode_t err, const char* fmt, ...); -#ifndef ___lwasm_c_seen___ - -extern int lwasm_next_context(asmstate_t *as); -extern void lwasm_emit(line_t *cl, int byte); -extern void lwasm_emitop(line_t *cl, int opc); +int lwasm_next_context(asmstate_t *as); +void lwasm_emit(line_t *cl, int byte); +void lwasm_emitop(line_t *cl, int opc); -extern void lwasm_save_expr(line_t *cl, int id, lw_expr_t expr); -extern lw_expr_t lwasm_fetch_expr(line_t *cl, int id); -extern lw_expr_t lwasm_parse_expr(asmstate_t *as, char **p); -extern int lwasm_emitexpr(line_t *cl, lw_expr_t expr, int s); +void lwasm_save_expr(line_t *cl, int id, lw_expr_t expr); +lw_expr_t lwasm_fetch_expr(line_t *cl, int id); +lw_expr_t lwasm_parse_expr(asmstate_t *as, char **p); +int lwasm_emitexpr(line_t *cl, lw_expr_t expr, int s); -extern void skip_operand(char **p); +void skip_operand(char **p); -extern int lwasm_lookupreg2(const char *rlist, char **p); -extern int lwasm_lookupreg3(const char *rlist, char **p); +int lwasm_lookupreg2(const char *rlist, char **p); +int lwasm_lookupreg3(const char *rlist, char **p); -extern void lwasm_show_errors(asmstate_t *as); - -extern int lwasm_reduce_expr(asmstate_t *as, lw_expr_t expr); +void lwasm_show_errors(asmstate_t *as); -extern lw_expr_t lwasm_parse_cond(asmstate_t *as, char **p); +int lwasm_reduce_expr(asmstate_t *as, lw_expr_t expr); -extern int lwasm_calculate_range(asmstate_t *as, lw_expr_t expr, int *min, int *max); +lw_expr_t lwasm_parse_cond(asmstate_t *as, char **p); -extern void lwasm_reduce_line_exprs(line_t *cl); +int lwasm_calculate_range(asmstate_t *as, lw_expr_t expr, int *min, int *max); -#endif +void lwasm_reduce_line_exprs(line_t *cl); #ifdef LWASM_NODEBUG #define debug_message(...) #define dump_state(...) #else -extern void real_debug_message(asmstate_t *as, int level, const char *fmt, ...); -extern void dump_state(asmstate_t *as); +void real_debug_message(asmstate_t *as, int level, const char *fmt, ...); +void dump_state(asmstate_t *as); #define debug_message(as,level,...) do { asmstate_t *ras = (as); int rlevel = (level); if (ras->debug_level >= rlevel) { real_debug_message(ras, rlevel, __VA_ARGS__); } } while (0) #endif
--- a/lwasm/main.c Wed Jun 24 19:39:13 2015 -0600 +++ b/lwasm/main.c Mon Jul 13 20:31:56 2015 -0600 @@ -32,9 +32,9 @@ #include "lwasm.h" #include "input.h" -extern void lwasm_do_unicorns(asmstate_t *as); +void lwasm_do_unicorns(asmstate_t *as); -extern int parse_pragma_string(asmstate_t *as, char *str, int ignoreerr); +int parse_pragma_string(asmstate_t *as, char *str, int ignoreerr); /* command line option handling */ #define PROGVER "lwasm from " PACKAGE_STRING @@ -243,20 +243,20 @@ main function; parse command line, set up assembler state, and run the assembler on the first file */ -extern void do_pass1(asmstate_t *as); -extern void do_pass2(asmstate_t *as); -extern void do_pass3(asmstate_t *as); -extern void do_pass4(asmstate_t *as); -extern void do_pass5(asmstate_t *as); -extern void do_pass6(asmstate_t *as); -extern void do_pass7(asmstate_t *as); -extern void do_output(asmstate_t *as); -extern void do_list(asmstate_t *as); -extern void do_map(asmstate_t *as); -extern lw_expr_t lwasm_evaluate_special(int t, void *ptr, void *priv); -extern lw_expr_t lwasm_evaluate_var(char *var, void *priv); -extern lw_expr_t lwasm_parse_term(char **p, void *priv); -extern void lwasm_dividezero(void *priv); +void do_pass1(asmstate_t *as); +void do_pass2(asmstate_t *as); +void do_pass3(asmstate_t *as); +void do_pass4(asmstate_t *as); +void do_pass5(asmstate_t *as); +void do_pass6(asmstate_t *as); +void do_pass7(asmstate_t *as); +void do_output(asmstate_t *as); +void do_list(asmstate_t *as); +void do_map(asmstate_t *as); +lw_expr_t lwasm_evaluate_special(int t, void *ptr, void *priv); +lw_expr_t lwasm_evaluate_var(char *var, void *priv); +lw_expr_t lwasm_parse_term(char **p, void *priv); +void lwasm_dividezero(void *priv); struct passlist_s {
--- a/lwasm/pass1.c Wed Jun 24 19:39:13 2015 -0600 +++ b/lwasm/pass1.c Mon Jul 13 20:31:56 2015 -0600 @@ -31,9 +31,9 @@ #include "instab.h" #include "input.h" -extern int expand_macro(asmstate_t *as, line_t *l, char **p, char *opc); -extern int expand_struct(asmstate_t *as, line_t *l, char **p, char *opc); -extern int add_macro_line(asmstate_t *as, char *optr); +int expand_macro(asmstate_t *as, line_t *l, char **p, char *opc); +int expand_struct(asmstate_t *as, line_t *l, char **p, char *opc); +int add_macro_line(asmstate_t *as, char *optr); /* pass 1: parse the lines
--- a/lwasm/pseudo.c Wed Jun 24 19:39:13 2015 -0600 +++ b/lwasm/pseudo.c Mon Jul 13 20:31:56 2015 -0600 @@ -34,7 +34,7 @@ #include "lw_string.h" -extern void register_struct_entry(asmstate_t *as, line_t *l, int size, structtab_t *ss); +void register_struct_entry(asmstate_t *as, line_t *l, int size, structtab_t *ss); // for "dts" PARSEFUNC(pseudo_parse_dts)
--- a/lwlib/lw_alloc.c Wed Jun 24 19:39:13 2015 -0600 +++ b/lwlib/lw_alloc.c Mon Jul 13 20:31:56 2015 -0600 @@ -20,8 +20,6 @@ */ #include <stdlib.h> - -#define ___lw_alloc_c_seen___ #include "lw_alloc.h" void *lw_alloc(int size)
--- a/lwlib/lw_alloc.h Wed Jun 24 19:39:13 2015 -0600 +++ b/lwlib/lw_alloc.h Mon Jul 13 20:31:56 2015 -0600 @@ -22,21 +22,8 @@ #ifndef ___lw_alloc_h_seen___ #define ___lw_alloc_h_seen___ - -#ifdef ___lw_alloc_c_seen___ - -#define ___E - -#else /* def ___lw_alloc_c_seen___ */ - -#define ___E extern - -#endif /* def ___lw_alloc_c_seen___ */ - -___E void lw_free(void *P); -___E void *lw_alloc(int S); -___E void *lw_realloc(void *P, int S); - -#undef ___E +void lw_free(void *P); +void *lw_alloc(int S); +void *lw_realloc(void *P, int S); #endif /* ___lw_alloc_h_seen___ */
--- a/lwlib/lw_cmdline.c Wed Jun 24 19:39:13 2015 -0600 +++ b/lwlib/lw_cmdline.c Mon Jul 13 20:31:56 2015 -0600 @@ -25,8 +25,6 @@ #include <ctype.h> #include "lw_alloc.h" - -#define ___lw_cmdline_c_seen___ #include "lw_cmdline.h" #define DOCCOL 30
--- a/lwlib/lw_cmdline.h Wed Jun 24 19:39:13 2015 -0600 +++ b/lwlib/lw_cmdline.h Mon Jul 13 20:31:56 2015 -0600 @@ -70,13 +70,6 @@ char *program_version; }; -#ifdef ___lw_cmdline_c_seen___ - -#else /* def ___lw_cmdline_c_seen___ */ - -extern int lw_cmdline_parse(struct lw_cmdline_parser *parser, int argc, char **argv, unsigned flags, int *arg_index, void *input); - - -#endif /* def ___lw_cmdline_c_seen___ */ +int lw_cmdline_parse(struct lw_cmdline_parser *parser, int argc, char **argv, unsigned flags, int *arg_index, void *input); #endif /* ___lw_cmdline_h_seen___ */
--- a/lwlib/lw_error.c Wed Jun 24 19:39:13 2015 -0600 +++ b/lwlib/lw_error.c Mon Jul 13 20:31:56 2015 -0600 @@ -19,7 +19,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */ -#define ___lw_error_c_seen___ #include "lw_error.h" #include <stdio.h>
--- a/lwlib/lw_error.h Wed Jun 24 19:39:13 2015 -0600 +++ b/lwlib/lw_error.h Mon Jul 13 20:31:56 2015 -0600 @@ -22,13 +22,7 @@ #ifndef ___lw_error_h_seen___ #define ___lw_error_h_seen___ - -#ifdef ___lw_error_c_seen___ - -#else /* def ___lw_error_c_seen___ */ - -extern void lw_error(const char *fmt, ...); -extern void lw_error_setfunc(void (*f)(const char *fmt, ...)); -#endif /* def ___lw_error_c_seen___ */ +void lw_error(const char *fmt, ...); +void lw_error_setfunc(void (*f)(const char *fmt, ...)); #endif /* ___lw_error_h_seen___ */
--- a/lwlib/lw_expr.h Wed Jun 24 19:39:13 2015 -0600 +++ b/lwlib/lw_expr.h Mon Jul 13 20:31:56 2015 -0600 @@ -82,44 +82,44 @@ typedef void * lw_expr_t; -extern lw_expr_t lwexpr_create(void); -extern void lw_expr_destroy(lw_expr_t E); -extern lw_expr_t lw_expr_copy(lw_expr_t E); -extern void lw_expr_add_operand(lw_expr_t E, lw_expr_t O); -extern lw_expr_t lw_expr_build(int exprtype, ...); -extern char *lw_expr_print(lw_expr_t E); -extern int lw_expr_compare(lw_expr_t E1, lw_expr_t E2); -extern void lw_expr_simplify(lw_expr_t E, void *priv); +lw_expr_t lwexpr_create(void); +void lw_expr_destroy(lw_expr_t E); +lw_expr_t lw_expr_copy(lw_expr_t E); +void lw_expr_add_operand(lw_expr_t E, lw_expr_t O); +lw_expr_t lw_expr_build(int exprtype, ...); +char *lw_expr_print(lw_expr_t E); +int lw_expr_compare(lw_expr_t E1, lw_expr_t E2); +void lw_expr_simplify(lw_expr_t E, void *priv); typedef lw_expr_t lw_expr_fn_t(int t, void *ptr, void *priv); typedef lw_expr_t lw_expr_fn2_t(char *var, void *priv); typedef lw_expr_t lw_expr_fn3_t(char **p, void *priv); -extern void lw_expr_set_special_handler(lw_expr_fn_t *fn); -extern void lw_expr_set_var_handler(lw_expr_fn2_t *fn); -extern void lw_expr_set_term_parser(lw_expr_fn3_t *fn); +void lw_expr_set_special_handler(lw_expr_fn_t *fn); +void lw_expr_set_var_handler(lw_expr_fn2_t *fn); +void lw_expr_set_term_parser(lw_expr_fn3_t *fn); -extern lw_expr_t lw_expr_parse(char **p, void *priv); -extern int lw_expr_istype(lw_expr_t e, int t); -extern int lw_expr_intval(lw_expr_t e); -extern int lw_expr_specint(lw_expr_t e); -extern void *lw_expr_specptr(lw_expr_t e); -extern int lw_expr_whichop(lw_expr_t e); +lw_expr_t lw_expr_parse(char **p, void *priv); +int lw_expr_istype(lw_expr_t e, int t); +int lw_expr_intval(lw_expr_t e); +int lw_expr_specint(lw_expr_t e); +void *lw_expr_specptr(lw_expr_t e); +int lw_expr_whichop(lw_expr_t e); -extern int lw_expr_type(lw_expr_t e); +int lw_expr_type(lw_expr_t e); typedef int lw_expr_testfn_t(lw_expr_t e, void *priv); -extern int lw_expr_operandcount(lw_expr_t e); +int lw_expr_operandcount(lw_expr_t e); -extern void lw_expr_setwidth(int w); +void lw_expr_setwidth(int w); // run a function on all terms in an expression; if the function // returns non-zero for any term, return non-zero, else return // zero -extern int lw_expr_testterms(lw_expr_t e, lw_expr_testfn_t *fn, void *priv); +int lw_expr_testterms(lw_expr_t e, lw_expr_testfn_t *fn, void *priv); -extern void lw_expr_setdivzero(void (*fn)(void *priv)); +void lw_expr_setdivzero(void (*fn)(void *priv)); #endif /* def ___lw_expr_c_seen___ */
--- a/lwlib/lw_free.c Wed Jun 24 19:39:13 2015 -0600 +++ b/lwlib/lw_free.c Mon Jul 13 20:31:56 2015 -0600 @@ -21,7 +21,6 @@ #include <stdlib.h> -#define ___lw_alloc_c_seen___ #include "lw_alloc.h" void lw_free(void *P)
--- a/lwlib/lw_realloc.c Wed Jun 24 19:39:13 2015 -0600 +++ b/lwlib/lw_realloc.c Mon Jul 13 20:31:56 2015 -0600 @@ -21,7 +21,6 @@ #include <stdlib.h> -#define ___lw_alloc_c_seen___ #include "lw_alloc.h" void *lw_realloc(void *P, int S)
--- a/lwlib/lw_stack.h Wed Jun 24 19:39:13 2015 -0600 +++ b/lwlib/lw_stack.h Mon Jul 13 20:31:56 2015 -0600 @@ -42,11 +42,11 @@ #else /* def ___lw_stack_c_seen___ */ typedef void * lw_stack_t; -extern lw_stack_t lw_stack_create(void (*freefn)(void *d)); -extern void lw_stack_destroy(lw_stack_t S); -extern void *lw_stack_top(lw_stack_t S); -extern void *lw_stack_pop(lw_stack_t S); -extern void lw_stack_push(lw_stack_t S, void *item); +lw_stack_t lw_stack_create(void (*freefn)(void *d)); +void lw_stack_destroy(lw_stack_t S); +void *lw_stack_top(lw_stack_t S); +void *lw_stack_pop(lw_stack_t S); +void lw_stack_push(lw_stack_t S, void *item); #endif /* def ___lw_stack_c_seen___ */
--- a/lwlib/lw_string.c Wed Jun 24 19:39:13 2015 -0600 +++ b/lwlib/lw_string.c Mon Jul 13 20:31:56 2015 -0600 @@ -22,7 +22,6 @@ #include <string.h> #include <stdlib.h> -#define ___lw_string_c_seen___ #include "lw_alloc.h" #include "lw_string.h"
--- a/lwlib/lw_string.h Wed Jun 24 19:39:13 2015 -0600 +++ b/lwlib/lw_string.h Mon Jul 13 20:31:56 2015 -0600 @@ -22,15 +22,8 @@ #ifndef ___lw_string_h_seen___ #define ___lw_string_h_seen___ - -#ifdef ___lw_string_c_seen___ - -#else /* def ___lw_string_c_seen___ */ - -extern char *lw_strdup(const char *s); -extern char *lw_strndup(const char *s, int len); -extern char *lw_token(const char *s, int sep, const char **ap); - -#endif /* def ___lw_string_c_seen___ */ +char *lw_strdup(const char *s); +char *lw_strndup(const char *s, int len); +char *lw_token(const char *s, int sep, const char **ap); #endif /* ___lw_string_h_seen___ */
--- a/lwlib/lw_stringlist.h Wed Jun 24 19:39:13 2015 -0600 +++ b/lwlib/lw_stringlist.h Mon Jul 13 20:31:56 2015 -0600 @@ -36,14 +36,14 @@ #else /* def ___lw_stringlist_c_seen___ */ typedef void * lw_stringlist_t; -extern lw_stringlist_t lw_stringlist_create(void); -extern void lw_stringlist_destroy(lw_stringlist_t S); -extern void lw_stringlist_addstring(lw_stringlist_t S, char *str); -extern void lw_stringlist_reset(lw_stringlist_t S); -extern char *lw_stringlist_current(lw_stringlist_t S); -extern char *lw_stringlist_next(lw_stringlist_t S); -extern int lw_stringlist_nstrings(lw_stringlist_t S); -extern lw_stringlist_t lw_stringlist_copy(lw_stringlist_t S); +lw_stringlist_t lw_stringlist_create(void); +void lw_stringlist_destroy(lw_stringlist_t S); +void lw_stringlist_addstring(lw_stringlist_t S, char *str); +void lw_stringlist_reset(lw_stringlist_t S); +char *lw_stringlist_current(lw_stringlist_t S); +char *lw_stringlist_next(lw_stringlist_t S); +int lw_stringlist_nstrings(lw_stringlist_t S); +lw_stringlist_t lw_stringlist_copy(lw_stringlist_t S); #endif /* def ___lw_stringlist_c_seen___ */