summaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/hashmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/bpf/hashmap.h')
-rw-r--r--tools/lib/bpf/hashmap.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/lib/bpf/hashmap.h b/tools/lib/bpf/hashmap.h
index 3fe647477bad..0a5bf1937a7c 100644
--- a/tools/lib/bpf/hashmap.h
+++ b/tools/lib/bpf/hashmap.h
@@ -123,7 +123,8 @@ enum hashmap_insert_strategy {
};
#define hashmap_cast_ptr(p) ({ \
- _Static_assert((p) == NULL || sizeof(*(p)) == sizeof(long), \
+ _Static_assert((__builtin_constant_p((p)) ? (p) == NULL : 0) || \
+ sizeof(*(p)) == sizeof(long), \
#p " pointee should be a long-sized integer or a pointer"); \
(long *)(p); \
})