kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] Makefile: do not pass non-c++ warning options to g++
@ 2019-09-09 23:28 Haozhong Zhang
  2019-09-10 14:42 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Haozhong Zhang @ 2019-09-09 23:28 UTC (permalink / raw)
  To: pbonzini, rkrcmar; +Cc: kvm, Haozhong Zhang, Haozhong Zhang

From: Haozhong Zhang <hzhongzhang@tencent.com>

-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.

Signed-off-by: Haozhong Zhang <hzhongzhang@tencent.com>
---
 Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 643af05..32414dc 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
 
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [kvm-unit-tests PATCH] Makefile: do not pass non-c++ warning options to g++
  2019-09-09 23:28 [kvm-unit-tests PATCH] Makefile: do not pass non-c++ warning options to g++ Haozhong Zhang
@ 2019-09-10 14:42 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2019-09-10 14:42 UTC (permalink / raw)
  To: Haozhong Zhang, rkrcmar; +Cc: kvm, Haozhong Zhang

On 10/09/19 01:28, Haozhong Zhang wrote:
> From: Haozhong Zhang <hzhongzhang@tencent.com>
> 
> -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.
> 
> Signed-off-by: Haozhong Zhang <hzhongzhang@tencent.com>
> ---
>  Makefile | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 643af05..32414dc 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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)
>  
> 

Queued, thanks.

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-10 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09 23:28 [kvm-unit-tests PATCH] Makefile: do not pass non-c++ warning options to g++ Haozhong Zhang
2019-09-10 14:42 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).