Merge pull request #241 from pando-fredrik/fix-include-poisoning-sonoma

Fixes include poisoning on sonoma
This commit is contained in:
Wolfgang Thaller 2024-04-16 15:31:23 -05:00 committed by GitHub
commit ff372a8d82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 24 deletions

View File

@ -194,28 +194,6 @@ extern int fprintf_unlocked (FILE *, const char *, ...);
#undef fread_unlocked #undef fread_unlocked
#undef fwrite_unlocked #undef fwrite_unlocked
/* Include <string> before "safe-ctype.h" to avoid GCC poisoning
the ctype macros through safe-ctype.h */
#ifdef __cplusplus
#ifdef INCLUDE_STRING
# include <string>
#endif
#endif
/* There are an extraordinary number of issues with <ctype.h>.
The last straw is that it varies with the locale. Use libiberty's
replacement instead. */
#include "safe-ctype.h"
#include <sys/types.h>
#include <errno.h>
#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
extern int errno;
#endif
#ifdef __cplusplus #ifdef __cplusplus
#if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY)
# include <algorithm> # include <algorithm>
@ -229,6 +207,11 @@ extern int errno;
#ifdef INCLUDE_SET #ifdef INCLUDE_SET
# include <set> # include <set>
#endif #endif
/* Include <string> before "safe-ctype.h" to avoid GCC poisoning
the ctype macros through safe-ctype.h */
#ifdef INCLUDE_STRING
# include <string>
#endif
#ifdef INCLUDE_VECTOR #ifdef INCLUDE_VECTOR
# include <vector> # include <vector>
#endif #endif
@ -245,6 +228,17 @@ extern int errno;
# include <type_traits> # include <type_traits>
#endif #endif
/* There are an extraordinary number of issues with <ctype.h>.
The last straw is that it varies with the locale. Use libiberty's
replacement instead. */
#include "safe-ctype.h"
#include <sys/types.h>
#include <errno.h>
#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
extern int errno;
#endif
/* Some of glibc's string inlines cause warnings. Plus we'd rather /* Some of glibc's string inlines cause warnings. Plus we'd rather
rely on (and therefore test) GCC's string builtins. */ rely on (and therefore test) GCC's string builtins. */
#define __NO_STRING_INLINES #define __NO_STRING_INLINES

View File

@ -31,6 +31,7 @@
#undef PACKAGE_TARNAME #undef PACKAGE_TARNAME
#undef PACKAGE_VERSION #undef PACKAGE_VERSION
#define INCLUDE_VECTOR
#define INCLUDE_MEMORY #define INCLUDE_MEMORY
#include "gcc-plugin.h" #include "gcc-plugin.h"
#include "system.h" #include "system.h"
@ -69,7 +70,6 @@
#include "gcc-c-interface.h" #include "gcc-c-interface.h"
#include "context.hh" #include "context.hh"
#include <vector>
using namespace cc1_plugin; using namespace cc1_plugin;

View File

@ -33,6 +33,7 @@
#undef PACKAGE_VERSION #undef PACKAGE_VERSION
#define INCLUDE_MEMORY #define INCLUDE_MEMORY
#define INCLUDE_VECTOR
#include "gcc-plugin.h" #include "gcc-plugin.h"
#include "system.h" #include "system.h"
#include "coretypes.h" #include "coretypes.h"
@ -71,7 +72,6 @@
#include "rpc.hh" #include "rpc.hh"
#include "context.hh" #include "context.hh"
#include <vector>
using namespace cc1_plugin; using namespace cc1_plugin;