diff --git a/.checkpatch.conf b/.checkpatch.conf index cafdfc97..71f34a2f 100644 --- a/.checkpatch.conf +++ b/.checkpatch.conf @@ -19,9 +19,6 @@ # List of ignored rules # --------------------- -# Allow the usage of 'extern' in .c files ---ignore AVOID_EXTERNS - # There's no BIT macro --ignore BIT_MACRO diff --git a/include/asm/asm.h b/include/asm/asm.h index aa48d979..179d1005 100644 --- a/include/asm/asm.h +++ b/include/asm/asm.h @@ -36,4 +36,6 @@ extern struct sSymbol *tHashedSymbols[HASHSIZE]; extern struct sSymbol *pPCSymbol; extern bool oDontExpandStrings; +size_t symvaluetostring(char *dest, size_t maxLength, char *sym); + #endif /* RGBDS_ASM_ASM_H */ diff --git a/include/asm/fstack.h b/include/asm/fstack.h index 3d14c792..6631af02 100644 --- a/include/asm/fstack.h +++ b/include/asm/fstack.h @@ -41,6 +41,4 @@ void fstk_RunRept(uint32_t count); FILE *fstk_FindFile(char *fname); int32_t fstk_GetLine(void); -extern int yywrap(void); - #endif /* RGBDS_ASM_FSTACK_H */ diff --git a/include/asm/lexer.h b/include/asm/lexer.h index dde7ece4..32dea04e 100644 --- a/include/asm/lexer.h +++ b/include/asm/lexer.h @@ -37,6 +37,8 @@ enum eLexerState { typedef struct yy_buffer_state *YY_BUFFER_STATE; +void setup_lexer(void); + void yy_set_state(enum eLexerState i); YY_BUFFER_STATE yy_create_buffer(FILE *f); YY_BUFFER_STATE yy_scan_bytes(char *mem, uint32_t size); @@ -52,6 +54,7 @@ void lex_FloatDeleteSecondRange(uint32_t id, uint16_t start, uint16_t end); void lex_Init(void); void lex_AddStrings(const struct sLexInitString *lex); void lex_SetBuffer(char *buffer, uint32_t len); +int yywrap(void); uint32_t yylex(void); void yyunput(char c); void yyunputstr(char *s); diff --git a/include/asm/main.h b/include/asm/main.h index 8133aa82..b58ba92a 100644 --- a/include/asm/main.h +++ b/include/asm/main.h @@ -24,6 +24,8 @@ extern int32_t nBinaryID; extern struct sOptions DefaultOptions; extern struct sOptions CurrentOptions; +extern FILE *dependfile; + void opt_Push(void); void opt_Pop(void); void opt_Parse(char *s); diff --git a/include/asm/output.h b/include/asm/output.h index 452f2c31..28aa5925 100644 --- a/include/asm/output.h +++ b/include/asm/output.h @@ -18,6 +18,8 @@ struct Section { uint8_t *tData; }; +extern char *tzObjectname; + void out_PrepPass2(void); void out_SetFileName(char *s); void out_NewSection(char *pzName, uint32_t secttype); diff --git a/src/asm/fstack.c b/src/asm/fstack.c index e5b57fad..d2c947d7 100644 --- a/src/asm/fstack.c +++ b/src/asm/fstack.c @@ -12,6 +12,7 @@ #include "asm/fstack.h" #include "asm/lexer.h" #include "asm/main.h" +#include "asm/output.h" #include "asm/symbol.h" #include "extern/err.h" @@ -35,9 +36,6 @@ static uint32_t nCurrentREPTBlockCount; uint32_t ulMacroReturnValue; -extern char *tzObjectname; -extern FILE *dependfile; - /* * defines for nCurrentStatus */ diff --git a/src/asm/globlex.c b/src/asm/globlex.c index 95eedf6a..d702ccba 100644 --- a/src/asm/globlex.c +++ b/src/asm/globlex.c @@ -460,8 +460,7 @@ const struct sLexFloat tMacroUniqueToken = { T_LEX_MACROUNIQUE }; -void -setuplex(void) +void setup_lexer(void) { uint32_t id; diff --git a/src/asm/lexer.c b/src/asm/lexer.c index 4da26ef9..c2f14d7a 100644 --- a/src/asm/lexer.c +++ b/src/asm/lexer.c @@ -28,8 +28,6 @@ struct sLexString { #define SAFETYMARGIN 1024 -extern size_t symvaluetostring(char *dest, size_t maxLength, char *sym); - struct sLexFloat tLexFloat[32]; struct sLexString *tLexHash[LEXHASHSIZE]; YY_BUFFER_STATE pCurrentBuffer; diff --git a/src/asm/main.c b/src/asm/main.c index 9f130282..b1a54188 100644 --- a/src/asm/main.c +++ b/src/asm/main.c @@ -9,6 +9,7 @@ #include "asm/symbol.h" #include "asm/fstack.h" +#include "asm/lexer.h" #include "asm/output.h" #include "asm/main.h" @@ -16,8 +17,7 @@ #include "extern/reallocarray.h" #include "extern/version.h" -int yyparse(void); -void setuplex(void); +extern int yyparse(void); int32_t cldefines_index; int32_t cldefines_size; @@ -32,7 +32,6 @@ uint32_t unionStart[128], unionSize[128]; /* extern int yydebug; */ FILE *dependfile; -extern char *tzObjectname; /* * Option stack @@ -384,7 +383,7 @@ int main(int argc, char *argv[]) tzMainfile = argv[argc - 1]; - setuplex(); + setup_lexer(); if (CurrentOptions.verbose) printf("Assembling %s\n", tzMainfile);