diff options
author | Viktor Szakats <commit@vsz.me> | 2023-03-11 15:21:43 +0000 |
---|---|---|
committer | Viktor Szakats <commit@vsz.me> | 2023-03-11 15:21:43 +0000 |
commit | 079079b2fde95a5d197403b213beb0d919fed413 (patch) | |
tree | 4dc2d3f7f9a1bf7f4dce0060bfd3d1383b07f899 /src | |
parent | c2b7249db213cd5c5debf8d8b6be23003a4cf200 (diff) | |
download | curl-079079b2fde95a5d197403b213beb0d919fed413.tar.gz |
src: silence wmain() warning for all build methods
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
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/tool_main.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index be49817a3..91825ec9a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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}) diff --git a/src/tool_main.c b/src/tool_main.c index de7276f14..62c4a597e 100644 --- a/src/tool_main.c +++ b/src/tool_main.c @@ -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[]) |