summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRong Chang <rongchang@chromium.org>2018-12-10 17:18:55 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-01-24 00:51:41 -0800
commit8d8e6eb819e6c883c10ae71fc4662af463d91a1b (patch)
tree59c2fa17b4dc72ea6812051658753f68cc718e16
parentebb25bc556e399678189895b0371065e8c9507c0 (diff)
downloadchrome-ec-8d8e6eb819e6c883c10ae71fc4662af463d91a1b.tar.gz
build: add centroiding C++ support
Centroiding source is in C++. This CL removes -W flags only for building C files from CFLAGS and also prevents typedef existing C++ keyword wchar_t. BUG=b:120961468 BRANCH=none TEST=make buildall Change-Id: Ifb8793a8e7e69b26a742b7dbf70289747a0ee7b3 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1372874 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Tai-Hsu Lin <sheckylin@chromium.org>
-rw-r--r--Makefile.rules2
-rw-r--r--Makefile.toolchain2
-rw-r--r--builtin/stddef.h3
3 files changed, 5 insertions, 2 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 28eae3a7d3..73edbae82e 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -78,7 +78,7 @@ cmd_fuzz_exe = $(CXX) $^ $(HOST_TEST_LDFLAGS) $(LDFLAGS_EXTRA) -o $@
cmd_run_fuzz = build/host/$*/$*.exe -seed=1 -runs=1 $(silent) \
$(silent_err) || (echo "Test $* failed!" && false)
cmd_exe = $(CC) $(ro-objs) $(HOST_TEST_LDFLAGS) -o $@
-cmd_c_to_o = $(CC) $(CFLAGS) -MMD -MP -MF $@.d -c $< -o $(@D)/$(@F)
+cmd_c_to_o = $(CC) $(C_WARN) $(CFLAGS) -MMD -MP -MF $@.d -c $< -o $(@D)/$(@F)
cmd_cxx_to_o = $(CXX) -std=c++11 $(CFLAGS) $(CXXFLAGS) -MMD -MP -MF $@.d -c $< \
-o $(@D)/$(@F)
cmd_c_to_build = $(BUILDCC) $(BUILD_CFLAGS) \
diff --git a/Makefile.toolchain b/Makefile.toolchain
index ddf0901afc..a7cf15fab3 100644
--- a/Makefile.toolchain
+++ b/Makefile.toolchain
@@ -92,7 +92,7 @@ ifneq ($(BOARD),host)
CPPFLAGS+=-ffreestanding -fno-builtin -nostdinc -nostdlib
CPPFLAGS+=-Ibuiltin/
endif
-CFLAGS=$(CPPFLAGS) $(CFLAGS_CPU) $(CFLAGS_DEBUG) $(CFLAGS_WARN) $(CFLAGS_y)
+CFLAGS=$(CPPFLAGS) $(CFLAGS_CPU) $(CFLAGS_DEBUG) $(COMMON_WARN) $(CFLAGS_y)
CFLAGS+= -ffunction-sections -fshort-wchar
ifneq ($(cc-name),clang)
# TODO(chromium:854924): LLVM support for this flag is coming soon.
diff --git a/builtin/stddef.h b/builtin/stddef.h
index 343b0f6adf..69fb1982c7 100644
--- a/builtin/stddef.h
+++ b/builtin/stddef.h
@@ -25,7 +25,10 @@ typedef __SIZE_TYPE__ ssize_t;
#ifndef __WCHAR_TYPE__
#define __WCHAR_TYPE__ int
#endif
+
+#ifndef __cplusplus
typedef __WCHAR_TYPE__ wchar_t;
+#endif
/* This macro definition is duplicated in compile_time_macros.h. It still needs
* to be defined here to support code that expects offsetof to be defined in the