From b794d953930489eea255f02a70140efd6ae79e5a Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Fri, 23 Aug 2024 18:29:27 +0200 Subject: [PATCH] lib: fix missing prototypes (#4191) * r.report: add missing prototype * lib/db: add missing prototype * CI: fail macOS runner on -Wstrict-prototypes * lib/gmath: suppress -Wstrict-prototypes for BLAS/LAPACK wrapper header --- .github/workflows/macos_install.sh | 2 +- include/grass/la.h | 16 +++++++++++++++- lib/db/sqlp/sqlp.l | 2 +- raster/r.report/global.h | 2 +- raster/r.report/prt_json.c | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/macos_install.sh b/.github/workflows/macos_install.sh index ce652491bdd..79446f51867 100755 --- a/.github/workflows/macos_install.sh +++ b/.github/workflows/macos_install.sh @@ -69,7 +69,7 @@ export CPPFLAGS="-isystem${CONDA_PREFIX}/include" ./configure $CONFIGURE_FLAGS -EXEMPT="-Wno-error=deprecated-non-prototype -Wno-error=strict-prototypes" +EXEMPT="" make -j$(sysctl -n hw.ncpu) CFLAGS="$CFLAGS -Werror $EXEMPT" \ CXXFLAGS="$CXXFLAGS -Werror $EXEMPT" diff --git a/include/grass/la.h b/include/grass/la.h index bfae5a01c12..2981dc3401e 100644 --- a/include/grass/la.h +++ b/include/grass/la.h @@ -44,7 +44,7 @@ typedef long int __g77_longint; typedef unsigned long int __g77_ulongint; #include -#else /* for gcc4+ */ +#else /* for gcc4+ */ typedef int integer; typedef unsigned int uinteger; typedef char *address; @@ -67,6 +67,14 @@ typedef unsigned long ulongint; /* IO stuff */ typedef int ftnlen; +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wstrict-prototypes" +#elif defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#endif + /* procedure parameter types for -A */ typedef int (*U_fp)(); typedef shortint (*J_fp)(); @@ -80,6 +88,12 @@ typedef shortlogical (*K_fp)(); typedef void (*H_fp)(); typedef int (*S_fp)(); +#if defined(__clang__) +#pragma clang diagnostic pop +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + /* E_fp is for real functions when -R is not specified */ typedef void C_f; /* complex function */ typedef void H_f; /* character function */ diff --git a/lib/db/sqlp/sqlp.l b/lib/db/sqlp/sqlp.l index 07c00b7a975..961c25b167d 100644 --- a/lib/db/sqlp/sqlp.l +++ b/lib/db/sqlp/sqlp.l @@ -273,7 +273,7 @@ void yyerror( const char *s ) * of this func anyway so we can avoid the link dependency. * **********************************************************************/ -int yywrap() +int yywrap(void) { return 1; } diff --git a/raster/r.report/global.h b/raster/r.report/global.h index a05ac1ae1d5..4ebc49b1916 100644 --- a/raster/r.report/global.h +++ b/raster/r.report/global.h @@ -121,7 +121,7 @@ int print_unit(int, int, int); JSON_Value *make_units(int, int); JSON_Value *make_category(int, int, JSON_Value *); JSON_Value *make_categories(int, int, int); -void print_json(); +void print_json(void); /* report.c */ int report(void); diff --git a/raster/r.report/prt_json.c b/raster/r.report/prt_json.c index 94590ea7b9f..5d6a33d2c28 100644 --- a/raster/r.report/prt_json.c +++ b/raster/r.report/prt_json.c @@ -129,7 +129,7 @@ JSON_Value *make_categories(int start, int end, int level) return array_value; } -void print_json() +void print_json(void) { compute_unit_format(0, nunits - 1, JSON);