[make] add a way for a module to opt into additional warnings
Move -Wmissing-declarations and -Wmissing-prototypes into this bucket. Opt in most of the core top level modules in the system. More to follow.
This commit is contained in:
@@ -5,4 +5,6 @@ MODULE := $(LOCAL_DIR)
|
||||
MODULE_SRCS += \
|
||||
$(LOCAL_DIR)/app.c
|
||||
|
||||
MODULE_OPTIONS := extra_warnings
|
||||
|
||||
include make/module.mk
|
||||
|
||||
@@ -4,5 +4,7 @@ MODULE := $(LOCAL_DIR)
|
||||
|
||||
MODULE_SRCS := $(LOCAL_DIR)/arch.c
|
||||
|
||||
MODULE_OPTIONS := extra_warnings
|
||||
|
||||
include make/module.mk
|
||||
|
||||
|
||||
@@ -12,4 +12,6 @@ MODULE_SRCS += \
|
||||
$(LOCAL_DIR)/class/fb_api.c \
|
||||
$(LOCAL_DIR)/class/netif_api.c \
|
||||
|
||||
MODULE_OPTIONS := extra_warnings
|
||||
|
||||
include make/module.mk
|
||||
|
||||
13
engine.mk
13
engine.mk
@@ -71,8 +71,17 @@ GLOBAL_CPPFLAGS := --std=c++14 -fno-exceptions -fno-rtti -fno-threadsafe-statics
|
||||
GLOBAL_ASMFLAGS := -DASSEMBLY
|
||||
GLOBAL_LDFLAGS :=
|
||||
|
||||
# flags that are sometimes nice to enable to catch problems but too strict to have on all the time
|
||||
#GLOBAL_COMPILEFLAGS += -Wmissing-declarations
|
||||
# flags that are sometimes nice to enable to catch problems but too strict to have on all the time.
|
||||
# add to global flags from time to time to find things, otherwise only available with a module
|
||||
# option (see make/module.mk re: MODULE_OPTIONS).
|
||||
EXTRA_MODULE_COMPILEFLAGS := -Wmissing-declarations
|
||||
EXTRA_MODULE_CFLAGS := -Wmissing-prototypes
|
||||
EXTRA_MODULE_CPPFLAGS :=
|
||||
EXTRA_MODULE_ASMFLAGS :=
|
||||
|
||||
#GLOBAL_COMPILEFLAGS += -Wpacked
|
||||
#GLOBAL_COMPILEFLAGS += -Wpadded
|
||||
#GLOBAL_COMPILEFLAGS += -Winline
|
||||
|
||||
# if WERROR is set, add to the compile args
|
||||
ifeq (true,$(call TOBOOL,$(WERROR)))
|
||||
|
||||
@@ -5,4 +5,6 @@ MODULE := $(LOCAL_DIR)
|
||||
MODULE_SRCS += \
|
||||
$(LOCAL_DIR)/novm.c
|
||||
|
||||
MODULE_OPTIONS := extra_warnings
|
||||
|
||||
include make/module.mk
|
||||
|
||||
@@ -24,4 +24,6 @@ else
|
||||
MODULE_DEPS += kernel/novm
|
||||
endif
|
||||
|
||||
MODULE_OPTIONS := extra_warnings
|
||||
|
||||
include make/module.mk
|
||||
|
||||
@@ -8,4 +8,6 @@ MODULE_SRCS += \
|
||||
$(LOCAL_DIR)/vm.c \
|
||||
$(LOCAL_DIR)/vmm.c \
|
||||
|
||||
MODULE_OPTIONS := extra_warnings
|
||||
|
||||
include make/module.mk
|
||||
|
||||
@@ -26,6 +26,8 @@ MODULE_FLOAT_SRCS += \
|
||||
|
||||
MODULE_COMPILEFLAGS += -fno-builtin
|
||||
|
||||
MODULE_OPTIONS := extra_warnings
|
||||
|
||||
include $(LOCAL_DIR)/string/rules.mk
|
||||
|
||||
include make/module.mk
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
# MODULE_OPTIONS : space delimited list of options
|
||||
# currently defined options:
|
||||
# extra_warnings - add additional warnings to the front of the module deps
|
||||
# float - module uses floating point instructions/code
|
||||
|
||||
# the minimum module rules.mk file is as follows:
|
||||
@@ -55,13 +56,30 @@ GLOBAL_INCLUDES += $(MODULE_SRCDIR)/include
|
||||
MODULES += $(MODULE_DEPS)
|
||||
|
||||
# parse options
|
||||
ifeq ($(filter float,$(MODULE_OPTIONS)),float)
|
||||
MODULE_OPTIONS_COPY := $(sort $(MODULE_OPTIONS))
|
||||
ifneq (,$(findstring float,$(MODULE_OPTIONS)))
|
||||
# floating point option just forces all files in the module to be
|
||||
# compiled with floating point compiler flags.
|
||||
$(info MODULE $(MODULE) has float option)
|
||||
#$(info MODULE $(MODULE) has float option)
|
||||
MODULE_FLOAT_SRCS := $(sort $(MODULE_FLOAT_SRCS) $(MODULE_SRCS))
|
||||
MODULE_SRCS :=
|
||||
MODULE_OPTIONS_COPY := $(filter-out float,$(MODULE_OPTIONS_COPY))
|
||||
endif
|
||||
ifneq (,$(findstring extra_warnings,$(MODULE_OPTIONS)))
|
||||
# add some extra warnings to the various module compiler switches.
|
||||
# add these extra switches first so it's possible for the rules.mk file
|
||||
# that invoked us to override with a -Wno-...
|
||||
MODULE_COMPILEFLAGS := $(EXTRA_MODULE_COMPILEFLAGS) $(MODULE_COMPILEFLAGS)
|
||||
MODULE_CFLAGS := $(EXTRA_MODULE_CFLAGS) $(MODULE_CFLAGS)
|
||||
MODULE_CPPFLAGS := $(EXTRA_MODULE_CPPFLAGS) $(MODULE_CPPFLAGS)
|
||||
MODULE_ASMFLAGS := $(EXTRA_MODULE_ASMFLAGS) $(MODULE_ASMFLAGS)
|
||||
MODULE_OPTIONS_COPY := $(filter-out extra_warnings,$(MODULE_OPTIONS_COPY))
|
||||
endif
|
||||
|
||||
ifneq ($(MODULE_OPTIONS_COPY),)
|
||||
$(error MODULE $(MODULE) has unrecognized option(s) $(MODULE_OPTIONS_COPY))
|
||||
endif
|
||||
|
||||
|
||||
#$(info module $(MODULE))
|
||||
#$(info MODULE_COMPILEFLAGS = $(MODULE_COMPILEFLAGS))
|
||||
|
||||
@@ -8,6 +8,8 @@ MODULE_SRCS += \
|
||||
$(LOCAL_DIR)/init.c \
|
||||
$(LOCAL_DIR)/power.c
|
||||
|
||||
MODULE_OPTIONS := extra_warnings
|
||||
|
||||
include make/module.mk
|
||||
|
||||
|
||||
|
||||
@@ -5,5 +5,7 @@ MODULE := $(LOCAL_DIR)
|
||||
MODULE_SRCS += \
|
||||
$(LOCAL_DIR)/init.c
|
||||
|
||||
MODULE_OPTIONS := extra_warnings
|
||||
|
||||
include make/module.mk
|
||||
|
||||
|
||||
@@ -14,4 +14,6 @@ MODULE_SRCS := \
|
||||
$(LOCAL_DIR)/init.c \
|
||||
$(LOCAL_DIR)/main.c \
|
||||
|
||||
MODULE_OPTIONS := extra_warnings
|
||||
|
||||
include make/module.mk
|
||||
|
||||
Reference in New Issue
Block a user