diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-11-10 09:21:21 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-11-10 14:50:53 +0100 |
commit | 707449adc90c80e68176c8df873803ff2f6f70f2 (patch) | |
tree | e17c474098acb3f2cbfeb48742194399462feb69 /soltools/cpp | |
parent | 69eeb034b3722c91af2f39bd00874689906c0612 (diff) |
-Werror,-Wdeprecated-declarations (sprintf, macOS 13 SDK): soltools
These occurrences of sprintf in C code don't normally trigger the deprecation
warning at least with recent macOS, because macOS by default now enables
_FORTIFY_SOURCE (see the code setting it in
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/_types.h
when originally unset), which for C code hides the declaration of sprintf (along
with its deprecation annotation) in
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/stdio.h
with a macro (expanding to __builtin___sprintf_chk) in
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/secure/_stdio.h.
But they started to trigger when I did an experimental -fsanitize=address build,
because
<https://github.com/llvm/llvm-project/commit/b4f819086a61b5a843f0171a7467c5184ba1b086>
"Disable source fortification on Darwin with AddressSanitizer" predefines
-D_FORTIFY_SOURCE=0 in that case.
While there might be ways to clean this code up to use something better than the
deprecated sprintf, don't bother too much with this 3rd-party, build-time--only
code and just silence any potential deprecation warnings.
Change-Id: I9f223a0ad50b2729b5d9af2db588fe9f82d0b07f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142534
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'soltools/cpp')
-rw-r--r-- | soltools/cpp/_macro.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/soltools/cpp/_macro.c b/soltools/cpp/_macro.c index ef41b992edae..fbf496b8f781 100644 --- a/soltools/cpp/_macro.c +++ b/soltools/cpp/_macro.c @@ -27,6 +27,8 @@ #endif #include <limits.h> +#include <sal/types.h> + #include "cpp.h" #define NCONCAT 16384 @@ -143,7 +145,9 @@ void { if (cp != location) *cp++ = ' '; + SAL_WNODEPRECATED_DECLARATIONS_PUSH /* sprintf (macOS 13 SDK) */ sprintf((char *)cp, "%s:%d", s->filename, s->line); + SAL_WNODEPRECATED_DECLARATIONS_POP cp += strlen((char *)cp); } |