Skip to contentSkip to conversation

Makefile: do not pass non-c++ warning options to g++

PATCH Applied Haozhong Zhang 2 participants 2 messages Sep 9, 2019 – Sep 10, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: do not pass non-c++ warning options to g++

From: Haozhong Zhang <[email protected]>

-Wmissing-prototypes and -Wstrict-prototypes are C and Obj-C only
warning options. If passing them to g++ (e.g., when compiling api/),
following warning messages will be produced:
cc1plus: warning: command line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++[enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]

Move those options from COMMON_CFLAGS to CFLAGS so as to mute above warning messages.

---
 Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Makefile +1 -2
index 643af05..32414dc 100644
@@ -1,4 +1,3 @@
-
 SHELL := /usr/bin/env bash
 
 ifeq ($(wildcard config.mak),)
@@ -53,7 +52,6 @@ cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \
 COMMON_CFLAGS += -g $(autodepend-flags)
 COMMON_CFLAGS += -Wall -Wwrite-strings -Wclobbered -Wempty-body -Wuninitialized
 COMMON_CFLAGS += -Wignored-qualifiers -Wunused-but-set-parameter
-COMMON_CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
 COMMON_CFLAGS += -Werror
 frame-pointer-flag=-f$(if $(KEEP_FRAME_POINTER),no-,)omit-frame-pointer
 fomit_frame_pointer := $(call cc-option, $(frame-pointer-flag), "")
@@ -71,6 +69,7 @@ COMMON_CFLAGS += $(fno_pic) $(no_pie)
 
 CFLAGS += $(COMMON_CFLAGS)
 CFLAGS += -Wmissing-parameter-type -Wold-style-declaration -Woverride-init
+CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
 
 CXXFLAGS += $(COMMON_CFLAGS)
 
Signature · 1 line
2.23.0
maintainer Applied
#1 lore raw
Quoted 35 lines · Haozhong Zhang

From: Haozhong Zhang <[email protected]>

-Wmissing-prototypes and -Wstrict-prototypes are C and Obj-C only
warning options. If passing them to g++ (e.g., when compiling api/),
following warning messages will be produced:
cc1plus: warning: command line option ‘-Wmissing-prototypes’ is valid for C/ObjC but not for C++[enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]

Move those options from COMMON_CFLAGS to CFLAGS so as to mute above warning messages.

---
 Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Makefile +0 -2
index 643af05..32414dc 100644
@@ -1,4 +1,3 @@
-
 SHELL := /usr/bin/env bash
 
 ifeq ($(wildcard config.mak),)
@@ -53,7 +52,6 @@ cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \
 COMMON_CFLAGS += -g $(autodepend-flags)
 COMMON_CFLAGS += -Wall -Wwrite-strings -Wclobbered -Wempty-body -Wuninitialized
 COMMON_CFLAGS += -Wignored-qualifiers -Wunused-but-set-parameter
-COMMON_CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
 COMMON_CFLAGS += -Werror
 frame-pointer-flag=-f$(if $(KEEP_FRAME_POINTER),no-,)omit-frame-pointer
 fomit_frame_pointer := $(call cc-option, $(frame-pointer-flag), "")

Makefile COMMON_CFLAGS += $(fno_pic) $(no_pie) · line 75

Quoted 7 lines
Makefile +1 -0
@@ -71,6 +69,7 @@ COMMON_CFLAGS += $(fno_pic) $(no_pie)
 
 CFLAGS += $(COMMON_CFLAGS)
 CFLAGS += -Wmissing-parameter-type -Wold-style-declaration -Woverride-init
+CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
 
 CXXFLAGS += $(COMMON_CFLAGS)
 

Queued, thanks.

Paolo