support of building with C++11
This commit is contained in:
6
Makefile
6
Makefile
@@ -119,9 +119,9 @@ CXXFLAGS=$(OPT) $(LLVM_CXXFLAGS) -I. -Iobjs/ -I$(CLANG_INCLUDE) \
|
||||
$(LLVM_VERSION_DEF) \
|
||||
-Wall \
|
||||
-DBUILD_DATE="\"$(BUILD_DATE)\"" -DBUILD_VERSION="\"$(BUILD_VERSION)\"" \
|
||||
-Wno-sign-compare -Wno-unused-function
|
||||
ifneq ($(LLVM_VERSION),LLVM_3_1)
|
||||
CXXFLAGS+=-Werror
|
||||
-Wno-sign-compare -Wno-unused-function -Werror
|
||||
ifeq ($(LLVM_VERSION),LLVM_3_5)
|
||||
CXXFLAGS+=-std=c++11 -Wno-c99-extensions -Wno-deprecated-register
|
||||
endif
|
||||
ifneq ($(ARM_ENABLED), 0)
|
||||
CXXFLAGS+=-DISPC_ARM_ENABLED
|
||||
|
||||
14
cbackend.cpp
14
cbackend.cpp
@@ -1462,7 +1462,7 @@ void CWriter::printConstant(llvm::Constant *CPV, bool Static) {
|
||||
char Buffer[100];
|
||||
|
||||
uint64_t ll = llvm::DoubleToBits(V);
|
||||
sprintf(Buffer, "0x%"PRIx64, ll);
|
||||
sprintf(Buffer, "0x%" PRIx64, ll);
|
||||
|
||||
std::string Num(&Buffer[0], &Buffer[6]);
|
||||
unsigned long Val = strtoul(Num.c_str(), 0, 16);
|
||||
@@ -3123,7 +3123,11 @@ void CWriter::visitSwitchInst(llvm::SwitchInst &SI) {
|
||||
Out << ":\n";
|
||||
printPHICopiesForSuccessor (SI.getParent(), Succ, 2);
|
||||
printBranchToBlock(SI.getParent(), Succ, 2);
|
||||
#if defined (LLVM_3_5)
|
||||
if (llvm::Function::iterator(Succ) == std::next(llvm::Function::iterator(SI.getParent())))
|
||||
#else
|
||||
if (llvm::Function::iterator(Succ) == llvm::next(llvm::Function::iterator(SI.getParent())))
|
||||
#endif
|
||||
Out << " break;\n";
|
||||
}
|
||||
|
||||
@@ -3144,7 +3148,11 @@ bool CWriter::isGotoCodeNecessary(llvm::BasicBlock *From, llvm::BasicBlock *To)
|
||||
/// FIXME: This should be reenabled, but loop reordering safe!!
|
||||
return true;
|
||||
|
||||
#if defined (LLVM_3_5)
|
||||
if (std::next(llvm::Function::iterator(From)) != llvm::Function::iterator(To))
|
||||
#else
|
||||
if (llvm::next(llvm::Function::iterator(From)) != llvm::Function::iterator(To))
|
||||
#endif
|
||||
return true; // Not the direct successor, we need a goto.
|
||||
|
||||
//llvm::isa<llvm::SwitchInst>(From->getTerminator())
|
||||
@@ -3752,7 +3760,11 @@ void CWriter::lowerIntrinsics(llvm::Function &F) {
|
||||
// All other intrinsic calls we must lower.
|
||||
llvm::Instruction *Before = 0;
|
||||
if (CI != &BB->front())
|
||||
#if defined(LLVM_3_5)
|
||||
Before = std::prev(llvm::BasicBlock::iterator(CI));
|
||||
#else
|
||||
Before = prior(llvm::BasicBlock::iterator(CI));
|
||||
#endif
|
||||
|
||||
IL->LowerIntrinsicCall(CI);
|
||||
if (Before) { // Move iterator to instruction after call
|
||||
|
||||
4
expr.cpp
4
expr.cpp
@@ -6194,10 +6194,10 @@ ConstExpr::Print() const {
|
||||
printf("%f", floatVal[i]);
|
||||
break;
|
||||
case AtomicType::TYPE_INT64:
|
||||
printf("%"PRId64, int64Val[i]);
|
||||
printf("%" PRId64, int64Val[i]);
|
||||
break;
|
||||
case AtomicType::TYPE_UINT64:
|
||||
printf("%"PRIu64, uint64Val[i]);
|
||||
printf("%" PRIu64, uint64Val[i]);
|
||||
break;
|
||||
case AtomicType::TYPE_DOUBLE:
|
||||
printf("%f", doubleVal[i]);
|
||||
|
||||
2
util.cpp
2
util.cpp
@@ -577,7 +577,7 @@ GetDirectoryAndFileName(const std::string ¤tDirectory,
|
||||
const char *basenameStart = strrchr(fp, '/');
|
||||
Assert(basenameStart != NULL);
|
||||
++basenameStart;
|
||||
Assert(basenameStart != '\0');
|
||||
Assert(basenameStart[0] != '\0');
|
||||
*filename = basenameStart;
|
||||
*directory = std::string(fp, basenameStart - fp);
|
||||
#endif // ISPC_IS_WINDOWS
|
||||
|
||||
Reference in New Issue
Block a user