From 461c18edad41a2ab3301f40b4b2f240d9662800d Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 20 Sep 2020 11:30:20 -0400 Subject: Only use __has_include when it is defined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 () > # include > # 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. --- src/nvim/log.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/log.h') diff --git a/src/nvim/log.h b/src/nvim/log.h index a6a4c78707..d92b4629ed 100644 --- a/src/nvim/log.h +++ b/src/nvim/log.h @@ -5,6 +5,7 @@ #include #include "auto/config.h" +#include "nvim/macros.h" #define DEBUG_LOG_LEVEL 0 #define INFO_LOG_LEVEL 1 @@ -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 -- cgit