Skip to content

Commit

Permalink
Merge pull request neovim#12945 from jamessan/has_include-fix
Browse files Browse the repository at this point in the history
Only use __has_include when it is defined
  • Loading branch information
jamessan authored Sep 20, 2020
2 parents 9f704c8 + 461c18e commit 42d13b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/nvim/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <stdbool.h>

#include "auto/config.h"
#include "nvim/macros.h"

#define DEBUG_LOG_LEVEL 0
#define INFO_LOG_LEVEL 1
Expand Down Expand Up @@ -68,7 +69,7 @@
# define LOG_CALLSTACK_TO_FILE(fp) log_callstack_to_file(fp, __func__, __LINE__)
#endif

#if defined(__has_include) && __has_include("sanitizer/asan_interface.h")
#if NVIM_HAS_INCLUDE("sanitizer/asan_interface.h")
# include "sanitizer/asan_interface.h"
#endif

Expand Down
6 changes: 6 additions & 0 deletions src/nvim/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@
#define STR_(x) #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
# define NVIM_HAS_ATTRIBUTE(x) 0
#elif defined(__clang__) && __clang__ == 1 \
Expand Down

0 comments on commit 42d13b9

Please sign in to comment.