From 94f9a1e307861233f7016f85c861f37f767f2c88 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 20 Nov 2024 08:24:31 +0100 Subject: [PATCH] tests: Silence some more -Wdeprecated-declarations warnings. * tests/test-execute-child.c: Silence warning about sprintf. * tests/test-fstatat.c: Silence warnings about statat and lstatat. * tests/test-statat.c: Add comment. --- ChangeLog | 7 +++++++ tests/test-execute-child.c | 6 ++++++ tests/test-fstatat.c | 5 +++++ tests/test-statat.c | 1 + 4 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8cfb8d7102..80e8b85760 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-11-20 Bruno Haible + + tests: Silence some more -Wdeprecated-declarations warnings. + * tests/test-execute-child.c: Silence warning about sprintf. + * tests/test-fstatat.c: Silence warnings about statat and lstatat. + * tests/test-statat.c: Add comment. + 2024-11-19 Paul Eggert savewd: remove O_SEARCH optimization diff --git a/tests/test-execute-child.c b/tests/test-execute-child.c index cf76fbc4fd..05016eaae0 100644 --- a/tests/test-execute-child.c +++ b/tests/test-execute-child.c @@ -76,6 +76,12 @@ is_device (int fd) #undef strstr #undef write +/* macOS 12's "warning: 'sprintf' is deprecated" is pointless, + as sprintf is used safely here. */ +#if defined __APPLE__ && defined __MACH__ && _GL_GNUC_PREREQ (4, 2) +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + #include "qemu.h" #if HAVE_MSVC_INVALID_PARAMETER_HANDLER diff --git a/tests/test-fstatat.c b/tests/test-fstatat.c index 65c8010461..3981b09d9a 100644 --- a/tests/test-fstatat.c +++ b/tests/test-fstatat.c @@ -34,6 +34,11 @@ SIGNATURE_CHECK (fstatat, int, (int, char const *, struct stat *, int)); #include "ignore-value.h" #include "macros.h" +/* This program tests deprecated functions 'statat' and 'lstatat'. */ +#if _GL_GNUC_PREREQ (4, 3) +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + #ifndef BASE # define BASE "test-fstatat.t" #endif diff --git a/tests/test-statat.c b/tests/test-statat.c index 0576f8f204..7a4632729d 100644 --- a/tests/test-statat.c +++ b/tests/test-statat.c @@ -18,6 +18,7 @@ #include "openat.h" +/* This program tests deprecated functions 'statat' and 'lstatat'. */ #if _GL_GNUC_PREREQ (4, 3) # pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif -- 2.39.5