Skip to content

Commit

Permalink
build: fix unknown pragma warning with mingw (neovim#22533)
Browse files Browse the repository at this point in the history
This checks MSVC toolchain with _MSC_VER macro before adding
pragma warning directive. It is specific to MSVC and shows
compiler warning with mingw gcc as following:

main.c:187: warning: ignoring '#pragma warning ' [-Wunknown-pragmas]
  187 | # pragma warning(suppress : 4996)
  • Loading branch information
Biswa96 authored and folke committed May 22, 2023
1 parent 4eee0cd commit 47c388b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/nvim/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,12 @@ void early_init(mparm_T *paramp)
ovi.dwOSVersionInfoSize = sizeof(ovi);
// Disable warning about GetVersionExA being deprecated. There doesn't seem to be a convenient
// replacement that doesn't add a ton of extra code as of writing this.
# pragma warning(suppress : 4996)
# ifdef _MSC_VER
# pragma warning(suppress : 4996)
GetVersionEx(&ovi);
# else
GetVersionEx(&ovi);
# endif
snprintf(windowsVersion, sizeof(windowsVersion), "%d.%d",
(int)ovi.dwMajorVersion, (int)ovi.dwMinorVersion);
#endif
Expand Down

0 comments on commit 47c388b

Please sign in to comment.