Skip to content

Commit

Permalink
Kbuild: Use cxx_flags for C++
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasdn committed Feb 23, 2022
1 parent eaa811c commit b6560e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/Makefile.build
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ quiet_cmd_cc_o_c = CC $(quiet_modtag) $@

cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<

cmd_cxx_o_cpp = $(CXX) $(cpp_flags) -c -o $@ $<
cmd_cxx_o_cpp = $(CXX) $(cxx_flags) -c -o $@ $<
quiet_cmd_cxx_o_cpp = $(CXX) $(quiet_modtag) $@

ifdef CONFIG_STACK_VALIDATION
Expand Down
7 changes: 6 additions & 1 deletion scripts/Makefile.lib
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ _a_flags = $(filter-out $(AFLAGS_REMOVE_$(basetarget).o), $(orig_a_flags))
_cpp_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))

# Remove all non c++ compatible flags
_cpp_flags := $(filter-out -Wno-pointer-sign -Werror=implicit-int -std=gnu11,$(_cpp_flags))
_cxx_flags := $(filter-out -Wno-pointer-sign -Werror=implicit-int -std=gnu11,$(_c_flags))

# If building the kernel in a separate objtree expand all occurrences
# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').

ifeq ($(KBUILD_SRC),)
__c_flags = $(_c_flags)
__cxx_flags = $(_cxx_flags)
__a_flags = $(_a_flags)
__cpp_flags = $(_cpp_flags)
else
Expand All @@ -89,13 +90,17 @@ else
# and locates generated .h files
# FIXME: Replace both with specific CFLAGS* statements in the makefiles
__c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags)
__cxx_flags = $(call flags,_cxx_flags)
__a_flags = $(call flags,_a_flags)
__cpp_flags = $(call flags,_cpp_flags)
endif

c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(MYAPPINCLUDE) \
$(__c_flags) $(modkern_cflags)

cxx_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(MYAPPINCLUDE) \
$(__cxx_flags) $(modkern_cflags)

a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(MYAPPINCLUDE) \
$(__a_flags) $(modkern_aflags)

Expand Down

0 comments on commit b6560e4

Please sign in to comment.