The important part of this patch is the change to inclhack.def. The new fixincl.x was manually generated using AutoGen. Index: fixincludes/inclhack.def =================================================================== --- fixincludes/inclhack.def.orig +++ fixincludes/inclhack.def @@ -1221,6 +1221,31 @@ fix = { }; +/* + * GCC 4.2 doesn't recognize __has_extension and __has_feature. + */ + +fix = { + hackname = darwin_has_extension; + mach = "*-*-darwin*"; + files = xpc/base.h; + select = "__has_extension\\([A-Za-z_]*\\)"; + c_fix = format; + c_fix_arg = "0"; + test_text = "#if __has_extension(attribute_unavailable_with_message)"; +}; + +fix = { + hackname = darwin_has_feature; + mach = "*-*-darwin*"; + files = xpc/base.h; + select = "__has_feature\\([A-Za-z_]*\\)"; + c_fix = format; + c_fix_arg = "0"; + test_text = "#if __has_feature(objc_arc)"; +}; + + /* APPLE LOCAL begin for-fsf-4_4 5133297 */ /* * On darwin8 and earlier, mach-o/swap.h isn't properly guarded Index: fixincludes/fixincl.x =================================================================== --- fixincludes/fixincl.x.orig +++ fixincludes/fixincl.x @@ -1,12 +1,12 @@ /* -*- buffer-read-only: t -*- vi: set ro: - * + * * DO NOT EDIT THIS FILE (fixincl.x) - * - * It has been AutoGen-ed Friday July 17, 2009 at 11:13:21 AM CEST + * + * It has been AutoGen-ed * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Fri Jul 17 11:13:21 CEST 2009 +/* DO NOT SVN-MERGE THIS FILE, EITHER Sun May 31 21:20:28 EDT 2015 * * You must regenerate it. Use the ./genfixes script. * @@ -15,29 +15,25 @@ * 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 217 fixup descriptions. + * This file contains 219 fixup descriptions. * * See README for more information. * * inclhack copyright (c) 1998, 1999, 2000, 2001 * The Free Software Foundation, Inc. * - * inclhack is free software. - * - * You may redistribute it and/or modify it under the terms of the - * GNU General Public License, as published by the Free Software - * Foundation; either version 2, or (at your option) any later version. - * - * inclhack is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * inclhack is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * inclhack is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with inclhack. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . */ /* * * * * * * * * * * * * * * * * * * * * * * * * * @@ -1960,6 +1956,80 @@ static const char* apzDarwin_Gcc4_Breaka /* * * * * * * * * * * * * * * * * * * * * * * * * * * + * Description of Darwin_Has_Extension fix + */ +tSCC zDarwin_Has_ExtensionName[] = + "darwin_has_extension"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Has_ExtensionList[] = + "xpc/base.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Has_ExtensionMachs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Has_ExtensionSelect0[] = + "__has_extension\\([A-Za-z_]*\\)"; + +#define DARWIN_HAS_EXTENSION_TEST_CT 1 +static tTestDesc aDarwin_Has_ExtensionTests[] = { + { TT_EGREP, zDarwin_Has_ExtensionSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Has_Extension + */ +static const char* apzDarwin_Has_ExtensionPatch[] = { + "format", + "0", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Has_Feature fix + */ +tSCC zDarwin_Has_FeatureName[] = + "darwin_has_feature"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Has_FeatureList[] = + "xpc/base.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Has_FeatureMachs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Has_FeatureSelect0[] = + "__has_feature\\([A-Za-z_]*\\)"; + +#define DARWIN_HAS_FEATURE_TEST_CT 1 +static tTestDesc aDarwin_Has_FeatureTests[] = { + { TT_EGREP, zDarwin_Has_FeatureSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Has_Feature + */ +static const char* apzDarwin_Has_FeaturePatch[] = { + "format", + "0", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * * Description of Darwin_Macho_Swaph_Externc fix */ tSCC zDarwin_Macho_Swaph_ExterncName[] = @@ -4652,13 +4722,10 @@ tSCC zMath_ExceptionSelect0[] = */ tSCC zMath_ExceptionBypass0[] = "We have a problem when using C\\+\\+|for C\\+\\+, _[a-z0-9A-Z_]+_exception; for C, exception"; -tSCC zMath_ExceptionBypass1[] = - "defined __cplusplus"; #define MATH_EXCEPTION_TEST_CT 2 static tTestDesc aMath_ExceptionTests[] = { { TT_NEGREP, zMath_ExceptionBypass0, (regex_t*)NULL }, - { TT_NEGREP, zMath_ExceptionBypass1, (regex_t*)NULL }, { TT_EGREP, zMath_ExceptionSelect0, (regex_t*)NULL }, }; /* @@ -8842,9 +8909,9 @@ static const char* apzGlibc_Fdzero_Inlin * * List of all fixes */ -#define REGEX_COUNT 262 +#define REGEX_COUNT 264 #define MACH_LIST_SIZE_LIMIT 261 -#define FIX_COUNT 217 +#define FIX_COUNT 219 /* * Enumerate the fixes @@ -8894,6 +8961,8 @@ typedef enum { CTRL_QUOTES_USE_FIXIDX, CXX_UNREADY_FIXIDX, DARWIN_GCC4_BREAKAGE_FIXIDX, + DARWIN_HAS_EXTENSION_FIXIDX, + DARWIN_HAS_FEATURE_FIXIDX, DARWIN_MACHO_SWAPH_EXTERNC_FIXIDX, DARWIN_PRIVATE_EXTERN_FIXIDX, DARWIN_STDINT_GUARDS_INTN_FIXIDX, @@ -9290,6 +9359,16 @@ tFixDesc fixDescList[ FIX_COUNT ] = { DARWIN_GCC4_BREAKAGE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aDarwin_Gcc4_BreakageTests, apzDarwin_Gcc4_BreakagePatch, 0 }, + { zDarwin_Has_ExtensionName, zDarwin_Has_ExtensionList, + apzDarwin_Has_ExtensionMachs, + DARWIN_HAS_EXTENSION_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Has_ExtensionTests, apzDarwin_Has_ExtensionPatch, 0 }, + + { zDarwin_Has_FeatureName, zDarwin_Has_FeatureList, + apzDarwin_Has_FeatureMachs, + DARWIN_HAS_FEATURE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Has_FeatureTests, apzDarwin_Has_FeaturePatch, 0 }, + { zDarwin_Macho_Swaph_ExterncName, zDarwin_Macho_Swaph_ExterncList, apzDarwin_Macho_Swaph_ExterncMachs, DARWIN_MACHO_SWAPH_EXTERNC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,