diff options
author | Vijay Pai <vpai@google.com> | 2016-01-27 11:54:49 -0800 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2016-01-27 11:54:49 -0800 |
commit | 0a32766aa29331670db408f1618bfb95f0bd40bf (patch) | |
tree | 089a79cc3f225d4874f502b307f0009b8ea0a3f7 | |
parent | 6b6982bde37911fbcefa0e6299840d998d600b85 (diff) | |
parent | 76ce77ba9e101f081b827891e804ee20f80b3e79 (diff) |
Merge pull request #4871 from ctiller/mwah
Fix a build error on newer clangs with msan
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | templates/Makefile.template | 8 |
2 files changed, 14 insertions, 2 deletions
@@ -279,6 +279,12 @@ endif CXX11_CHECK_CMD = $(CXX) -std=c++11 -o $(TMPOUT) -c test/build/c++11.cc HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false) +CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD = $(CC) -std=c99 -Werror -Wno-shift-negative-value -o $(TMPOUT) -c test/build/empty.c +HAS_NO_SHIFT_NEGATIVE_VALUE = $(shell $(CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD) 2> /dev/null && echo true || echo false) +ifeq ($(HAS_NO_SHIFT_NEGATIVE_VALUE),true) +W_NO_SHIFT_NEGATIVE_VALUE=-Wno-shift-negative-value +endif + # The HOST compiler settings are used to compile the protoc plugins. # In most cases, you won't have to change anything, but if you are # cross-compiling, you can override these variables from GNU make's @@ -5485,7 +5491,7 @@ LIBZ_SRC = \ LIBZ_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBZ_SRC)))) -$(LIBZ_OBJS): CFLAGS := $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration -fvisibility=hidden +$(LIBZ_OBJS): CFLAGS := $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration $(W_NO_SHIFT_NEGATIVE_VALUE) -fvisibility=hidden $(LIBDIR)/$(CONFIG)/libz.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(LIBZ_OBJS) $(E) "[AR] Creating $@" diff --git a/templates/Makefile.template b/templates/Makefile.template index a4fcf66782..57a0815193 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -183,6 +183,12 @@ CXX11_CHECK_CMD = $(CXX) -std=c++11 -o $(TMPOUT) -c test/build/c++11.cc HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false) + CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD = $(CC) -std=c99 -Werror -Wno-shift-negative-value -o $(TMPOUT) -c test/build/empty.c + HAS_NO_SHIFT_NEGATIVE_VALUE = $(shell $(CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD) 2> /dev/null && echo true || echo false) + ifeq ($(HAS_NO_SHIFT_NEGATIVE_VALUE),true) + W_NO_SHIFT_NEGATIVE_VALUE=-Wno-shift-negative-value + endif + # The HOST compiler settings are used to compile the protoc plugins. # In most cases, you won't have to change anything, but if you are # cross-compiling, you can override these variables from GNU make's @@ -1437,7 +1443,7 @@ $(LIB${lib.name.upper()}_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -fvisibility=hidden $(LIB${lib.name.upper()}_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE % elif lib.zlib: - $(LIB${lib.name.upper()}_OBJS): CFLAGS := $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration -fvisibility=hidden + $(LIB${lib.name.upper()}_OBJS): CFLAGS := $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration $(W_NO_SHIFT_NEGATIVE_VALUE) -fvisibility=hidden % else: % endif |