From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1698) id 8DC3C3858D20; Sat, 21 Jan 2023 17:08:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8DC3C3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674320904; bh=dn0xqbv41bunerVArFzM6JQyvJKs3D3tEgfpyfDzUQE=; h=From:To:Subject:Date:From; b=rMCXWVcQWibxs6WimVvYgRKtNEWLpLSIc4Huw90Z5FOdCM55hLalz+0w/u154XD9n zxoRR8NrhQvf4FsBP1jscHtP7JQVDieAc4qo+3C0PK5IJijuIkNc0bPpQDSSnL/SRn /tioDmO9TRkZwjTsz2UzFKPpflNzrDYM8rV3e3TQ= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Iain D Sandoe To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5274] Darwin, fixincludes: Handle MacOS13 SDK Apple-specific deprecations [PR107568]. X-Act-Checkin: gcc X-Git-Author: Iain Sandoe X-Git-Refname: refs/heads/master X-Git-Oldrev: 1bdb1768bf7d83ae87ba7c12bd9566830a1ac772 X-Git-Newrev: 442d2bdc1d2a98aba0b18aeaa3e87fa946ac8031 Message-Id: <20230121170824.8DC3C3858D20@sourceware.org> Date: Sat, 21 Jan 2023 17:08:24 +0000 (GMT) List-Id: https://gcc.gnu.org/g:442d2bdc1d2a98aba0b18aeaa3e87fa946ac8031 commit r13-5274-g442d2bdc1d2a98aba0b18aeaa3e87fa946ac8031 Author: Iain Sandoe Date: Wed Jan 18 19:58:33 2023 +0000 Darwin, fixincludes: Handle MacOS13 SDK Apple-specific deprecations [PR107568]. The SDK for MacOS13 includes Apple-specific deprecations of some functions that are not deprecated in Posix, C or C++ and widely used in GCC. The fix makes the deprecation conditional on __APPLE_LOCAL_DEPRECATIONS so that end users may still observe them but they are hidden from normal compilations. Signed-off-by: Iain Sandoe PR target/107568 fixincludes/ChangeLog: * fixincl.x: Regenerate. * inclhack.def: Add a fix for MacOS13 SDK function deprecations in stdio.h. * tests/base/stdio.h (__deprecated_msg): New test. Diff: --- fixincludes/fixincl.x | 56 ++++++++++++++++++++++++++++++++++++++---- fixincludes/inclhack.def | 12 +++++++++ fixincludes/tests/base/stdio.h | 7 ++++++ 3 files changed, 70 insertions(+), 5 deletions(-) diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 20867548e24..35167dc82a8 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed September 29, 2022 at 10:22:55 PM by AutoGen 5.18.16 + * It has been AutoGen-ed January 18, 2023 at 07:54:50 PM by AutoGen 5.18.7 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Sep 29 22:22:55 CEST 2022 +/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Jan 18 19:54:50 GMT 2023 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 272 fixup descriptions. + * This file contains 273 fixup descriptions. * * See README for more information. * @@ -2608,6 +2608,46 @@ static const char* apzBsd_Stdio_Attrs_ConflictPatch[] = { int vfscanf(FILE *, const char *, __builtin_va_list) __asm__ (_BSD_STRING(__USER_LABEL_PREFIX__) \"__svfscanf\");", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Apple_Local_Stdio_Fn_Deprecation fix + */ +tSCC zApple_Local_Stdio_Fn_DeprecationName[] = + "apple_local_stdio_fn_deprecation"; + +/* + * File name selection pattern + */ +tSCC zApple_Local_Stdio_Fn_DeprecationList[] = + "stdio.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzApple_Local_Stdio_Fn_DeprecationMachs[] = { + "*-*-*darwin2*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zApple_Local_Stdio_Fn_DeprecationSelect0[] = + "__deprecated_msg([^\n\ +]*)$"; + +#define APPLE_LOCAL_STDIO_FN_DEPRECATION_TEST_CT 1 +static tTestDesc aApple_Local_Stdio_Fn_DeprecationTests[] = { + { TT_EGREP, zApple_Local_Stdio_Fn_DeprecationSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Apple_Local_Stdio_Fn_Deprecation + */ +static const char* apzApple_Local_Stdio_Fn_DeprecationPatch[] = { + "format", + "#if defined(__APPLE_LOCAL_DEPRECATIONS)\n\ +%0\n\ +#endif", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Ctrl_Quotes_Def fix @@ -11075,9 +11115,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 310 +#define REGEX_COUNT 311 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 272 +#define FIX_COUNT 273 /* * Enumerate the fixes @@ -11144,6 +11184,7 @@ typedef enum { BROKEN_CABS_FIXIDX, BROKEN_NAN_FIXIDX, BSD_STDIO_ATTRS_CONFLICT_FIXIDX, + APPLE_LOCAL_STDIO_FN_DEPRECATION_FIXIDX, CTRL_QUOTES_DEF_FIXIDX, CTRL_QUOTES_USE_FIXIDX, CXX_UNREADY_FIXIDX, @@ -11663,6 +11704,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { BSD_STDIO_ATTRS_CONFLICT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aBsd_Stdio_Attrs_ConflictTests, apzBsd_Stdio_Attrs_ConflictPatch, 0 }, + { zApple_Local_Stdio_Fn_DeprecationName, zApple_Local_Stdio_Fn_DeprecationList, + apzApple_Local_Stdio_Fn_DeprecationMachs, + APPLE_LOCAL_STDIO_FN_DEPRECATION_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aApple_Local_Stdio_Fn_DeprecationTests, apzApple_Local_Stdio_Fn_DeprecationPatch, 0 }, + { zCtrl_Quotes_DefName, zCtrl_Quotes_DefList, apzCtrl_Quotes_DefMachs, CTRL_QUOTES_DEF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index d4637470d7a..ea879b73bad 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1269,6 +1269,18 @@ fix = { test_text = '#define vfscanf __svfscanf'; }; +fix = { + hackname = apple_local_stdio_fn_deprecation; + mach = "*-*-*darwin2*"; + files = stdio.h; + select = "__deprecated_msg([^\n]*)$"; + c_fix = format; + c_fix_arg = "#if defined(__APPLE_LOCAL_DEPRECATIONS)\n" + "%0\n" + "#endif"; + test_text = '__deprecated_msg("This function is provided for compat...")'; +}; + /* * Fix various macros used to define ioctl numbers. * The traditional syntax was: diff --git a/fixincludes/tests/base/stdio.h b/fixincludes/tests/base/stdio.h index 491c75da6e5..38381bacb2d 100644 --- a/fixincludes/tests/base/stdio.h +++ b/fixincludes/tests/base/stdio.h @@ -41,6 +41,13 @@ int vfscanf(FILE *, const char *, __builtin_va_list) __asm__ (_BSD_STRING(__USER #endif /* BSD_STDIO_ATTRS_CONFLICT_CHECK */ +#if defined( APPLE_LOCAL_STDIO_FN_DEPRECATION_CHECK ) +#if defined(__APPLE_LOCAL_DEPRECATIONS) +__deprecated_msg("This function is provided for compat...") +#endif +#endif /* APPLE_LOCAL_STDIO_FN_DEPRECATION_CHECK */ + + #if defined( HPUX10_STDIO_DECLARATIONS_CHECK ) # define _iob __iob