No #include <new> in C mode; add basic C mode test (ROOT-7090).

This commit is contained in:
Axel Naumann 2015-02-21 22:37:50 +01:00 committed by sftnight
parent 69234ce153
commit e582b93a16
2 changed files with 24 additions and 5 deletions

View File

@ -235,11 +235,14 @@ namespace cling {
if (External)
External->StartTranslationUnit(m_Consumer);
// <new> is needed by the ValuePrinter so it's a good thing to include it.
// We need to include it to determine the version number of the standard
// library implementation.
ParseInternal("#include <new>");
CheckABICompatibility(m_CI.get());
if (m_CI->getLangOpts().CPlusPlus) {
// <new> is needed by the ValuePrinter so it's a good thing to include it.
// We need to include it to determine the version number of the standard
// library implementation.
ParseInternal("#include <new>");
// That's really C++ ABI compatibility. C has other problems ;-)
CheckABICompatibility(m_CI.get());
}
// DO NOT commit the transactions here: static initialization in these
// transactions requires gCling through local_cxa_atexit(), but that has not

16
test/Driver/C.c Normal file
View File

@ -0,0 +1,16 @@
//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------
// RUN: cat %s | %cling -x c | FileCheck %s
// Validate cling C mode.
int printf(const char*,...);
printf("CHECK 123\n"); // CHECK: CHECK 123
// fix value printing!