mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
Only use __has_include when it is defined
Per GCC's documentation: > The __has_include operator by itself, without any operand or parentheses, acts as a predefined macro so that support for it can be tested in portable code. Thus, the recommended use of the operator is as follows: > > #if defined __has_include > # if __has_include (<stdatomic.h>) > # include <stdatomic.h> > # endif > #endif > > The first ‘#if’ test succeeds only when the operator is supported by the version of GCC (or another compiler) being used. Only when that test succeeds is it valid to use __has_include as a preprocessor operator.
This commit is contained in:
parent
9f704c88a5
commit
461c18edad
@ -5,6 +5,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "auto/config.h"
|
#include "auto/config.h"
|
||||||
|
#include "nvim/macros.h"
|
||||||
|
|
||||||
#define DEBUG_LOG_LEVEL 0
|
#define DEBUG_LOG_LEVEL 0
|
||||||
#define INFO_LOG_LEVEL 1
|
#define INFO_LOG_LEVEL 1
|
||||||
@ -68,7 +69,7 @@
|
|||||||
# define LOG_CALLSTACK_TO_FILE(fp) log_callstack_to_file(fp, __func__, __LINE__)
|
# define LOG_CALLSTACK_TO_FILE(fp) log_callstack_to_file(fp, __func__, __LINE__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__has_include) && __has_include("sanitizer/asan_interface.h")
|
#if NVIM_HAS_INCLUDE("sanitizer/asan_interface.h")
|
||||||
# include "sanitizer/asan_interface.h"
|
# include "sanitizer/asan_interface.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -152,6 +152,12 @@
|
|||||||
#define STR_(x) #x
|
#define STR_(x) #x
|
||||||
#define STR(x) STR_(x)
|
#define STR(x) STR_(x)
|
||||||
|
|
||||||
|
#ifndef __has_include
|
||||||
|
# define NVIM_HAS_INCLUDE(x) 0
|
||||||
|
#else
|
||||||
|
# define NVIM_HAS_INCLUDE __has_include
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __has_attribute
|
#ifndef __has_attribute
|
||||||
# define NVIM_HAS_ATTRIBUTE(x) 0
|
# define NVIM_HAS_ATTRIBUTE(x) 0
|
||||||
#elif defined(__clang__) && __clang__ == 1 \
|
#elif defined(__clang__) && __clang__ == 1 \
|
||||||
|
Loading…
Reference in New Issue
Block a user