A couple of fixes for using Makefile.standalone on Mac.
(*) PNaCl toolchain_build builds 64-bit libraries for LLVM on Mac.
That won't link with subzero code if subzero is built with -m32,
so add an option to override the -m32.
(*) include locale header
(*) Mark xMacroIntegrityCheck unused to avoid clang compiler warning.
(*) virtual dtor, for inheritable class
(*) Mark compare function const
BUG=none
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/428733003
diff --git a/Makefile.standalone b/Makefile.standalone
index b0addad..2d3c0ad 100644
--- a/Makefile.standalone
+++ b/Makefile.standalone
@@ -18,9 +18,19 @@
LLVM_BIN_PATH ?= $(shell readlink -e \
../../out/llvm_i686_linux_work/Release+Asserts/bin)
+HOST_ARCH ?= x86
+ifeq ($(HOST_ARCH),x86_64)
+ HOST_FLAGS = -m64
+else
+ ifeq ($(HOST_ARCH),x86)
+ HOST_FLAGS = -m32
+ endif
+endif
+
$(info -----------------------------------------------)
$(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH))
$(info Using LLVM_BIN_PATH = $(LLVM_BIN_PATH))
+$(info Using HOST_ARCH = $(HOST_ARCH))
$(info -----------------------------------------------)
LLVM_CXXFLAGS := `$(LLVM_BIN_PATH)/llvm-config --cxxflags`
@@ -29,9 +39,11 @@
# It's recommended that CXX matches the compiler you used to build LLVM itself.
OPTLEVEL := -O0
CXX := g++
+
CXXFLAGS := -Wall -Wextra -Werror -fno-rtti -fno-exceptions \
- $(OPTLEVEL) -g $(LLVM_CXXFLAGS) -m32 -Wno-error=unused-parameter
-LDFLAGS := -m32
+ $(OPTLEVEL) -g $(LLVM_CXXFLAGS) $(HOST_FLAGS) \
+ -Wno-error=unused-parameter
+LDFLAGS := $(HOST_FLAGS)
SRCS= \
IceCfg.cpp \
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index 113ffc4..5dd8b63 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include <ctype.h> // isdigit(), isupper()
+#include <locale> // locale
#include "IceDefs.h"
#include "IceTypes.h"
@@ -61,7 +62,7 @@
private:
typedef std::pair<Type, KeyType> TupleType;
struct TupleCompare {
- bool operator()(const TupleType &A, const TupleType &B) {
+ bool operator()(const TupleType &A, const TupleType &B) const {
if (A.first != B.first)
return A.first < B.first;
if (KeyTypeHasFP)
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
index 3f6098c..05ae121 100644
--- a/src/IceTargetLowering.cpp
+++ b/src/IceTargetLowering.cpp
@@ -198,4 +198,6 @@
return NULL;
}
+TargetGlobalInitLowering::~TargetGlobalInitLowering() {}
+
} // end of namespace Ice
diff --git a/src/IceTargetLowering.h b/src/IceTargetLowering.h
index c798943..da52adf 100644
--- a/src/IceTargetLowering.h
+++ b/src/IceTargetLowering.h
@@ -211,6 +211,8 @@
public:
static TargetGlobalInitLowering *createLowering(TargetArch Target,
GlobalContext *Ctx);
+ virtual ~TargetGlobalInitLowering();
+
// TODO: Allow relocations to be represented as part of the Data.
virtual void lower(const IceString &Name, SizeT Align, bool IsInternal,
bool IsConst, bool IsZeroInitializer, SizeT Size,
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp
index 8123e74..7c60d08 100644
--- a/src/IceTargetLoweringX8632.cpp
+++ b/src/IceTargetLoweringX8632.cpp
@@ -143,7 +143,7 @@
// could get out of sync if enum values are reordered or if entries
// are added or deleted. This dummy function uses static_assert to
// ensure everything is kept in sync.
-void xMacroIntegrityCheck() {
+void __attribute__((unused)) xMacroIntegrityCheck() {
// Validate the enum values in FCMPX8632_TABLE.
{
// Define a temporary set of enum values based on low-level