[systemd-devel] [PATCH] fix scan-build issues

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Mon Dec 9 20:37:03 PST 2013


On Mon, Dec 09, 2013 at 09:01:08PM +0100, Thomas H.P. Andersen wrote:
> From: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
> 
> The static analyzer scan-build had a few issues with analysing
> parts of systemd.
> 
> gpt-auto-generator.c:
> scan-build could not find blkid.h. Whether it should be blkid.h or
> blkid/blkid.h seems to depend on the version used. We already use
> blkid/blkid.h in udev-builtin-blkid.c so it seems safe to use that
> here too.
Looks reasonable.

> Makefile.am:
> Moved some -D's from CFLAGS to CPPFLAGS. I also simplified them a
> bit and got rid of a left over DBUS_CFLAGS.
I think that this breaks compilation if the directory has
spaces in the name. Not a big deal, but as a matter of principle
we should do it right. I think that

    -DTEST_DIR='"$(top_srcdir)/test"' should work. 

(We also don't need "top_", because almost everything is done from
the same srcdir, udev docs being the exeption).

Zbyszek

> ---
>  Makefile.am                                 | 22 ++++++++++++----------
>  src/gpt-auto-generator/gpt-auto-generator.c |  2 +-
>  2 files changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 7bedd76..e90e7ed 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -1349,10 +1349,9 @@ test_cgroup_LDADD = \
>  test_cgroup_mask_SOURCES = \
>  	src/test/test-cgroup-mask.c
>  
> -test_cgroup_mask_CFLAGS = \
> -	$(AM_CFLAGS) \
> -	$(DBUS_CFLAGS) \
> -	-D"STR(s)=\#s" -D"TEST_DIR=STR($(abs_top_srcdir)/test/)"
> +test_cgroup_mask_CPPFLAGS = \
> +	$(AM_CPPFLAGS) \
> +	-DTEST_DIR=\"$(abs_top_srcdir)/test\"
>  
>  test_cgroup_mask_LDADD = \
>  	libsystemd-core.la \
> @@ -1416,9 +1415,9 @@ test_watchdog_LDADD = \
>  test_sched_prio_SOURCES = \
>  	src/test/test-sched-prio.c
>  
> -test_sched_prio_CFLAGS = \
> -	$(AM_CFLAGS) \
> -	-D"STR(s)=\#s" -D"TEST_DIR=STR($(abs_top_srcdir)/test/)"
> +test_sched_prio_CPPFLAGS = \
> +	$(AM_CPPFLAGS) \
> +	-DTEST_DIR=\"$(abs_top_srcdir)/test\"
>  
>  test_sched_prio_LDADD = \
>  	libsystemd-core.la \
> @@ -3054,8 +3053,8 @@ test_mmap_cache_LDADD = \
>  test_catalog_SOURCES = \
>  	src/journal/test-catalog.c
>  
> -test_catalog_CFLAGS = \
> -	$(AM_CFLAGS) \
> +test_catalog_CPPFLAGS = \
> +	$(AM_CPPFLAGS) \
>  	-DCATALOG_DIR=\"$(abs_top_srcdir)/catalog\"
>  
>  test_catalog_LDADD = \
> @@ -3313,9 +3312,12 @@ systemd_journal_gatewayd_LDADD = \
>  
>  systemd_journal_gatewayd_CFLAGS = \
>  	$(AM_CFLAGS) \
> -	-DDOCUMENT_ROOT=\"$(gatewayddocumentrootdir)\" \
>  	$(MICROHTTPD_CFLAGS)
>  
> +systemd_journal_gatewayd_CPPFLAGS = \
> +	$(AM_CPPFLAGS) \
> +	-DDOCUMENT_ROOT=\"$(gatewayddocumentrootdir)\"
> +
>  dist_systemunit_DATA += \
>  	units/systemd-journal-gatewayd.socket
>  
> diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
> index 3cbafa4..017c35d 100644
> --- a/src/gpt-auto-generator/gpt-auto-generator.c
> +++ b/src/gpt-auto-generator/gpt-auto-generator.c
> @@ -24,7 +24,7 @@
>  #include <fcntl.h>
>  #include <sys/ioctl.h>
>  #include <sys/statfs.h>
> -#include <blkid.h>
> +#include <blkid/blkid.h>
>  
>  #ifdef HAVE_LINUX_BTRFS_H
>  #include <linux/btrfs.h>
> -- 
> 1.8.4.2
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 


More information about the systemd-devel mailing list