Paul Eggert wrote: > +#if defined __APPLE__ && defined __MACH__ && _GL_GNUC_PREREQ (4, 2) > +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" > +#endif
I see some more warnings of the same kind: ../../gltests/test-execute-child.c:186:15: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] ../../gltests/test-statat.c:26:18: warning: 'statat' is deprecated [-Wdeprecated-declarations] ../../gltests/test-statat.c:27:18: warning: 'lstatat' is deprecated [-Wdeprecated-declarations] ../../gltests/test-fstatat.c:51:10: warning: 'statat' is deprecated [-Wdeprecated-declarations] ../../gltests/test-fstatat.c:62:10: warning: 'lstatat' is deprecated [-Wdeprecated-declarations] This patch should handle them (with gcc; clang is not included on purpose). 2024-11-20 Bruno Haible <br...@clisp.org> 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. 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