summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2026-04-07 14:04:08 +0200
committerThomas Weißschuh <linux@weissschuh.net>2026-05-03 16:37:13 +0200
commitd4534e087311523bafd164eb5437cefa1d6097d0 (patch)
tree365df2b000e825860260406317ef52324529b177
parent97d6655082757fe9ce39e110e7853127a0840542 (diff)
selftests/nolibc: avoid function pointer comparisons
The upcoming parisc support would require libgcc to implement function pointer comparisons. As we try to avoid the libgcc dependency rework the logic to work without such comparisons. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260428-nolibc-hppa-v5-1-d843d573111a@weissschuh.net
-rw-r--r--tools/testing/selftests/nolibc/nolibc-test.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 08610cacf030..1db6e8d55c16 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -649,20 +649,25 @@ int expect_str_buf_eq(size_t expr, const char *buf, size_t val, int llen, const
return 0;
}
+enum strtox_func {
+ strtox_func_strtol,
+ strtox_func_strtoul,
+};
+
#define EXPECT_STRTOX(cond, func, input, base, expected, chars, expected_errno) \
- do { if (!(cond)) result(llen, SKIPPED); else ret += expect_strtox(llen, func, input, base, expected, chars, expected_errno); } while (0)
+ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_strtox(llen, strtox_func_ ## func, input, base, expected, chars, expected_errno); } while (0)
static __attribute__((unused))
-int expect_strtox(int llen, void *func, const char *input, int base, intmax_t expected, int expected_chars, int expected_errno)
+int expect_strtox(int llen, enum strtox_func func, const char *input, int base, intmax_t expected, int expected_chars, int expected_errno)
{
char *endptr;
int actual_errno, actual_chars;
intmax_t r;
errno = 0;
- if (func == strtol) {
+ if (func == strtox_func_strtol) {
r = strtol(input, &endptr, base);
- } else if (func == strtoul) {
+ } else if (func == strtox_func_strtoul) {
r = strtoul(input, &endptr, base);
} else {
result(llen, FAIL);