[libcxx-commits] [libcxx] 6340f89 - [libc++] Fix extern C for __sanitizer_annotate_contiguous_container() (for gcc)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 17 13:20:36 PST 2020


Author: Azat Khuzhin
Date: 2020-12-17T16:20:24-05:00
New Revision: 6340f890bb86b6ec1e72047d4c4560ee0dfe6d90

URL: https://github.com/llvm/llvm-project/commit/6340f890bb86b6ec1e72047d4c4560ee0dfe6d90
DIFF: https://github.com/llvm/llvm-project/commit/6340f890bb86b6ec1e72047d4c4560ee0dfe6d90.diff

LOG: [libc++] Fix extern C for __sanitizer_annotate_contiguous_container() (for gcc)

gcc supports it only at the beginning:

    $ g++ -o /dev/null -c /tmp/test_extern.cpp
    $ cat /tmp/test_extern.cpp
    extern "C" __attribute__ ((__visibility__("default"))) int foo();

Otherwise:

    $ g++ -o /dev/null -c /tmp/test_extern.cpp
    /tmp/test_extern.cpp:1:52: error: expected unqualified-id before string constant
        1 | __attribute__ ((__visibility__("default"))) extern "C" int foo();
          |                                                    ^~~
    $ cat /tmp/test_extern.cpp
    __attribute__ ((__visibility__("default"))) extern "C" int foo();

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D93316

Added: 
    

Modified: 
    libcxx/include/__config

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__config b/libcxx/include/__config
index 033cd8aea068..9f49e805d61b 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1082,7 +1082,7 @@ typedef unsigned int   char32_t;
 #endif
 
 #ifndef _LIBCPP_HAS_NO_ASAN
-_LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
+extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
   const void *, const void *, const void *, const void *);
 #endif
 


        


More information about the libcxx-commits mailing list