From 6f8da5f4b86a679143d6f6b99e8cfcc1f19a0593 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sun, 23 Oct 2022 14:00:08 -0400 Subject: [PATCH] * src/rule.c (get_rule_defn): Don't use STRING_SIZE_TUPLE in mempcpy If mempcpy() is a macro then STRING_SIZE_TUPLE won't compile. --- src/makeint.h | 2 ++ src/rule.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/makeint.h b/src/makeint.h index e345011b..c726abe0 100644 --- a/src/makeint.h +++ b/src/makeint.h @@ -495,6 +495,8 @@ extern struct rlimit stack_limit; /* Number of characters in a string constant. Does NOT include the \0 byte. */ #define CSTRLEN(_s) (sizeof (_s)-1) + +/* Only usable when NOT calling a macro: only use it for local functions. */ #define STRING_SIZE_TUPLE(_s) (_s), CSTRLEN(_s) /* The number of bytes needed to represent the largest signed and unsigned diff --git a/src/rule.c b/src/rule.c index a1f9ef32..0fc64bc8 100644 --- a/src/rule.c +++ b/src/rule.c @@ -94,7 +94,7 @@ get_rule_defn (struct rule *r) if (dep->ignore_mtime == 0) { if (dep->wait_here) - p = mempcpy (p, STRING_SIZE_TUPLE (" .WAIT")); + p = mempcpy (p, " .WAIT", CSTRLEN (" .WAIT")); p = mempcpy (mempcpy (p, " ", 1), dep_name (dep), strlen (dep_name (dep))); } @@ -107,7 +107,7 @@ get_rule_defn (struct rule *r) { p = mempcpy (p, sep, strlen (sep)); if (ood->wait_here) - p = mempcpy (p, STRING_SIZE_TUPLE (".WAIT ")); + p = mempcpy (p, ".WAIT ", CSTRLEN (".WAIT ")); p = mempcpy (p, dep_name (ood), strlen (dep_name (ood))); } *p = '\0';