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
This commit is contained in:
Viktor Szakats 2023-03-11 15:21:43 +00:00
parent c2b7249db2
commit 079079b2fd
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 5 additions and 2 deletions

View 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[])