From 71e768d23030c4eb5c74ea4df9b8c63544be21fb Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 17 Jun 2016 09:36:51 -0400 Subject: [PATCH] build: Fix libreaddir-rand to honor global CFLAGS It's unfortunate that in automake one has to explicitly include the globa `$(AM_CFLAGS)` if one sets `CFLAGS`, and similarly for other variables. I'm trying to use `-fsanitize=address`, and not including it was causing linker failures. We also weren't inheriting the global warnings etc., so I had to fix a decl-after-statement. Closes: #351 Approved by: jlebon --- Makefile-tests.am | 4 ++-- tests/readdir-rand.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile-tests.am b/Makefile-tests.am index e5cf9554..80903071 100644 --- a/Makefile-tests.am +++ b/Makefile-tests.am @@ -137,12 +137,12 @@ endif test_ltlibraries = libreaddir-rand.la libreaddir_rand_la_SOURCES = tests/readdir-rand.c -libreaddir_rand_la_CFLAGS = $(OT_INTERNAL_GIO_UNIX_CFLAGS) +libreaddir_rand_la_CFLAGS = $(AM_CFLAGS) $(OT_INTERNAL_GIO_UNIX_CFLAGS) libreaddir_rand_la_LIBADD = \ -ldl \ $(OT_INTERNAL_GIO_UNIX_LIBS) \ $(NULL) -libreaddir_rand_la_LDFLAGS = -avoid-version +libreaddir_rand_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version if !ENABLE_INSTALLED_TESTS libreaddir_rand_la_LDFLAGS += -rpath $(abs_builddir) endif diff --git a/tests/readdir-rand.c b/tests/readdir-rand.c index ee43756f..afef387c 100644 --- a/tests/readdir-rand.c +++ b/tests/readdir-rand.c @@ -109,12 +109,12 @@ readdir (DIR *dirp) { if (g_random_boolean ()) { + struct dirent *copy; if (!de) { de = dir_entries_new (); g_hash_table_insert (direntcache, dirp, de); } - struct dirent *copy; copy = g_memdup (ret, sizeof (struct dirent)); g_ptr_array_add (de->entries, copy); }