From 6c4010e4421fbb1be76e89f4edba2d7db532c1cb Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Thu, 30 Jun 2022 12:36:45 +1200 Subject: [PATCH] Resolve -Wstrict-prototypes warnings with clang-15 warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] --- Source/CParse/cparse.h | 2 +- Source/CParse/cscanner.c | 10 +++++----- Source/CParse/parser.y | 6 +++--- Source/CParse/templ.c | 2 +- Source/DOH/file.c | 4 ++-- Source/DOH/memory.c | 4 ++-- Source/Preprocessor/cpp.c | 4 ++-- Source/Preprocessor/expr.c | 6 +++--- Source/Swig/include.c | 4 ++-- Source/Swig/misc.c | 2 +- Source/Swig/naming.c | 8 ++++---- Source/Swig/parms.c | 2 +- Source/Swig/swigfile.h | 2 +- Source/Swig/typemap.c | 4 ++-- Source/Swig/typesys.c | 8 ++++---- 15 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Source/CParse/cparse.h b/Source/CParse/cparse.h index c67ffeaba..0d9ca4b9d 100644 --- a/Source/CParse/cparse.h +++ b/Source/CParse/cparse.h @@ -43,7 +43,7 @@ extern "C" { extern void scanner_clear_rename(void); extern void scanner_set_location(String *file, int line); extern void scanner_set_main_input_file(String *file); - extern String *scanner_get_main_input_file(); + extern String *scanner_get_main_input_file(void); extern void Swig_cparse_follow_locators(int); extern void start_inline(char *, int); extern String *scanner_ccode; diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c index a658f5a6f..155c7c81b 100644 --- a/Source/CParse/cscanner.c +++ b/Source/CParse/cscanner.c @@ -123,7 +123,7 @@ void Swig_cparse_cplusplusout(int v) { * Initialize buffers * ------------------------------------------------------------------------- */ -void scanner_init() { +void scanner_init(void) { scan = NewScanner(); Scanner_idstart(scan,"%"); scan_init = 1; @@ -528,11 +528,11 @@ void scanner_set_location(String *file, int line) { Scanner_set_location(scan,file,line-1); } -void scanner_check_typedef() { +void scanner_check_typedef(void) { check_typedef = 1; } -void scanner_ignore_typedef() { +void scanner_ignore_typedef(void) { check_typedef = 0; } @@ -540,7 +540,7 @@ void scanner_last_id(int x) { last_id = x; } -void scanner_clear_rename() { +void scanner_clear_rename(void) { rename_active = 0; } @@ -554,7 +554,7 @@ void scanner_set_main_input_file(String *file) { main_input_file = file; } -String *scanner_get_main_input_file() { +String *scanner_get_main_input_file(void) { return main_input_file; } diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 1ae3a59db..ddb9634b2 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -50,7 +50,7 @@ * Externals * ----------------------------------------------------------------------------- */ -int yyparse(); +int yyparse(void); /* NEW Variables */ @@ -349,7 +349,7 @@ static String *make_name(Node *n, String *name,SwigType *decl) { } /* Generate an unnamed identifier */ -static String *make_unnamed() { +static String *make_unnamed(void) { unnamed++; return NewStringf("$unnamed%d$",unnamed); } @@ -874,7 +874,7 @@ static void add_typedef_name(Node *n, Node *declnode, String *oldName, Symtab *c /* If the class name is qualified. We need to create or lookup namespace entries */ -static Symtab *set_scope_to_global() { +static Symtab *set_scope_to_global(void) { Symtab *symtab = Swig_symbol_global_scope(); Swig_symbol_setscope(symtab); return symtab; diff --git a/Source/CParse/templ.c b/Source/CParse/templ.c index f8c926d37..44a606299 100644 --- a/Source/CParse/templ.c +++ b/Source/CParse/templ.c @@ -19,7 +19,7 @@ static int template_debug = 0; const char *baselists[3]; -void SwigType_template_init() { +void SwigType_template_init(void) { baselists[0] = "baselist"; baselists[1] = "protectedbaselist"; baselists[2] = "privatebaselist"; diff --git a/Source/DOH/file.c b/Source/DOH/file.c index bf8055177..8ec8bd6ae 100644 --- a/Source/DOH/file.c +++ b/Source/DOH/file.c @@ -35,7 +35,7 @@ typedef struct { * reference count of the underlying DOH objects. * ----------------------------------------------------------------------------- */ -static DOHList *open_files_list_instance() { +static DOHList *open_files_list_instance(void) { static DOHList *all_open_files = 0; if (!all_open_files) all_open_files = DohNewList(); @@ -73,7 +73,7 @@ static void open_files_list_remove(DohFile *f) { * Close all opened files, to be called on program termination * ----------------------------------------------------------------------------- */ -void DohCloseAllOpenFiles() { +void DohCloseAllOpenFiles(void) { int i; DOHList *all_open_files = open_files_list_instance(); for (i = 0; i < DohLen(all_open_files); i++) { diff --git a/Source/DOH/memory.c b/Source/DOH/memory.c index 88ed0f959..d461ce392 100644 --- a/Source/DOH/memory.c +++ b/Source/DOH/memory.c @@ -48,7 +48,7 @@ static int pools_initialized = 0; * CreatePool() - Create a new memory pool * ---------------------------------------------------------------------- */ -static void CreatePool() { +static void CreatePool(void) { Pool *p = 0; p = (Pool *) DohMalloc(sizeof(Pool)); p->ptr = (DohBase *) DohCalloc(PoolSize, sizeof(DohBase)); @@ -65,7 +65,7 @@ static void CreatePool() { * InitPools() - Initialize the memory allocator * ---------------------------------------------------------------------- */ -static void InitPools() { +static void InitPools(void) { if (pools_initialized) return; CreatePool(); /* Create initial pool */ diff --git a/Source/Preprocessor/cpp.c b/Source/Preprocessor/cpp.c index 34ace2d77..14fa1aa01 100644 --- a/Source/Preprocessor/cpp.c +++ b/Source/Preprocessor/cpp.c @@ -1356,14 +1356,14 @@ static void add_chunk(DOH *ns, DOH *chunk, int allow) { push/pop_imported(): helper functions for defining and undefining SWIGIMPORTED (when %importing a file). */ -static void push_imported() { +static void push_imported(void) { if (imported_depth == 0) { Preprocessor_define("SWIGIMPORTED 1", 0); } ++imported_depth; } -static void pop_imported() { +static void pop_imported(void) { --imported_depth; if (imported_depth == 0) { Preprocessor_undef("SWIGIMPORTED"); diff --git a/Source/Preprocessor/expr.c b/Source/Preprocessor/expr.c index e5c768765..52e467b6c 100644 --- a/Source/Preprocessor/expr.c +++ b/Source/Preprocessor/expr.c @@ -52,7 +52,7 @@ static int expr_init = 0; /* Initialization flag */ static const char *errmsg = 0; /* Parsing error */ /* Initialize the precedence table for various operators. Low values have higher precedence */ -static void init_precedence() { +static void init_precedence(void) { prec[SWIG_TOKEN_NOT] = 10; prec[OP_UMINUS] = 10; prec[OP_UPLUS] = 10; @@ -85,7 +85,7 @@ static void init_precedence() { /* Reduce a single operator on the stack */ /* return 0 on failure, 1 on success */ -static int reduce_op() { +static int reduce_op(void) { long op_token = stack[sp - 1].value; assert(sp > 0); assert(stack[sp - 1].op == EXPR_OP); @@ -474,6 +474,6 @@ extra_rparen: * Return error message set by the evaluator (if any) * ----------------------------------------------------------------------------- */ -const char *Preprocessor_expr_error() { +const char *Preprocessor_expr_error(void) { return errmsg; } diff --git a/Source/Swig/include.c b/Source/Swig/include.c index 94df338f0..ca43dbd65 100644 --- a/Source/Swig/include.c +++ b/Source/Swig/include.c @@ -145,7 +145,7 @@ static List *Swig_search_path_any(int syspath) { return slist; } -List *Swig_search_path() { +List *Swig_search_path(void) { return Swig_search_path_any(0); } @@ -376,6 +376,6 @@ String *Swig_file_dirname(const_String_or_char_ptr filename) { /* * Swig_file_debug() */ -void Swig_file_debug_set() { +void Swig_file_debug_set(void) { file_debug = 1; } diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c index 0519b57c9..55306b1da 100644 --- a/Source/Swig/misc.c +++ b/Source/Swig/misc.c @@ -1497,7 +1497,7 @@ int Swig_is_generated_overload(Node *n) { * Initialize the SWIG core * ----------------------------------------------------------------------------- */ -void Swig_init() { +void Swig_init(void) { /* Set some useful string encoding methods */ DohEncoding("escape", Swig_string_escape); DohEncoding("hexescape", Swig_string_hexescape); diff --git a/Source/Swig/naming.c b/Source/Swig/naming.c index 4d07d5b2f..0673429ad 100644 --- a/Source/Swig/naming.c +++ b/Source/Swig/naming.c @@ -744,28 +744,28 @@ void Swig_feature_set(Hash *features, const_String_or_char_ptr name, SwigType *d * ----------------------------------------------------------------------------- */ static Hash *namewarn_hash = 0; -static Hash *name_namewarn_hash() { +static Hash *name_namewarn_hash(void) { if (!namewarn_hash) namewarn_hash = NewHash(); return namewarn_hash; } static Hash *rename_hash = 0; -static Hash *name_rename_hash() { +static Hash *name_rename_hash(void) { if (!rename_hash) rename_hash = NewHash(); return rename_hash; } static List *namewarn_list = 0; -static List *name_namewarn_list() { +static List *name_namewarn_list(void) { if (!namewarn_list) namewarn_list = NewList(); return namewarn_list; } static List *rename_list = 0; -static List *name_rename_list() { +static List *name_rename_list(void) { if (!rename_list) rename_list = NewList(); return rename_list; diff --git a/Source/Swig/parms.c b/Source/Swig/parms.c index 3e832c361..f89ad6356 100644 --- a/Source/Swig/parms.c +++ b/Source/Swig/parms.c @@ -149,7 +149,7 @@ int ParmList_len(ParmList *p) { * get_empty_type() * ---------------------------------------------------------------------- */ -static SwigType *get_empty_type() { +static SwigType *get_empty_type(void) { return NewStringEmpty(); } diff --git a/Source/Swig/swigfile.h b/Source/Swig/swigfile.h index f12b33081..0583b3792 100644 --- a/Source/Swig/swigfile.h +++ b/Source/Swig/swigfile.h @@ -30,7 +30,7 @@ extern String *Swig_file_extension(const_String_or_char_ptr filename); extern String *Swig_file_basename(const_String_or_char_ptr filename); extern String *Swig_file_filename(const_String_or_char_ptr filename); extern String *Swig_file_dirname(const_String_or_char_ptr filename); -extern void Swig_file_debug_set(); +extern void Swig_file_debug_set(void); /* Delimiter used in accessing files and directories */ diff --git a/Source/Swig/typemap.c b/Source/Swig/typemap.c index 2f9c06000..126d88026 100644 --- a/Source/Swig/typemap.c +++ b/Source/Swig/typemap.c @@ -151,7 +151,7 @@ static void set_typemap(const SwigType *type, Hash **tmhash) { * Initialize the typemap system * ----------------------------------------------------------------------------- */ -void Swig_typemap_init() { +void Swig_typemap_init(void) { typemaps = NewHash(); } @@ -2170,7 +2170,7 @@ static void replace_embedded_typemap(String *s, ParmList *parm_sublist, Wrapper * Display all typemaps * ----------------------------------------------------------------------------- */ -void Swig_typemap_debug() { +void Swig_typemap_debug(void) { int nesting_level = 2; Printf(stdout, "---[ typemaps ]--------------------------------------------------------------\n"); Swig_print(typemaps, nesting_level); diff --git a/Source/Swig/typesys.c b/Source/Swig/typesys.c index d6d6bcc88..710688a0f 100644 --- a/Source/Swig/typesys.c +++ b/Source/Swig/typesys.c @@ -180,7 +180,7 @@ int Swig_value_wrapper_mode(int mode) { } -static void flush_cache() { +static void flush_cache(void) { typedef_resolve_cache = 0; typedef_all_cache = 0; typedef_qualified_cache = 0; @@ -188,7 +188,7 @@ static void flush_cache() { /* Initialize the scoping system */ -void SwigType_typesystem_init() { +void SwigType_typesystem_init(void) { if (global_scope) Delete(global_scope); if (scopes) @@ -407,7 +407,7 @@ void SwigType_using_scope(Typetab *scope) { * table for the scope that was popped off. * ----------------------------------------------------------------------------- */ -Typetab *SwigType_pop_scope() { +Typetab *SwigType_pop_scope(void) { Typetab *t, *old = current_scope; t = Getattr(current_scope, "parent"); if (!t) @@ -2093,7 +2093,7 @@ static int SwigType_compare_mangled(const DOH *a, const DOH *b) { * Returns the sorted list of mangled type names that should be exported into the * wrapper file. * ----------------------------------------------------------------------------- */ -List *SwigType_get_sorted_mangled_list() { +List *SwigType_get_sorted_mangled_list(void) { List *l = Keys(r_mangled); SortList(l, SwigType_compare_mangled); return l;