CLEANUP: src/cpuset.c: fix missing return in functions returning int

Cppcheck found the issue described in github #2124, which can cause these
errors if no CPUSET implementation is supported (and CPUSET_USE_ULONG is
not enabled):

src/cpuset.c:21:11: error: Found an exit path from function with non-void return type that has missing return statement [missingReturn]
src/cpuset.c:36:11: error: Found an exit path from function with non-void return type that has missing return statement [missingReturn]
src/cpuset.c💯1: error: Found an exit path from function with non-void return type that has missing return statement [missingReturn]
src/cpuset.c:124:1: error: Found an exit path from function with non-void return type that has missing return statement [missingReturn]
src/cpuset.c:152:1: error: Found an exit path from function with non-void return type that has missing return statement [missingReturn]
src/cpuset.c:163:1: error: Found an exit path from function with non-void return type that has missing return statement [missingReturn]

This can be backported.
This commit is contained in:
Ilia Shipitsin 2026-04-25 13:04:48 +02:00 committed by Willy Tarreau
parent e0144843a4
commit d9a7ff9b6c

View File

@ -27,6 +27,8 @@ int ha_cpuset_set(struct hap_cpuset *set, int cpu)
#elif defined(CPUSET_USE_ULONG)
set->cpuset |= (0x1 << cpu);
return 0;
#else
return 1;
#endif
}
@ -42,6 +44,8 @@ int ha_cpuset_clr(struct hap_cpuset *set, int cpu)
#elif defined(CPUSET_USE_ULONG)
set->cpuset &= ~(0x1 << cpu);
return 0;
#else
return 1;
#endif
}
@ -96,6 +100,8 @@ int ha_cpuset_count(const struct hap_cpuset *set)
#elif defined(CPUSET_USE_ULONG)
return my_popcountl(set->cpuset);
#else
return 0;
#endif
}
@ -120,6 +126,8 @@ int ha_cpuset_ffs(const struct hap_cpuset *set)
return 0;
return my_ffsl(set->cpuset);
#else
return 0;
#endif
}
@ -148,6 +156,8 @@ int ha_cpuset_isequal(const struct hap_cpuset *dst, const struct hap_cpuset *src
#elif defined(CPUSET_USE_ULONG)
return dst->cpuset == src->cpuset;
#else
return 0;
#endif
}
@ -158,7 +168,8 @@ int ha_cpuset_size()
#elif defined(CPUSET_USE_ULONG)
return LONGBITS;
#else
return 0;
#endif
}