From c1ad43566855c9f95b3743d9a9ce28a1d8efe6f3 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Thu, 9 Jul 2020 21:19:27 +0200 Subject: [PATCH] Makefile.base: Error for C++ code w/w cpp feature If external modules use C++ code and forget to require the `cpp` feature, linking will still take places using $(CC). This commit adds a check if C++ code was detected without the feature `cpp` being used, now the build is aborted with a helpful error message rather than a linker error. --- Makefile.base | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile.base b/Makefile.base index d055c1a3d4..999c467240 100644 --- a/Makefile.base +++ b/Makefile.base @@ -63,6 +63,12 @@ ifeq ($(strip $(ASSMSRC))$(NO_AUTO_SRC),) ASSMSRC := $(wildcard *.S) endif +ifneq (,$(SRCXX)) + ifeq (,$(filter cpp,$(FEATURES_USED))) + $(error Found C++ source, but feature "cpp" is not used. Add "FEATURES_REQUIRED += cpp") + endif +endif + # include makefile snippets for packages in $(USEPKG) that modify GENSRC: -include $(USEPKG:%=$(RIOTPKG)/%/Makefile.gensrc)