From 9d9a50bc9823ca1673019aa18f23d28c7a1d2ff9 Mon Sep 17 00:00:00 2001 From: nicole mazzuca Date: Wed, 20 May 2020 10:10:26 -0700 Subject: [vcpkg] fix extern C around ctermid (#11343) Additionally, move the system_header invocations to their own header file, --- toolsrc/include/pch.h | 21 ++++------------- toolsrc/include/vcpkg-test/util.h | 2 ++ toolsrc/include/vcpkg/base/system_headers.h | 35 +++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 toolsrc/include/vcpkg/base/system_headers.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 03e3f59f7..e23230f6e 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -1,22 +1,12 @@ #pragma once #include +#include #if defined(_WIN32) -#define NOMINMAX -#define WIN32_LEAN_AND_MEAN - -#pragma warning(suppress : 4768) -#include - -#pragma warning(suppress : 4768) -#include - #include #include #include -#else -#include #endif #include @@ -29,13 +19,15 @@ #include #include #include -#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #include + #if VCPKG_USE_STD_FILESYSTEM #include #else +#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #include #endif + #include #include #include @@ -55,11 +47,6 @@ #include #endif -#include -// glibc defines major and minor in sys/types.h, and should not -#undef major -#undef minor - #include #include #include diff --git a/toolsrc/include/vcpkg-test/util.h b/toolsrc/include/vcpkg-test/util.h index b6ea4b01d..9321f3fd2 100644 --- a/toolsrc/include/vcpkg-test/util.h +++ b/toolsrc/include/vcpkg-test/util.h @@ -1,3 +1,5 @@ +#include + #include #include diff --git a/toolsrc/include/vcpkg/base/system_headers.h b/toolsrc/include/vcpkg/base/system_headers.h new file mode 100644 index 000000000..9af5bfd92 --- /dev/null +++ b/toolsrc/include/vcpkg/base/system_headers.h @@ -0,0 +1,35 @@ +#pragma once + +#if defined(_WIN32) + +#define NOMINMAX +#define WIN32_LEAN_AND_MEAN + +#pragma warning(suppress : 4768) +#include + +#pragma warning(suppress : 4768) +#include + +#else // ^^^^ Windows / Unix vvvv + +// 2020-05-19: workaround for a c standard library bug +// ctermid is not behind an `extern "C"` barrier, so it's linked incorrectly. +// This has been reported; remove it after 2023-05-19 +#if __APPLE__ +extern "C" { +#endif + +#include + +#if __APPLE__ +} +#endif + +#endif + +#include +// glibc defines major and minor in sys/types.h, and should not +#undef major +#undef minor + -- cgit v1.2.3