[libvirt] [PATCHv2] Split out -Wframe-larger-than warning from WARN_CLFAGS

Ján Tomko posted 1 patch 6 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/32de0d929167761d4fbeaa22b9cb93c3f40bf538.1491397371.git.jtomko@redhat.com
daemon/Makefile.am          | 2 ++
m4/virt-compile-warnings.m4 | 4 ++--
src/Makefile.am             | 2 ++
tests/Makefile.am           | 2 ++
tools/Makefile.am           | 2 ++
5 files changed, 10 insertions(+), 2 deletions(-)
[libvirt] [PATCHv2] Split out -Wframe-larger-than warning from WARN_CLFAGS
Posted by Ján Tomko 6 years, 11 months ago
Introduce STRICT_FRAME_LIMIT_CFLAGS that will be used for
the library code and RELAXED_FRAME_LIMIT_CFLAGS for daemon code
and the test code.

Raising the limit for tests allows building them with clang
with optimizations disabled.
---
v2:
* use the strict limit for tools and daemon too
* append the limit to WARN_CFLAGS once per Makefile

 daemon/Makefile.am          | 2 ++
 m4/virt-compile-warnings.m4 | 4 ++--
 src/Makefile.am             | 2 ++
 tests/Makefile.am           | 2 ++
 tools/Makefile.am           | 2 ++
 5 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 60c7368..d02ab33 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -31,6 +31,8 @@ INCLUDES = \
 
 CLEANFILES =
 
+WARN_CFLAGS += $(STRICT_FRAME_LIMIT_CFLAGS)
+
 DAEMON_GENERATED =			\
 		remote_dispatch.h	\
 		lxc_dispatch.h		\
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 17fdf9d..768a5c8 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -169,8 +169,8 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
     # This should be < 256 really. Currently we're down to 4096,
     # but using 1024 bytes sized buffers (mostly for virStrerror)
     # stops us from going down further
-    wantwarn="$wantwarn -Wframe-larger-than=4096"
-    dnl wantwarn="$wantwarn -Wframe-larger-than=256"
+    gl_WARN_ADD(["-Wframe-larger-than=4096"], [STRICT_FRAME_LIMIT_CFLAGS])
+    gl_WARN_ADD(["-Wframe-larger-than=25600"], [RELAXED_FRAME_LIMIT_CFLAGS])
 
     # Extra special flags
     dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
diff --git a/src/Makefile.am b/src/Makefile.am
index 75e4344..3c7adae 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,6 +37,8 @@ INCLUDES =	-I../gnulib/lib					\
 		-Dabs_topsrcdir="\"$(abs_topsrcdir)\""		\
 		$(GETTEXT_CPPFLAGS)
 
+WARN_CFLAGS += $(STRICT_FRAME_LIMIT_CFLAGS)
+
 AM_CFLAGS =	$(LIBXML_CFLAGS)				\
 		$(WARN_CFLAGS)					\
 		$(LOCK_CHECKING_CFLAGS)				\
diff --git a/tests/Makefile.am b/tests/Makefile.am
index aa9d2eb..279e9b7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -33,6 +33,8 @@ INCLUDES = \
 	-I$(top_srcdir)/src/conf \
 	$(GETTEXT_CPPFLAGS)
 
+WARN_CFLAGS += $(RELAXED_FRAME_LIMIT_CFLAGS)
+
 AM_CFLAGS = \
 	-Dabs_builddir="\"$(abs_builddir)\"" \
 	-Dabs_topbuilddir="\"$(abs_topbuilddir)\"" \
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 162d8e5..bfacaf2 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -23,6 +23,8 @@ INCLUDES = \
 	-I$(top_srcdir)						\
 	$(GETTEXT_CPPFLAGS)
 
+WARN_CFLAGS += $(STRICT_FRAME_LIMIT_CFLAGS)
+
 AM_LDFLAGS = \
 	$(RELRO_LDFLAGS)					\
 	$(NO_INDIRECT_LDFLAGS)					\
-- 
2.10.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv2] Split out -Wframe-larger-than warning from WARN_CLFAGS
Posted by Roman Bogorodskiy 6 years, 11 months ago
  Ján Tomko wrote:

> Introduce STRICT_FRAME_LIMIT_CFLAGS that will be used for
> the library code and RELAXED_FRAME_LIMIT_CFLAGS for daemon code
> and the test code.
> 
> Raising the limit for tests allows building them with clang
> with optimizations disabled.
> ---
> v2:
> * use the strict limit for tools and daemon too
 
The commit message needs to be updated as well as
RELAXED_FRAME_LIMIT_CFLAGS is not used for the daemon code anymore.

Other than that, it works for me and I'd love to get this in.

> * append the limit to WARN_CFLAGS once per Makefile
> 
>  daemon/Makefile.am          | 2 ++
>  m4/virt-compile-warnings.m4 | 4 ++--
>  src/Makefile.am             | 2 ++
>  tests/Makefile.am           | 2 ++
>  tools/Makefile.am           | 2 ++
>  5 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/daemon/Makefile.am b/daemon/Makefile.am
> index 60c7368..d02ab33 100644
> --- a/daemon/Makefile.am
> +++ b/daemon/Makefile.am
> @@ -31,6 +31,8 @@ INCLUDES = \
>  
>  CLEANFILES =
>  
> +WARN_CFLAGS += $(STRICT_FRAME_LIMIT_CFLAGS)
> +
>  DAEMON_GENERATED =			\
>  		remote_dispatch.h	\
>  		lxc_dispatch.h		\
> diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
> index 17fdf9d..768a5c8 100644
> --- a/m4/virt-compile-warnings.m4
> +++ b/m4/virt-compile-warnings.m4
> @@ -169,8 +169,8 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
>      # This should be < 256 really. Currently we're down to 4096,
>      # but using 1024 bytes sized buffers (mostly for virStrerror)
>      # stops us from going down further
> -    wantwarn="$wantwarn -Wframe-larger-than=4096"
> -    dnl wantwarn="$wantwarn -Wframe-larger-than=256"
> +    gl_WARN_ADD(["-Wframe-larger-than=4096"], [STRICT_FRAME_LIMIT_CFLAGS])
> +    gl_WARN_ADD(["-Wframe-larger-than=25600"], [RELAXED_FRAME_LIMIT_CFLAGS])
>  
>      # Extra special flags
>      dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 75e4344..3c7adae 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -37,6 +37,8 @@ INCLUDES =	-I../gnulib/lib					\
>  		-Dabs_topsrcdir="\"$(abs_topsrcdir)\""		\
>  		$(GETTEXT_CPPFLAGS)
>  
> +WARN_CFLAGS += $(STRICT_FRAME_LIMIT_CFLAGS)
> +
>  AM_CFLAGS =	$(LIBXML_CFLAGS)				\
>  		$(WARN_CFLAGS)					\
>  		$(LOCK_CHECKING_CFLAGS)				\
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index aa9d2eb..279e9b7 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -33,6 +33,8 @@ INCLUDES = \
>  	-I$(top_srcdir)/src/conf \
>  	$(GETTEXT_CPPFLAGS)
>  
> +WARN_CFLAGS += $(RELAXED_FRAME_LIMIT_CFLAGS)
> +
>  AM_CFLAGS = \
>  	-Dabs_builddir="\"$(abs_builddir)\"" \
>  	-Dabs_topbuilddir="\"$(abs_topbuilddir)\"" \
> diff --git a/tools/Makefile.am b/tools/Makefile.am
> index 162d8e5..bfacaf2 100644
> --- a/tools/Makefile.am
> +++ b/tools/Makefile.am
> @@ -23,6 +23,8 @@ INCLUDES = \
>  	-I$(top_srcdir)						\
>  	$(GETTEXT_CPPFLAGS)
>  
> +WARN_CFLAGS += $(STRICT_FRAME_LIMIT_CFLAGS)
> +
>  AM_LDFLAGS = \
>  	$(RELRO_LDFLAGS)					\
>  	$(NO_INDIRECT_LDFLAGS)					\
> -- 
> 2.10.2
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Roman Bogorodskiy
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv2] Split out -Wframe-larger-than warning from WARN_CLFAGS
Posted by Andrea Bolognani 6 years, 11 months ago
On Wed, 2017-04-05 at 15:04 +0200, Ján Tomko wrote:
> Introduce STRICT_FRAME_LIMIT_CFLAGS that will be used for
> the library code and RELAXED_FRAME_LIMIT_CFLAGS for daemon code
> and the test code.
> 
> Raising the limit for tests allows building them with clang
> with optimizations disabled.
> ---
> v2:
> * use the strict limit for tools and daemon too
> * append the limit to WARN_CFLAGS once per Makefile

ACK if you fix the commit message as Roman suggested.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list