]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix FreeBSD 14 build (#975)
authorDavid CARLIER <devnexen@gmail.com>
Mon, 7 Feb 2022 00:35:28 +0000 (00:35 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Tue, 8 Feb 2022 18:41:44 +0000 (07:41 +1300)
FreeBSD 14 defines 3-parameter CPU_AND() macro as a `do {} while` loop.
Our (void) in front of that loop creates a syntax error.

    CpuAffinitySet.cc:41:16: error: expected expression
    (void) CPU_AND(&cpuSet, &cpuSet, &theOrigCpuSet);

That (void) was added in commit 7ec6d51 to "remove GNU-specific syntax",
but we cannot tell what specific problem that 10-year old change solved.
Known 3-parameter CPU_AND(3) documentation says the call returns void.

src/CpuAffinitySet.cc

index 96f9faf37f855f7f3c1205784ca148fcb4eb9ae3..2d74d012b8b4cbae410e7badd861af40f9e754df 100644 (file)
@@ -38,7 +38,7 @@ CpuAffinitySet::apply()
     } else {
         cpu_set_t cpuSet;
         memcpy(&cpuSet, &theCpuSet, sizeof(cpuSet));
-        (void) CPU_AND(&cpuSet, &cpuSet, &theOrigCpuSet);
+        CPU_AND(&cpuSet, &cpuSet, &theOrigCpuSet);
         if (CPU_COUNT(&cpuSet) <= 0) {
             debugs(54, DBG_IMPORTANT, "ERROR: invalid CPU affinity for process "
                    "PID " << getpid() << ", may be caused by an invalid core in "