diff options
author | Biswapriyo Nath <nathbappai@gmail.com> | 2023-03-05 19:22:32 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-05 21:52:32 +0800 |
commit | 07758587037de1c8a4c45f1b39722ae73522c6bd (patch) | |
tree | 473b01b9fd0b9f0d3eb7843f243a8ec6b9e98a0f | |
parent | ba38f35d3e2f37c2289543e6e0c4451c679c5834 (diff) | |
download | rneovim-07758587037de1c8a4c45f1b39722ae73522c6bd.tar.gz rneovim-07758587037de1c8a4c45f1b39722ae73522c6bd.tar.bz2 rneovim-07758587037de1c8a4c45f1b39722ae73522c6bd.zip |
build: fix unknown pragma warning with mingw (#22533)
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)
-rw-r--r-- | src/nvim/main.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index 71c5c2af46..be1714b207 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -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 |