Skip to content

Commit

Permalink
tests/umockdev: Avoid unknown warning option on older gcc
Browse files Browse the repository at this point in the history
According to https://gcc.gnu.org/wiki/StaticAnalyzer the
-Wanalyzer-malloc-leak and -Wanalyzer-file-leak options came in GCC 10.

When building with GCC 9 there would be warnings:

CC       umockdev-umockdev.o
../../libusb-git/tests/umockdev.c:37:32: error: unknown option after ‘#pragma GCC diagnostic’ kind [-Werror=pragmas]
   37 | #pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~
../../libusb-git/tests/umockdev.c:38:32: error: unknown option after ‘#pragma GCC diagnostic’ kind [-Werror=pragmas]
   38 | #pragma GCC diagnostic ignored "-Wanalyzer-file-leak"
      |                                ^~~~~~~~~~~~~~~~~~~~~~

Closes libusb#1369

Signed-off-by: Tormod Volden <[email protected]>
  • Loading branch information
tormodvolden committed Dec 9, 2023
1 parent dac541d commit 56cee16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libusb/version_nano.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define LIBUSB_NANO 11844
#define LIBUSB_NANO 11845
2 changes: 1 addition & 1 deletion tests/umockdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define UNUSED_DATA __attribute__ ((unused)) gconstpointer unused_data

/* avoid leak reports inside assertions; leaking stuff on assertion failures does not matter in tests */
#if !defined(__clang__)
#if !defined(__clang__) && __GNUC__ > 9
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
#pragma GCC diagnostic ignored "-Wanalyzer-file-leak"
#endif
Expand Down

0 comments on commit 56cee16

Please sign in to comment.