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 @@ -1206,6 +1206,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 20, 2007 at 02:14:34 PM PDT + * + * It has been AutoGen-ed * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT CVS-MERGE THIS FILE, EITHER Fri Jul 20 14:14:34 PDT 2007 +/* DO NOT CVS-MERGE THIS FILE, EITHER Mon Jun 1 01:47:00 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 209 fixup descriptions. + * This file contains 211 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 . */ /* * * * * * * * * * * * * * * * * * * * * * * * * * @@ -1957,6 +1953,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|"; +/* + * 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|"; +/* + * 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[] = @@ -8511,9 +8581,9 @@ static const char* apzX11_SprintfPatch[] * * List of all fixes */ -#define REGEX_COUNT 251 +#define REGEX_COUNT 253 #define MACH_LIST_SIZE_LIMIT 261 -#define FIX_COUNT 209 +#define FIX_COUNT 211 /* * Enumerate the fixes @@ -8563,6 +8633,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, @@ -8951,6 +9023,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,