From 2e6c0af81dd3da2affa7d1f9e17ceae0cfb2271e Mon Sep 17 00:00:00 2001 From: nzpznk Date: Sun, 3 Mar 2024 13:03:27 +0800 Subject: [PATCH 1/2] Update __config to make clangd happy The sgx-sdk uses _LIBCPP_COMPILER_GCC macro to modify the stl. However, when using clangd, the language sever defines __clang__ macro, so that if matches __clang__ first, the _LIBCPP_COMPILER_GCC will not be defined, thus causing clangd to report error. --- sdk/tlibcxx/include/__config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/tlibcxx/include/__config b/sdk/tlibcxx/include/__config index 7835a963a..fcc60d389 100644 --- a/sdk/tlibcxx/include/__config +++ b/sdk/tlibcxx/include/__config @@ -181,13 +181,13 @@ #define __has_include(...) 0 #endif -#if defined(__clang__) +#if defined(__GNUC__) +# define _LIBCPP_COMPILER_GCC +#elif defined(__clang__) # define _LIBCPP_COMPILER_CLANG # ifndef __apple_build_version__ # define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) # endif -#elif defined(__GNUC__) -# define _LIBCPP_COMPILER_GCC #elif defined(_MSC_VER) # define _LIBCPP_COMPILER_MSVC #elif defined(__IBMCPP__) From ec9df784bb37cb6083200768132b39dda0234509 Mon Sep 17 00:00:00 2001 From: nzpznk Date: Tue, 12 Mar 2024 12:01:54 +0800 Subject: [PATCH 2/2] Update variant, remove if condition for GCC 5 --- sdk/tlibcxx/include/variant | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tlibcxx/include/variant b/sdk/tlibcxx/include/variant index 770dd335b..d5f8b54c4 100644 --- a/sdk/tlibcxx/include/variant +++ b/sdk/tlibcxx/include/variant @@ -234,7 +234,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD // TODO: GCC 5 lies about its support for C++17 (it says it supports it but it // really doesn't). That breaks variant, which uses some C++17 features. // Remove this once we drop support for GCC 5. -#if _LIBCPP_STD_VER > 14 && !(defined(_LIBCPP_COMPILER_GCC) && _GNUC_VER_NEW < 6000) +#if _LIBCPP_STD_VER > 14 _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY