CMake: error out on warnings for strict/missing prototypes. 1462/head
authorSebastian Rasmussen <sebras@gmail.com>
Thu, 9 Mar 2023 18:20:58 +0000 (19:20 +0100)
committerSebastian Rasmussen <sebras@gmail.com>
Thu, 9 Mar 2023 19:09:27 +0000 (20:09 +0100)
And fix strict-prototypes/missing-prototypes warnings.

CMakeLists.txt
src/bin/jp2/opj_compress.c
src/bin/jp2/opj_decompress.c
src/lib/openjp2/ht_dec.c
src/lib/openjp2/j2k.c
src/lib/openjp2/openjpeg.c
src/lib/openjp2/thread.c

index 292b21321feafb467826a96e2df2ad3f7eb37201..8acca1663628967e0804e78c291de5c3bbf39ceb 100644 (file)
@@ -175,7 +175,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
   # set(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
   # Do not use ffast-math for all build, it would produce incorrect results, only set for release:
   set(OPENJPEG_LIBRARY_COMPILE_OPTIONS ${OPENJPEG_LIBRARY_COMPILE_OPTIONS} "$<$<CONFIG:Release>:-ffast-math>")
-  set(OPENJP2_COMPILE_OPTIONS ${OPENJP2_COMPILE_OPTIONS} "$<$<CONFIG:Release>:-ffast-math>" -Wall -Wextra -Wconversion -Wunused-parameter -Wdeclaration-after-statement -Werror=declaration-after-statement)
+  set(OPENJP2_COMPILE_OPTIONS ${OPENJP2_COMPILE_OPTIONS} "$<$<CONFIG:Release>:-ffast-math>" -Wall -Wextra -Wconversion -Wunused-parameter -Wdeclaration-after-statement -Werror=declaration-after-statement -Wstrict-prototypes -Werror=strict-prototypes -Wmissing-prototypes -Werror=missing-prototypes)
 endif()
 
 #-----------------------------------------------------------------------------
index 8ba3b6d772e093d8c2e7618e4a6f8509fff98907..212f144e7a8c052eccddde6682cea813f4c38073 100644 (file)
@@ -1883,7 +1883,7 @@ static void info_callback(const char *msg, void *client_data)
     fprintf(stdout, "[INFO] %s", msg);
 }
 
-OPJ_FLOAT64 opj_clock(void)
+static OPJ_FLOAT64 opj_clock(void)
 {
 #ifdef _WIN32
     /* _WIN32: use QueryPerformance (very accurate) */
index c32cc3dc6b065c359d64e6f04fd1fc27842298e3..ba26bfbb17f62d436156e2410fc510b860b342ca 100644 (file)
@@ -988,7 +988,7 @@ int parse_DA_values(char* inArg, unsigned int *DA_x0, unsigned int *DA_y0,
     }
 }
 
-OPJ_FLOAT64 opj_clock(void)
+static OPJ_FLOAT64 opj_clock(void)
 {
 #ifdef _WIN32
     /* _WIN32: use QueryPerformance (very accurate) */
index 62a6c9e1de9e46428fb4c6c38d7b985f5e990f57..120d7e49a17d2195beb7360de4b4301472dfb815 100644 (file)
@@ -1083,6 +1083,26 @@ static OPJ_BOOL opj_t1_allocate_buffers(
     return OPJ_TRUE;
 }
 
+/**
+Decode 1 HT code-block
+@param t1 T1 handle
+@param cblk Code-block coding parameters
+@param orient
+@param roishift Region of interest shifting value
+@param cblksty Code-block style
+@param p_manager the event manager
+@param p_manager_mutex mutex for the event manager
+@param check_pterm whether PTERM correct termination should be checked
+*/
+OPJ_BOOL opj_t1_ht_decode_cblk(opj_t1_t *t1,
+                               opj_tcd_cblk_dec_t* cblk,
+                               OPJ_UINT32 orient,
+                               OPJ_UINT32 roishift,
+                               OPJ_UINT32 cblksty,
+                               opj_event_mgr_t *p_manager,
+                               opj_mutex_t* p_manager_mutex,
+                               OPJ_BOOL check_pterm);
+
 //************************************************************************/
 /** @brief Decodes one codeblock, processing the cleanup, siginificance
   *         propagation, and magnitude refinement pass
index 923bd89161b6fc1654e930b90d08dfd2d454eb02..b02539fa1a87f81820b4503924929797b818790a 100644 (file)
@@ -6726,7 +6726,7 @@ OPJ_BOOL opj_j2k_set_threads(opj_j2k_t *j2k, OPJ_UINT32 num_threads)
     return OPJ_FALSE;
 }
 
-static int opj_j2k_get_default_thread_count()
+static int opj_j2k_get_default_thread_count(void)
 {
     const char* num_threads_str = getenv("OPJ_NUM_THREADS");
     int num_cpus;
index 29d3ee528cccd00e840c2532c3e217bc6ca49539..34f4fd1927d2337d8986ae41cf31382f05cf71b9 100644 (file)
@@ -144,6 +144,11 @@ static void opj_close_from_file(void* p_user_data)
 /* ---------------------------------------------------------------------- */
 #ifdef _WIN32
 #ifndef OPJ_STATIC
+
+/* declaration to avoid warning: no previous prototype for 'DllMain' */
+BOOL APIENTRY
+DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved);
+
 BOOL APIENTRY
 DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
 {
index f2fca2ee4af8e395cab361f053b90c21b30952e5..240810b1c44bf4dac5045c17864542156b3eee87 100644 (file)
@@ -221,7 +221,7 @@ struct opj_thread_t {
     HANDLE hThread;
 };
 
-unsigned int __stdcall opj_thread_callback_adapter(void *info)
+static unsigned int __stdcall opj_thread_callback_adapter(void *info)
 {
     opj_thread_t* thread = (opj_thread_t*) info;
     HANDLE hEvent = NULL;