aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-09-10 14:43:18 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-09-10 14:43:18 -0700
commitf96dfc3cf89f0e10a5356ca1bcfd4697410a75c4 (patch)
tree81040d4efce2bb330a213d3ea54ae6e64c3c4870 /templates
parent0ebfaa04b0cd38ccf273746195ca8c8ac7f7d4d6 (diff)
First round of fixing up implicit 64->32 bit conversions
Diffstat (limited to 'templates')
-rw-r--r--templates/Makefile.template7
1 files changed, 7 insertions, 0 deletions
diff --git a/templates/Makefile.template b/templates/Makefile.template
index 79640180f6..d6bcb54bac 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -247,6 +247,10 @@
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)
+ # Detect if -Wshorten-64-to-32 is a thing
+ SHORTEN_64_TO_32_CHECK_CMD = $(CC) -Wshorten-64-to-32 test/build/empty.c
+ HAS_SHORTEN_64_TO_32 = $(shell $(SHORTEN_64_TO_32_CHECK_CMD) 2> /dev/null && echo true || echo false)
+
# 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
@@ -262,6 +266,9 @@
endif
CFLAGS += -std=c89 -pedantic -Wsign-conversion
+ ifeq ($(HAS_SHORTEN_64_TO_32),true)
+ CFLAGS += -Wshorten-64-to-32
+ endif
ifeq ($(HAS_CXX11),true)
CXXFLAGS += -std=c++11
else