shithub: rgbds

Download patch

ref: b04596a32bc6b318322064da475ea8138a79f810
parent: 8e8865940a7d4d4787db5f038dc6d477c1a236f0
author: Antonio Niño Díaz <[email protected]>
date: Wed Jan 3 20:09:15 EST 2018

Move externs to header files

Follow Linux kernel coding style.

Remove exception from checkpatch.pl configuration file.

Signed-off-by: Antonio Niño Díaz <[email protected]>

--- 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
 
--- a/include/asm/asm.h
+++ b/include/asm/asm.h
@@ -36,4 +36,6 @@
 extern struct sSymbol *pPCSymbol;
 extern bool oDontExpandStrings;
 
+size_t symvaluetostring(char *dest, size_t maxLength, char *sym);
+
 #endif /* RGBDS_ASM_ASM_H */
--- a/include/asm/fstack.h
+++ b/include/asm/fstack.h
@@ -41,6 +41,4 @@
 FILE *fstk_FindFile(char *fname);
 int32_t fstk_GetLine(void);
 
-extern int yywrap(void);
-
 #endif /* RGBDS_ASM_FSTACK_H */
--- a/include/asm/lexer.h
+++ b/include/asm/lexer.h
@@ -37,6 +37,8 @@
 
 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_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);
--- a/include/asm/main.h
+++ b/include/asm/main.h
@@ -24,6 +24,8 @@
 extern struct sOptions DefaultOptions;
 extern struct sOptions CurrentOptions;
 
+extern FILE *dependfile;
+
 void opt_Push(void);
 void opt_Pop(void);
 void opt_Parse(char *s);
--- a/include/asm/output.h
+++ b/include/asm/output.h
@@ -18,6 +18,8 @@
 	uint8_t *tData;
 };
 
+extern char *tzObjectname;
+
 void out_PrepPass2(void);
 void out_SetFileName(char *s);
 void out_NewSection(char *pzName, uint32_t secttype);
--- 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"
@@ -34,9 +35,6 @@
 static uint32_t nCurrentREPTBlockCount;
 
 uint32_t ulMacroReturnValue;
-
-extern char *tzObjectname;
-extern FILE *dependfile;
 
 /*
  * defines for nCurrentStatus
--- a/src/asm/globlex.c
+++ b/src/asm/globlex.c
@@ -460,8 +460,7 @@
 	T_LEX_MACROUNIQUE
 };
 
-void
-setuplex(void)
+void setup_lexer(void)
 {
 	uint32_t id;
 
--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -28,8 +28,6 @@
 
 #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;
--- 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 @@
 /* extern int yydebug; */
 
 FILE *dependfile;
-extern char *tzObjectname;
 
 /*
  * Option stack
@@ -384,7 +383,7 @@
 
 	tzMainfile = argv[argc - 1];
 
-	setuplex();
+	setup_lexer();
 
 	if (CurrentOptions.verbose)
 		printf("Assembling %s\n", tzMainfile);