Allow the libc++ C header wrappers to be included when compiling C.

C99 at least. C89 still fails due to the use of block comments.

NOTE: Having libc++ on the include path when compiling C is not
recommended or ever really supported. However it happens often
enough that this change is warrented.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2017-06-16 01:57:41 +00:00
parent 660d2654f8
commit 73202133d9
2 changed files with 40 additions and 2 deletions

View File

@@ -1135,8 +1135,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
# define _LIBCPP_HAS_NO_COROUTINES # define _LIBCPP_HAS_NO_COROUTINES
#endif #endif
#endif // __cplusplus
// Decide whether to use availability macros. // Decide whether to use availability macros.
#if !defined(_LIBCPP_BUILDING_LIBRARY) && \ #if !defined(_LIBCPP_BUILDING_LIBRARY) && \
!defined(_LIBCPP_DISABLE_AVAILABILITY) && \ !defined(_LIBCPP_DISABLE_AVAILABILITY) && \
@@ -1240,4 +1238,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
# endif # endif
#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) #endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
#endif // __cplusplus
#endif // _LIBCPP_CONFIG #endif // _LIBCPP_CONFIG

View File

@@ -0,0 +1,37 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// Test that the C wrapper headers can be included when compiling them as C.
// NOTE: It's not common or recommended to have libc++ in the header search
// path when compiling C files, but it does happen often enough.
// RUN: %cxx -c -xc %s -fsyntax-only %flags %compile_flags -std=c99
#include <complex.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <setjmp.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tgmath.h>
#include <wchar.h>
#include <wctype.h>
int main() {}