aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2018-06-26 23:20:26 +0200
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2018-06-27 22:30:12 +0200
commitd7c6c6e40f0644a0041dbae97fa9ffe3f2318d43 (patch)
treedacb53f6d9910eb916cde3f12b0c08fbaf12aedf
parent0458a6b89ab74c1823266558acd6cf5adeca7664 (diff)
!@#!%$@#
-rw-r--r--Makefile8
-rw-r--r--build.yaml2
-rw-r--r--templates/Makefile.template2
-rw-r--r--test/build/no-maybe-uninitialized.c19
4 files changed, 28 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 71fcf14045..d90755bb68 100644
--- a/Makefile
+++ b/Makefile
@@ -330,6 +330,12 @@ ifeq ($(HAS_WORKING_NO_UNUSED_BUT_SET_VARIABLE),true)
W_NO_UNUSED_BUT_SET_VARIABLE=-Wno-unused-but-set-variable
NO_W_NO_UNUSED_BUT_SET_VARIABLE=-Wunused-but-set-variable
endif
+CHECK_NO_MAYBE_UNINITIALIZED_WORKS_CMD = $(CC) -std=c99 -Werror -Wno-maybe-uninitialized -o $(TMPOUT) -c test/build/no-maybe-uninitialized.c
+HAS_WORKING_NO_MAYBE_UNINITIALIZED = $(shell $(CHECK_NO_MAYBE_UNINITIALIZED_WORKS_CMD) 2> /dev/null && echo true || echo false)
+ifeq ($(HAS_WORKING_NO_MAYBE_UNINITIALIZED),true)
+W_NO_MAYBE_UNINITIALIZED=-Wno-maybe-uninitialized
+NO_W_NO_MAYBE_UNINITIALIZED=-Wmaybe-uninitialized
+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
@@ -3214,7 +3220,7 @@ PUBLIC_HEADERS_C += \
LIBCXXABI_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBCXXABI_SRC))))
-$(LIBCXXABI_OBJS): CPPFLAGS += -D_LIBCPP_DISABLE_EXTERN_TEMPLATE -D_LIBCXXABI_BUILDING_LIBRARY -D_LIBCXXABI_NO_EXCEPTIONS -Ithird_party/libcxxabi/include -nostdinc++ -Ithird_party/libcxx/include $(W_NO_UNUSED_BUT_SET_VARIABLE) -fvisibility=hidden
+$(LIBCXXABI_OBJS): CPPFLAGS += -D_LIBCPP_DISABLE_EXTERN_TEMPLATE -D_LIBCXXABI_BUILDING_LIBRARY -D_LIBCXXABI_NO_EXCEPTIONS -Ithird_party/libcxxabi/include -nostdinc++ -Ithird_party/libcxx/include $(W_NO_UNUSED_BUT_SET_VARIABLE) $(W_NO_MAYBE_UNINITIALIZED) -fvisibility=hidden
$(LIBCXXABI_OBJS): CXXFLAGS += $(W_NO_CXX14_COMPAT)
$(LIBDIR)/$(CONFIG)/libcxxabi.a: $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(LIBCXXABI_OBJS)
diff --git a/build.yaml b/build.yaml
index 8408b5e513..e4e19b8cec 100644
--- a/build.yaml
+++ b/build.yaml
@@ -5694,7 +5694,7 @@ defaults:
cxxabi:
CPPFLAGS: -D_LIBCPP_DISABLE_EXTERN_TEMPLATE -D_LIBCXXABI_BUILDING_LIBRARY -D_LIBCXXABI_NO_EXCEPTIONS
-Ithird_party/libcxxabi/include -nostdinc++ -Ithird_party/libcxx/include $(W_NO_UNUSED_BUT_SET_VARIABLE)
- -fvisibility=hidden
+ $(W_NO_MAYBE_UNINITIALIZED) -fvisibility=hidden
CXXFLAGS: $(W_NO_CXX14_COMPAT)
global:
COREFLAGS: -fno-rtti -fno-exceptions
diff --git a/templates/Makefile.template b/templates/Makefile.template
index 1027851b7b..628056ed4d 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -37,7 +37,7 @@
# warnings we'd like, but that dont exist in all compilers
PREFERRED_WARNINGS=['shadow', 'extra-semi']
- CHECK_WARNINGS=PREFERRED_WARNINGS + ['no-shift-negative-value', 'no-unused-but-set-variable']
+ CHECK_WARNINGS=PREFERRED_WARNINGS + ['no-shift-negative-value', 'no-unused-but-set-variable', 'no-maybe-uninitialized']
def warning_var(fmt, warning):
return fmt % warning.replace('-', '_').replace('+', 'X').upper()
diff --git a/test/build/no-maybe-uninitialized.c b/test/build/no-maybe-uninitialized.c
new file mode 100644
index 0000000000..0c1771c7bb
--- /dev/null
+++ b/test/build/no-maybe-uninitialized.c
@@ -0,0 +1,19 @@
+/*
+ *
+ * Copyright 2015 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+int main(void) {}