Commit caeaa27b by Jim Stichnoth

Fix the g++ build.

It turns out that the g++ test build, initiated by "make presubmit", was actually using clang++ for the build. This fixes the makefile, plus the code that actually produces errors under the g++ build. BUG= none TBR=jpp Review URL: https://codereview.chromium.org/1572863003 .
parent 76659375
...@@ -94,17 +94,6 @@ else ...@@ -94,17 +94,6 @@ else
OBJDIR := $(OBJDIR)+Asserts OBJDIR := $(OBJDIR)+Asserts
endif endif
# Use g++ to compile, to check for errors/warnings that clang++ might have
# missed. It's unlikely to link, unless LLVM was also built with g++, so the
# compile_only target should be used.
ifdef GPLUSPLUS
CXX = CCACHE_CPP2=yes $(CCACHE) g++
STDLIB_FLAGS =
LLVM_EXTRA_WARNINGS="-Wno-unknown-pragmas -Wno-unused-parameter \
-Wno-comment -Wno-enum-compare -Wno-strict-aliasing"
OBJDIR := $(OBJDIR)+Gplusplus
endif
ifdef UBSAN ifdef UBSAN
OBJDIR := $(OBJDIR)+UBSan OBJDIR := $(OBJDIR)+UBSan
CXX_EXTRA += -fsanitize=undefined -fno-sanitize=vptr \ CXX_EXTRA += -fsanitize=undefined -fno-sanitize=vptr \
...@@ -192,6 +181,20 @@ SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate ...@@ -192,6 +181,20 @@ SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate
# Extra warnings that LLVM's build system adds in addition to -Wall. # Extra warnings that LLVM's build system adds in addition to -Wall.
LLVM_EXTRA_WARNINGS := -Wcovered-switch-default LLVM_EXTRA_WARNINGS := -Wcovered-switch-default
# Use g++ to compile, to check for errors/warnings that clang++ might have
# missed. It's unlikely to link, unless LLVM was also built with g++, so the
# compile_only target should be used. Note: This ifdef section is deliberately
# placed here instead of with the other ifdef sections, so that its redefinition
# of CXX/STDLIB_FLAGS/LLVM_EXTRA_WARNINGS follows their normal definitions.
ifdef GPLUSPLUS
CXX := CCACHE_CPP2=yes $(CCACHE) g++
STDLIB_FLAGS :=
LLVM_EXTRA_WARNINGS := -Wno-unknown-pragmas -Wno-unused-parameter \
-Wno-comment -Wno-enum-compare -Wno-strict-aliasing \
-Wno-return-type
OBJDIR := $(OBJDIR)+Gplusplus
endif
BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \ BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \
-fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \ -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \
$(LLVM_EXTRA_WARNINGS) $(CXX_EXTRA) $(LLVM_EXTRA_WARNINGS) $(CXX_EXTRA)
......
...@@ -330,7 +330,7 @@ void ELFObjectWriter::writeDataOfType(SectionType ST, ...@@ -330,7 +330,7 @@ void ELFObjectWriter::writeDataOfType(SectionType ST,
case ROData: { case ROData: {
const IceString SectionName = const IceString SectionName =
MangleSectionName(IsPIC ? ".data.rel.ro" : ".rodata", SectionSuffix); MangleSectionName(IsPIC ? ".data.rel.ro" : ".rodata", SectionSuffix);
const Elf64_Xword ShFlags = SHF_ALLOC | (IsPIC ? SHF_WRITE : 0); const Elf64_Xword ShFlags = IsPIC ? (SHF_ALLOC | SHF_WRITE) : SHF_ALLOC;
Section = createSection<ELFDataSection>(SectionName, SHT_PROGBITS, ShFlags, Section = createSection<ELFDataSection>(SectionName, SHT_PROGBITS, ShFlags,
ShAddralign, ShEntsize); ShAddralign, ShEntsize);
Section->setFileOffset(alignFileOffset(ShAddralign)); Section->setFileOffset(alignFileOffset(ShAddralign));
......
...@@ -117,18 +117,18 @@ public: ...@@ -117,18 +117,18 @@ public:
static constexpr struct TableType { static constexpr struct TableType {
const char *Name; const char *Name;
int32_t Encoding : 10; unsigned Encoding : 10;
int32_t CCArg : 6; unsigned CCArg : 6;
int32_t Scratch : 1; unsigned Scratch : 1;
int32_t Preserved : 1; unsigned Preserved : 1;
int32_t StackPtr : 1; unsigned StackPtr : 1;
int32_t FramePtr : 1; unsigned FramePtr : 1;
int32_t IsGPR : 1; unsigned IsGPR : 1;
int32_t IsInt : 1; unsigned IsInt : 1;
int32_t IsI64Pair : 1; unsigned IsI64Pair : 1;
int32_t IsFP32 : 1; unsigned IsFP32 : 1;
int32_t IsFP64 : 1; unsigned IsFP64 : 1;
int32_t IsVec128 : 1; unsigned IsVec128 : 1;
#define NUM_ALIASES_BITS 3 #define NUM_ALIASES_BITS 3
SizeT NumAliases : (NUM_ALIASES_BITS + 1); SizeT NumAliases : (NUM_ALIASES_BITS + 1);
uint16_t Aliases[1 << NUM_ALIASES_BITS]; uint16_t Aliases[1 << NUM_ALIASES_BITS];
......
...@@ -449,17 +449,17 @@ public: ...@@ -449,17 +449,17 @@ public:
static constexpr struct { static constexpr struct {
uint16_t Val; uint16_t Val;
int Is64 : 1; unsigned Is64 : 1;
int Is32 : 1; unsigned Is32 : 1;
int Is16 : 1; unsigned Is16 : 1;
int Is8 : 1; unsigned Is8 : 1;
int IsXmm : 1; unsigned IsXmm : 1;
int Is64To8 : 1; unsigned Is64To8 : 1;
int Is32To8 : 1; unsigned Is32To8 : 1;
int Is16To8 : 1; unsigned Is16To8 : 1;
int IsTrunc8Rcvr : 1; unsigned IsTrunc8Rcvr : 1;
int IsAhRcvr : 1; unsigned IsAhRcvr : 1;
int Scratch : 1; unsigned Scratch : 1;
#define NUM_ALIASES_BITS 2 #define NUM_ALIASES_BITS 2
SizeT NumAliases : (NUM_ALIASES_BITS + 1); SizeT NumAliases : (NUM_ALIASES_BITS + 1);
uint16_t Aliases[1 << NUM_ALIASES_BITS]; uint16_t Aliases[1 << NUM_ALIASES_BITS];
......
...@@ -501,17 +501,17 @@ public: ...@@ -501,17 +501,17 @@ public:
static constexpr struct { static constexpr struct {
uint16_t Val; uint16_t Val;
int Is64 : 1; unsigned Is64 : 1;
int Is32 : 1; unsigned Is32 : 1;
int Is16 : 1; unsigned Is16 : 1;
int Is8 : 1; unsigned Is8 : 1;
int IsXmm : 1; unsigned IsXmm : 1;
int Is64To8 : 1; unsigned Is64To8 : 1;
int Is32To8 : 1; unsigned Is32To8 : 1;
int Is16To8 : 1; unsigned Is16To8 : 1;
int IsTrunc8Rcvr : 1; unsigned IsTrunc8Rcvr : 1;
int IsAhRcvr : 1; unsigned IsAhRcvr : 1;
int Scratch : 1; unsigned Scratch : 1;
#define NUM_ALIASES_BITS 2 #define NUM_ALIASES_BITS 2
SizeT NumAliases : (NUM_ALIASES_BITS + 1); SizeT NumAliases : (NUM_ALIASES_BITS + 1);
uint16_t Aliases[1 << NUM_ALIASES_BITS]; uint16_t Aliases[1 << NUM_ALIASES_BITS];
......
...@@ -60,7 +60,6 @@ template <typename TraitsType> class TargetX86Base : public TargetLowering { ...@@ -60,7 +60,6 @@ template <typename TraitsType> class TargetX86Base : public TargetLowering {
public: public:
using Traits = TraitsType; using Traits = TraitsType;
using BoolFolding = BoolFolding<Traits>;
using ConcreteTarget = typename Traits::ConcreteTarget; using ConcreteTarget = typename Traits::ConcreteTarget;
using InstructionSetEnum = typename Traits::InstructionSet; using InstructionSetEnum = typename Traits::InstructionSet;
...@@ -836,7 +835,7 @@ private: ...@@ -836,7 +835,7 @@ private:
typename std::enable_if<!T::Is64Bit, void>::type typename std::enable_if<!T::Is64Bit, void>::type
lowerIcmp64(const InstIcmp *Icmp, const Inst *Consumer); lowerIcmp64(const InstIcmp *Icmp, const Inst *Consumer);
BoolFolding FoldingInfo; BoolFolding<Traits> FoldingInfo;
static FixupKind PcRelFixup; static FixupKind PcRelFixup;
static FixupKind AbsFixup; static FixupKind AbsFixup;
......
...@@ -1974,19 +1974,19 @@ void TargetX86Base<TraitsType>::lowerBr(const InstBr *Br) { ...@@ -1974,19 +1974,19 @@ void TargetX86Base<TraitsType>::lowerBr(const InstBr *Br) {
// Handle folding opportunities. // Handle folding opportunities.
if (const Inst *Producer = FoldingInfo.getProducerFor(Cond)) { if (const Inst *Producer = FoldingInfo.getProducerFor(Cond)) {
assert(Producer->isDeleted()); assert(Producer->isDeleted());
switch (BoolFolding::getProducerKind(Producer)) { switch (BoolFolding<Traits>::getProducerKind(Producer)) {
default: default:
break; break;
case BoolFolding::PK_Icmp32: case BoolFolding<Traits>::PK_Icmp32:
case BoolFolding::PK_Icmp64: { case BoolFolding<Traits>::PK_Icmp64: {
lowerIcmpAndConsumer(llvm::dyn_cast<InstIcmp>(Producer), Br); lowerIcmpAndConsumer(llvm::dyn_cast<InstIcmp>(Producer), Br);
return; return;
} }
case BoolFolding::PK_Fcmp: { case BoolFolding<Traits>::PK_Fcmp: {
lowerFcmpAndConsumer(llvm::dyn_cast<InstFcmp>(Producer), Br); lowerFcmpAndConsumer(llvm::dyn_cast<InstFcmp>(Producer), Br);
return; return;
} }
case BoolFolding::PK_Arith: { case BoolFolding<Traits>::PK_Arith: {
lowerArithAndConsumer(llvm::dyn_cast<InstArithmetic>(Producer), Br); lowerArithAndConsumer(llvm::dyn_cast<InstArithmetic>(Producer), Br);
return; return;
} }
...@@ -4810,15 +4810,15 @@ void TargetX86Base<TraitsType>::lowerSelect(const InstSelect *Select) { ...@@ -4810,15 +4810,15 @@ void TargetX86Base<TraitsType>::lowerSelect(const InstSelect *Select) {
// Handle folding opportunities. // Handle folding opportunities.
if (const Inst *Producer = FoldingInfo.getProducerFor(Condition)) { if (const Inst *Producer = FoldingInfo.getProducerFor(Condition)) {
assert(Producer->isDeleted()); assert(Producer->isDeleted());
switch (BoolFolding::getProducerKind(Producer)) { switch (BoolFolding<Traits>::getProducerKind(Producer)) {
default: default:
break; break;
case BoolFolding::PK_Icmp32: case BoolFolding<Traits>::PK_Icmp32:
case BoolFolding::PK_Icmp64: { case BoolFolding<Traits>::PK_Icmp64: {
lowerIcmpAndConsumer(llvm::dyn_cast<InstIcmp>(Producer), Select); lowerIcmpAndConsumer(llvm::dyn_cast<InstIcmp>(Producer), Select);
return; return;
} }
case BoolFolding::PK_Fcmp: { case BoolFolding<Traits>::PK_Fcmp: {
lowerFcmpAndConsumer(llvm::dyn_cast<InstFcmp>(Producer), Select); lowerFcmpAndConsumer(llvm::dyn_cast<InstFcmp>(Producer), Select);
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment