summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-05-13 22:28:24 +0200
committerLennart Poettering <lennart@poettering.net>2018-05-17 09:54:36 -0700
commitd18cb3937bdc2efede153abce1cd8ddae941d762 (patch)
treefc85b7d3dcfea9ea6261b79d56bda058b1f76d5e /src
parent51b66c7a8a8afc8241373e864514d5ac7b87f169 (diff)
downloadsystemd-d18cb3937bdc2efede153abce1cd8ddae941d762.tar.gz
Turn VALGRIND variable into a meson configuration switch
Configuration through environment variable is inconvenient with meson, because they cannot be convieniently changed and/or are not preserved during reconfiguration (https://github.com/mesonbuild/meson/issues/1503). This adds -Dvalgrind=true/false, which has the advantage that it can be set at any time with meson configure -Dvalgrind=... and ninja will rebuild targets as necessary. Additional minor advantages are better consistency with the options for hashmap debugging, and typo avoidance with '#if' instead of '#ifdef'.
Diffstat (limited to 'src')
-rw-r--r--src/basic/hashmap.c2
-rw-r--r--src/basic/mempool.c2
-rw-r--r--src/basic/mempool.h2
-rw-r--r--src/journal/lookup3.c12
-rw-r--r--src/libsystemd-network/test-dhcp-client.c2
5 files changed, 10 insertions, 10 deletions
diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c
index a53d78c417..cf51167c1a 100644
--- a/src/basic/hashmap.c
+++ b/src/basic/hashmap.c
@@ -281,7 +281,7 @@ static const struct hashmap_type_info hashmap_type_info[_HASHMAP_TYPE_MAX] = {
},
};
-#ifdef VALGRIND
+#if VALGRIND
__attribute__((destructor)) static void cleanup_pools(void) {
_cleanup_free_ char *t = NULL;
int r;
diff --git a/src/basic/mempool.c b/src/basic/mempool.c
index 4be4a3d38e..2e55639e82 100644
--- a/src/basic/mempool.c
+++ b/src/basic/mempool.c
@@ -76,7 +76,7 @@ void mempool_free_tile(struct mempool *mp, void *p) {
mp->freelist = p;
}
-#ifdef VALGRIND
+#if VALGRIND
void mempool_drop(struct mempool *mp) {
struct pool *p = mp->first_pool;
diff --git a/src/basic/mempool.h b/src/basic/mempool.h
index 5322fd480d..68249cd881 100644
--- a/src/basic/mempool.h
+++ b/src/basic/mempool.h
@@ -30,6 +30,6 @@ static struct mempool pool_name = { \
}
-#ifdef VALGRIND
+#if VALGRIND
void mempool_drop(struct mempool *mp);
#endif
diff --git a/src/journal/lookup3.c b/src/journal/lookup3.c
index ec241d2f36..ff194dd951 100644
--- a/src/journal/lookup3.c
+++ b/src/journal/lookup3.c
@@ -315,11 +315,11 @@ uint32_t jenkins_hashlittle( const void *key, size_t length, uint32_t initval)
* then masks off the part it's not allowed to read. Because the
* string is aligned, the masked-off tail is in the same word as the
* rest of the string. Every machine with memory protection I've seen
- * does it on word boundaries, so is OK with this. But VALGRIND will
+ * does it on word boundaries, so is OK with this. But valgrind will
* still catch it and complain. The masking trick does make the hash
* noticeably faster for short strings (like English words).
*/
-#if !defined(VALGRIND) && !defined(__SANITIZE_ADDRESS__)
+#if !VALGRIND && !defined(__SANITIZE_ADDRESS__)
switch(length)
{
@@ -500,11 +500,11 @@ void jenkins_hashlittle2(
* then masks off the part it's not allowed to read. Because the
* string is aligned, the masked-off tail is in the same word as the
* rest of the string. Every machine with memory protection I've seen
- * does it on word boundaries, so is OK with this. But VALGRIND will
+ * does it on word boundaries, so is OK with this. But valgrind will
* still catch it and complain. The masking trick does make the hash
* noticeably faster for short strings (like English words).
*/
-#if !defined(VALGRIND) && !defined(__SANITIZE_ADDRESS__)
+#if !VALGRIND && !defined(__SANITIZE_ADDRESS__)
switch(length)
{
@@ -676,11 +676,11 @@ uint32_t jenkins_hashbig( const void *key, size_t length, uint32_t initval)
* then shifts out the part it's not allowed to read. Because the
* string is aligned, the illegal read is in the same word as the
* rest of the string. Every machine with memory protection I've seen
- * does it on word boundaries, so is OK with this. But VALGRIND will
+ * does it on word boundaries, so is OK with this. But valgrind will
* still catch it and complain. The masking trick does make the hash
* noticeably faster for short strings (like English words).
*/
-#if !defined(VALGRIND) && !defined(__SANITIZE_ADDRESS__)
+#if !VALGRIND && !defined(__SANITIZE_ADDRESS__)
switch(length)
{
diff --git a/src/libsystemd-network/test-dhcp-client.c b/src/libsystemd-network/test-dhcp-client.c
index 98e8a7e25a..7aa121b85c 100644
--- a/src/libsystemd-network/test-dhcp-client.c
+++ b/src/libsystemd-network/test-dhcp-client.c
@@ -539,7 +539,7 @@ int main(int argc, char *argv[]) {
test_discover_message(e);
test_addr_acq(e);
-#ifdef VALGRIND
+#if VALGRIND
/* Make sure the async_close thread has finished.
* valgrind would report some of the phread_* structures
* as not cleaned up properly. */