[systemd-devel] [PATCH] fix scan-build issues
Thomas H.P. Andersen
phomes at gmail.com
Tue Dec 10 13:17:33 PST 2013
On Tue, Dec 10, 2013 at 1:48 PM, Zbigniew Jędrzejewski-Szmek
<zbyszek at in.waw.pl> wrote:
> On Tue, Dec 10, 2013 at 01:44:02PM +0100, Thomas H.P. Andersen wrote:
>> >> 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.
>> I do not know how to validate this. Maybe we should just move it from
>> CFLAGS to CPPFLAGS without changing it and leave that for a separate
>> patch?
> I'm pretty sure it's fine as proposed, but to test it: run make V=1,
> and copy the gcc invocation line, replace '-c -o ...' with -E, and
> look at the output. I think it doesn't make sense to do a separate
> patch to touch all the same lines.
Thanks.
I have tested it and my patch works just as well as the current code.
By just as well I mean just as bad. For e.g. the test-cgroup-mask.c
the line we are replacing TEST_DIR in is:
assert_se(set_unit_path(TEST_DIR) >= 0);
The result of both my patch and the current code is:
do { if ((__builtin_expect(!!(!(set_unit_path("/home/phomes/systemd/test/")
>= 0)),0))) log_assert_failed("set_unit_path(TEST_DIR) >= 0",
"src/test/test-cgroup-mask.c", 42, __PRETTY_FUNCTION__); } while (0);
I have added a variable "const char *dir = TEST_DIR" and use that dir
variable instead.
More information about the systemd-devel
mailing list