mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 05:40:09 +00:00
[libc++] Add missing __has_include checks for C headers not provided by libc++
This makes the library consistent in how it handles C library headers. For C headers provided by libc++, we unconditionally include <foo.h> from <cfoo>, and then <foo.h> conditionally include_next <foo.h>. For headers not provided by libc++, <cfoo> conditionally includes the system's <foo.h> directly. Differential Revision: https://reviews.llvm.org/D138512
This commit is contained in:
parent
09b8b44760
commit
647ddc08f4
@ -18,7 +18,14 @@ Macros:
|
||||
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__config>
|
||||
#include <assert.h>
|
||||
|
||||
// <assert.h> is not provided by libc++
|
||||
#if __has_include(<assert.h>)
|
||||
# include <assert.h>
|
||||
# ifdef _LIBCPP_ASSERT_H
|
||||
# error "If libc++ starts defining <assert.h>, the __has_include check should move to libc++'s <assert.h>"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
|
@ -42,8 +42,12 @@ int raise(int sig);
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__config>
|
||||
|
||||
// <signal.h> is not provided by libc++
|
||||
#if __has_include(<signal.h>)
|
||||
# include <signal.h>
|
||||
# include <signal.h>
|
||||
# ifdef _LIBCPP_SIGNAL_H
|
||||
# error "If libc++ starts defining <signal.h>, the __has_include check should move to libc++'s <signal.h>"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
@ -33,7 +33,14 @@ Types:
|
||||
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__config>
|
||||
#include <stdarg.h>
|
||||
|
||||
// <stdarg.h> is not provided by libc++
|
||||
#if __has_include(<stdarg.h>)
|
||||
# include <stdarg.h>
|
||||
# ifdef _LIBCPP_STDARG_H
|
||||
# error "If libc++ starts defining <stdarg.h>, the __has_include check should move to libc++'s <stdarg.h>"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
|
@ -47,7 +47,14 @@ int timespec_get( struct timespec *ts, int base); // C++17
|
||||
|
||||
#include <__assert> // all public C++ headers provide the assertion handler
|
||||
#include <__config>
|
||||
#include <time.h>
|
||||
|
||||
// <time.h> is not provided by libc++
|
||||
#if __has_include(<time.h>)
|
||||
# include <time.h>
|
||||
# ifdef _LIBCPP_TIME_H
|
||||
# error "If libc++ starts defining <time.h>, the __has_include check should move to libc++'s <time.h>"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
|
Loading…
Reference in New Issue
Block a user