]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
src: silence wmain() warning for all build methods
authorViktor Szakats <commit@vsz.me>
Sat, 11 Mar 2023 15:21:43 +0000 (15:21 +0000)
committerViktor Szakats <commit@vsz.me>
Sat, 11 Mar 2023 15:21:43 +0000 (15:21 +0000)
llvm/clang and gcc doesn't recognize the wmain() function in Unicode
Windows builds:

llvm/clang:
```
../../src/tool_main.c:239:5: warning: no previous prototype for function 'wmain' [-Wmissing-prototypes]
int wmain(int argc, wchar_t *argv[])
    ^
1 warning generated.
```

gcc:
```
../../src/tool_main.c:239:5: warning: no previous prototype for 'wmain' [-Wmissing-prototypes]
  239 | int wmain(int argc, wchar_t *argv[])
      |     ^~~~~
```

Before this patch, we already silenced it with CMake. This patch moves
the silencing to the source, so that it applies to all build tools.

Bug: https://github.com/curl/curl/issues/7229#issuecomment-1464806651

Reviewed-by: Marcel Raad
Closes #10744

src/CMakeLists.txt
src/tool_main.c

index be49817a38febf4d0523fd996a1f333513987145..91825ec9a01c2f1af02760c414a505e9c596e0fe 100644 (file)
@@ -80,8 +80,6 @@ endif()
 
 if(ENABLE_UNICODE AND MINGW)
   target_link_libraries(${EXE_NAME} -municode)
-  # GCC doesn't know about wmain
-  set_source_files_properties(tool_main.c PROPERTIES COMPILE_FLAGS "-Wno-missing-prototypes -Wno-missing-declarations")
 endif()
 
 source_group("curlX source files" FILES ${CURLX_CFILES})
index de7276f14fd496fec564d0235f00747f18fbc489..62c4a597e5804b9da9922e6c2037da984337977c 100644 (file)
@@ -236,6 +236,11 @@ static void main_free(struct GlobalConfig *config)
 ** curl tool main function.
 */
 #ifdef _UNICODE
+#if defined(__GNUC__)
+/* GCC doesn't know about wmain() */
+#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+#pragma GCC diagnostic ignored "-Wmissing-declarations"
+#endif
 int wmain(int argc, wchar_t *argv[])
 #else
 int main(int argc, char *argv[])