Wed, 17 Jan 2024 21:01:50 +0100
fix using warning options with compilers which do not support them - fixes #363
src/cx/test.h | file | annotate | diff | comparison | revisions | |
tests/Makefile | file | annotate | diff | comparison | revisions | |
tests/util_allocator.c | file | annotate | diff | comparison | revisions |
--- a/src/cx/test.h Tue Jan 16 23:43:27 2024 +0100 +++ b/src/cx/test.h Wed Jan 17 21:01:50 2024 +0100 @@ -86,6 +86,11 @@ #define __FUNCTION__ __func__ #endif +// +#if !defined(__clang__) && __GNUC__ > 3 +#pragma GCC diagnostic ignored "-Wclobbered" +#endif + #ifndef UCX_COMMON_H /** * Function pointer compatible with fwrite-like functions.
--- a/tests/Makefile Tue Jan 16 23:43:27 2024 +0100 +++ b/tests/Makefile Wed Jan 17 21:01:50 2024 +0100 @@ -23,7 +23,7 @@ include ../config.mk -CFLAGS += -I../src -Wno-clobbered +CFLAGS += -I../src TEST_DIR=$(build_dir)/tests
--- a/tests/util_allocator.c Tue Jan 16 23:43:27 2024 +0100 +++ b/tests/util_allocator.c Wed Jan 17 21:01:50 2024 +0100 @@ -83,12 +83,16 @@ data->alloc_failed++; } else { data->free_total++; +#if !defined(__clang__) && __GNUC__ > 11 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wuse-after-free" +#endif if (!cx_testing_allocator_untrack(data, mem)) { data->free_failed++; } +#if !defined(__clang__) && __GNUC__ > 11 #pragma GCC diagnostic pop +#endif cx_testing_allocator_track(data, ptr); } return ptr;