-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>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ in this Software without prior written authorization from the X Consortium.
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <sal/types.h>
|
||||
|
||||
static void remove_dotdot( char * );
|
||||
static int isdot( char const * );
|
||||
static int isdotdot( char const * );
|
||||
@@ -128,7 +130,9 @@ struct inclist *inc_path(char *file, char *include, boolean dot, struct Includes
|
||||
*/
|
||||
if (!found)
|
||||
for (pp = includedirs; *pp; pp++) {
|
||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH /* sprintf (macOS 13 SDK) */
|
||||
sprintf(path, "%s/%s", *pp, include);
|
||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
||||
remove_dotdot(path);
|
||||
if ((exists_path(incCollection, path)) && stat(path, &st) == 0 && !(st.st_mode & S_IFDIR)) {
|
||||
ip = newinclude(path, include);
|
||||
|
||||
@@ -29,6 +29,9 @@ in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
#include "def.h"
|
||||
#include <string.h>
|
||||
|
||||
#include <sal/types.h>
|
||||
|
||||
static size_t pr( struct inclist *ip, char *file,char *base);
|
||||
|
||||
extern int width;
|
||||
@@ -117,8 +120,10 @@ size_t pr(struct inclist *ip, char *file, char *base)
|
||||
len = (int)strlen(ip->i_file)+4;
|
||||
if (file != lastfile) {
|
||||
lastfile = file;
|
||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH /* sprintf (macOS 13 SDK) */
|
||||
sprintf(buf, "\n%s%s%s: \\\n %s", objprefix, base, objsuffix,
|
||||
ip->i_file);
|
||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
||||
len = (int)strlen(buf);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user