]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: cpuset: do not use const on the source of CPU_AND/CPU_ASSIGN
authorWilly Tarreau <w@1wt.eu>
Fri, 28 Jan 2022 08:10:52 +0000 (09:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 28 Jan 2022 18:04:02 +0000 (19:04 +0100)
The man page indicates that CPU_AND() and CPU_ASSIGN() take a variable,
not a const on the source, even though it doesn't make much sense. But
with older libcs, this triggers a build warning:

  src/cpuset.c: In function 'ha_cpuset_and':
  src/cpuset.c:53: warning: initialization discards qualifiers from pointer target type
  src/cpuset.c: In function 'ha_cpuset_assign':
  src/cpuset.c:101: warning: initialization discards qualifiers from pointer target type

Better stick stricter to the documented API as this is really harmless
here. There's no need to backport it (unless build issues are reported,
which is quite unlikely).

include/haproxy/cpuset.h
src/cpuset.c

index 390115bcdbb4f4940cd6d4a3e7b33b00a4f1e8de..c9226f113add3e0e7da521ee4782d7de9875eb61 100644 (file)
@@ -21,7 +21,7 @@ int ha_cpuset_clr(struct hap_cpuset *set, int cpu);
 
 /* Bitwise and equivalent operation between <src> and <dst> stored in <dst>.
  */
-void ha_cpuset_and(struct hap_cpuset *dst, const struct hap_cpuset *src);
+void ha_cpuset_and(struct hap_cpuset *dst, struct hap_cpuset *src);
 
 /* Returns the count of set index in <set>.
  */
@@ -35,7 +35,7 @@ int ha_cpuset_ffs(const struct hap_cpuset *set);
 
 /* Copy <src> set into <dst>.
  */
-void ha_cpuset_assign(struct hap_cpuset *dst, const struct hap_cpuset *src);
+void ha_cpuset_assign(struct hap_cpuset *dst, struct hap_cpuset *src);
 
 /* Returns the biggest index plus one usable on the platform.
  */
index c1632c5e46c0fb487cc287e15c99c960bd9ba6fd..f7b66020ed01a0026eabb95930d656fa312f64cb 100644 (file)
@@ -47,7 +47,7 @@ int ha_cpuset_clr(struct hap_cpuset *set, int cpu)
 #endif
 }
 
-void ha_cpuset_and(struct hap_cpuset *dst, const struct hap_cpuset *src)
+void ha_cpuset_and(struct hap_cpuset *dst, struct hap_cpuset *src)
 {
 #if defined(CPUSET_USE_CPUSET)
        CPU_AND(&dst->cpuset, &dst->cpuset, &src->cpuset);
@@ -94,7 +94,7 @@ int ha_cpuset_ffs(const struct hap_cpuset *set)
 #endif
 }
 
-void ha_cpuset_assign(struct hap_cpuset *dst, const struct hap_cpuset *src)
+void ha_cpuset_assign(struct hap_cpuset *dst, struct hap_cpuset *src)
 {
 #if defined(CPUSET_USE_CPUSET)
        CPU_ZERO(&dst->cpuset);