fix using warning options with compilers which do not support them - fixes #363

Wed, 17 Jan 2024 21:01:50 +0100

author
Mike Becker <universe@uap-core.de>
date
Wed, 17 Jan 2024 21:01:50 +0100
changeset 814
5f9e07d3dd6c
parent 813
aba6d37b78bd
child 815
b0c4750cecd8

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
     1.1 --- a/src/cx/test.h	Tue Jan 16 23:43:27 2024 +0100
     1.2 +++ b/src/cx/test.h	Wed Jan 17 21:01:50 2024 +0100
     1.3 @@ -86,6 +86,11 @@
     1.4  #define __FUNCTION__ __func__
     1.5  #endif
     1.6  
     1.7 +//
     1.8 +#if !defined(__clang__) && __GNUC__ > 3
     1.9 +#pragma GCC diagnostic ignored "-Wclobbered"
    1.10 +#endif
    1.11 +
    1.12  #ifndef UCX_COMMON_H
    1.13  /**
    1.14   * Function pointer compatible with fwrite-like functions.
     2.1 --- a/tests/Makefile	Tue Jan 16 23:43:27 2024 +0100
     2.2 +++ b/tests/Makefile	Wed Jan 17 21:01:50 2024 +0100
     2.3 @@ -23,7 +23,7 @@
     2.4  
     2.5  include ../config.mk
     2.6  
     2.7 -CFLAGS += -I../src -Wno-clobbered
     2.8 +CFLAGS += -I../src
     2.9  
    2.10  TEST_DIR=$(build_dir)/tests
    2.11  
     3.1 --- a/tests/util_allocator.c	Tue Jan 16 23:43:27 2024 +0100
     3.2 +++ b/tests/util_allocator.c	Wed Jan 17 21:01:50 2024 +0100
     3.3 @@ -83,12 +83,16 @@
     3.4              data->alloc_failed++;
     3.5          } else {
     3.6              data->free_total++;
     3.7 +#if !defined(__clang__) && __GNUC__ > 11
     3.8  #pragma GCC diagnostic push
     3.9  #pragma GCC diagnostic ignored "-Wuse-after-free"
    3.10 +#endif
    3.11              if (!cx_testing_allocator_untrack(data, mem)) {
    3.12                  data->free_failed++;
    3.13              }
    3.14 +#if !defined(__clang__) && __GNUC__ > 11
    3.15  #pragma GCC diagnostic pop
    3.16 +#endif
    3.17              cx_testing_allocator_track(data, ptr);
    3.18          }
    3.19          return ptr;

mercurial