From e69c98c14ae1d338f1c3b4b93b4f4d5dc4969e82 Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 27 Dec 2023 15:00:08 -0500 Subject: [PATCH] Windows follow-up: minimize pragma scope Avoid disruption to mingw32-x64 build, by placing some Visual Studio pragmas in #ifdef _MSC_VER conditional blocks. --- sys/windows/windsys.c | 4 ++++ win/win32/NetHackW.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/sys/windows/windsys.c b/sys/windows/windsys.c index 89061bc38..a64367d07 100644 --- a/sys/windows/windsys.c +++ b/sys/windows/windsys.c @@ -627,10 +627,14 @@ BOOL winos_font_support_cp437(HFONT hFont) if (size) { GLYPHSET *glyphSet = (GLYPHSET *) malloc((size_t) size); if (glyphSet != NULL) { +#ifdef _MSC_VER #pragma warning( push ) #pragma warning( disable : 6386 ) +#endif size = GetFontUnicodeRanges(hdc, glyphSet); +#ifdef _MSC_VER #pragma warning( pop ) +#endif allFound = TRUE; for (int i = 0; i < 256 && allFound; i++) { WCHAR wc = cp437[i]; diff --git a/win/win32/NetHackW.c b/win/win32/NetHackW.c index e418eb829..a235ac992 100644 --- a/win/win32/NetHackW.c +++ b/win/win32/NetHackW.c @@ -77,8 +77,11 @@ static void __cdecl mswin_moveloop(void *); #define MAX_CMDLINE_PARAM 255 +#ifdef _MSC_VER #pragma warning( push ) #pragma warning( disable : 28251) +#endif + int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) @@ -248,7 +251,9 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, return 0; } +#ifdef _MSC_VER #pragma warning( pop ) +#endif PNHWinApp GetNHApp(void)