From: Ilia Shipitsin Date: Sat, 25 Apr 2026 11:04:48 +0000 (+0200) Subject: CLEANUP: src/cpuset.c: fix missing return in functions returning int X-Git-Url: http://www.kaiwu.me/postgresql/commit//%22%22?a=commitdiff_plain;h=d9a7ff9b6c2b1dbbcb3ef1532ec3d38259638537;p=haproxy.git 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:100: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. --- diff --git a/src/cpuset.c b/src/cpuset.c index f85c31b9c..34dce9202 100644 --- a/src/cpuset.c +++ b/src/cpuset.c @@ -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 }