]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cpu-topo: fix -Wlogical-not-parentheses build with clang
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 19 Dec 2025 09:10:08 +0000 (10:10 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Fri, 19 Dec 2025 09:15:17 +0000 (10:15 +0100)
src/cpu_topo.c:1325:15: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
 1325 |                         } else if (!cpu_policy_conf.flags & CPU_POLICY_ONE_THREAD_PER_CORE)
      |                                    ^                      ~
src/cpu_topo.c:1325:15: note: add parentheses after the '!' to evaluate the bitwise operator first
 1325 |                         } else if (!cpu_policy_conf.flags & CPU_POLICY_ONE_THREAD_PER_CORE)
      |                                    ^
      |                                     (                                                     )
src/cpu_topo.c:1325:15: note: add parentheses around left hand side expression to silence this warning
 1325 |                         } else if (!cpu_policy_conf.flags & CPU_POLICY_ONE_THREAD_PER_CORE)
      |                                    ^
      |                                    (                     )
src/cpu_topo.c:1533:15: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
 1533 |                         } else if (!cpu_policy_conf.flags & CPU_POLICY_ONE_THREAD_PER_CORE)
      |                                    ^                      ~
src/cpu_topo.c:1533:15: note: add parentheses after the '!' to evaluate the bitwise operator first
 1533 |                         } else if (!cpu_policy_conf.flags & CPU_POLICY_ONE_THREAD_PER_CORE)
      |                                    ^
      |                                     (                                                     )
src/cpu_topo.c:1533:15: note: add parentheses around left hand side expression to silence this warning
 1533 |                         } else if (!cpu_policy_conf.flags & CPU_POLICY_ONE_THREAD_PER_CORE)
      |                                    ^
      |                                    (                     )

No backport needed.

src/cpu_topo.c

index f853fe693dd28f2d13a5f9ff87accc72eaf50953..2a2966cd4ce44f67106fcf1fb6cecf1cebe7dde7 100644 (file)
@@ -1322,7 +1322,7 @@ static int cpu_policy_group_by_cluster(int policy, int tmin, int tmax, int gmin,
                        if (!ha_cpuset_isset(&visited_tsid, ha_cpu_topo[cpu].ts_id)) {
                                cpu_count++;
                                ha_cpuset_set(&visited_tsid, ha_cpu_topo[cpu].ts_id);
-                       } else if (!cpu_policy_conf.flags & CPU_POLICY_ONE_THREAD_PER_CORE)
+                       } else if (!(cpu_policy_conf.flags & CPU_POLICY_ONE_THREAD_PER_CORE))
                                cpu_count++;
                }
 
@@ -1530,7 +1530,7 @@ static int cpu_policy_group_by_ccx(int policy, int tmin, int tmax, int gmin, int
                        if (!ha_cpuset_isset(&visited_tsid, ha_cpu_topo[cpu].ts_id)) {
                                cpu_count++;
                                ha_cpuset_set(&visited_tsid, ha_cpu_topo[cpu].ts_id);
-                       } else if (!cpu_policy_conf.flags & CPU_POLICY_ONE_THREAD_PER_CORE)
+                       } else if (!(cpu_policy_conf.flags & CPU_POLICY_ONE_THREAD_PER_CORE))
                                cpu_count++;
                }