summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAzat Khuzhin <azat@libevent.org>2022-07-09 17:14:12 +0300
committerAzat Khuzhin <azat@libevent.org>2022-07-09 17:36:13 +0300
commit89332176982b50f6469a0e760d05625f859099ef (patch)
tree4f5d4136da448049c665d0290c65c2246fc31e64 /test
parent648af99afa490bcccbba64dc01af2b27002e96e5 (diff)
downloadlibevent-89332176982b50f6469a0e760d05625f859099ef.tar.gz
test: ignore -Walloc-size-larger-than error for calloc() returns ENOMEM
Compiler report: /home/runner/work/libevent/libevent/test/regress_util.c: In function ‘test_event_calloc’: /home/runner/work/libevent/libevent/test/regress_util.c:1318:4: error: argument 2 value ‘9223372036854775815’ exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=] p = mm_calloc(EV_SIZE_MAX/2, EV_SIZE_MAX/2 + 8); In file included from /home/runner/work/libevent/libevent/test/../util-internal.h:37:0, from /home/runner/work/libevent/libevent/test/regress_util.c:30: /usr/include/stdlib.h:541:14: note: in a call to allocation function ‘calloc’ declared here extern void *calloc (size_t __nmemb, size_t __size) v2: clang on CI does not have this option
Diffstat (limited to 'test')
-rw-r--r--test/regress_util.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/regress_util.c b/test/regress_util.c
index 1f919fe8..95234180 100644
--- a/test/regress_util.c
+++ b/test/regress_util.c
@@ -1315,7 +1315,16 @@ test_event_calloc(void *arg)
/* mm_calloc() should set errno = ENOMEM and return NULL
* in case of potential overflow. */
errno = 0;
- p = mm_calloc(EV_SIZE_MAX/2, EV_SIZE_MAX/2 + 8);
+#if defined(__clang__)
+#elif defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Walloc-size-larger-than="
+#endif
+ p = mm_calloc(EV_SIZE_MAX, EV_SIZE_MAX);
+#if defined(__clang__)
+#elif defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
tt_assert(p == NULL);
tt_int_op(errno, ==, ENOMEM);