diff --git a/Programming/gcc/build b/Programming/gcc/build index 632daa4..761ddd8 100755 --- a/Programming/gcc/build +++ b/Programming/gcc/build @@ -2,14 +2,17 @@ pbuild::set_download_url "https://ftp.gnu.org/gnu/gcc/$P-$V/$P-$V.tar.gz" -pbuild::patch_sources_Darwin() { +pbuild::pre_prep() { if (( V_MAJOR == 4 && V_MINOR <= 8 )) || \ (( V_MAJOR == 4 && V_MINOR == 9 && V_PATCHLVL < 4)); then - patch -p1 < "${BUILDBLOCK_DIR}/${V_MAJOR}/non-dead-strip.patch" - patch -p1 < "${BUILDBLOCK_DIR}/${V_MAJOR}/configure-as.patch" + pbuild::add_patch_Darwin "${V_MAJOR}/non-dead-strip.patch" + pbuild::add_patch_Darwin "${V_MAJOR}/configure-as.patch" fi if (( V_MAJOR == 5 )) || (( V_MAJOR == 6 )); then - patch -p1 < "${BUILDBLOCK_DIR}/${V_MAJOR}/PR57438_avoiding_empty_function_bodies_and_trailing_labels.patch" + pbuild::add_patch_Darwin "${V_MAJOR}/PR57438_avoiding_empty_function_bodies_and_trailing_labels.patch" + fi + if (( V_MAJOR == 8 )); then + pbuild::add_patch_Darwin "files/headers-10.14.4-fix.patch" fi } diff --git a/Programming/gcc/files/headers-10.14.4-fix.patch b/Programming/gcc/files/headers-10.14.4-fix.patch new file mode 100644 index 0000000..4b45455 --- /dev/null +++ b/Programming/gcc/files/headers-10.14.4-fix.patch @@ -0,0 +1,162 @@ +diff -ruN gcc-8.3.0-old/fixincludes/fixincl.x gcc-8.3.0/fixincludes/fixincl.x +--- gcc-8.3.0-old/fixincludes/fixincl.x 2018-02-22 11:12:26.000000000 -0500 ++++ gcc-8.3.0/fixincludes/fixincl.x 2019-03-28 15:59:33.000000000 -0400 +@@ -2,11 +2,11 @@ + * + * DO NOT EDIT THIS FILE (fixincl.x) + * +- * It has been AutoGen-ed February 22, 2018 at 03:46:51 PM by AutoGen 5.18 ++ * It has been AutoGen-ed March 28, 2019 at 03:59:33 PM by AutoGen 5.18.16 + * From the definitions inclhack.def + * and the template file fixincl + */ +-/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Feb 22 15:46:51 UTC 2018 ++/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Mar 28 15:59:33 EDT 2019 + * + * 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 249 fixup descriptions. ++ * This file contains 250 fixup descriptions. + * + * See README for more information. + * +@@ -2584,6 +2584,50 @@ + + /* * * * * * * * * * * * * * * * * * * * * * * * * * + * ++ * Description of Darwin_Ucred__Atomic fix ++ */ ++tSCC zDarwin_Ucred__AtomicName[] = ++ "darwin_ucred__Atomic"; ++ ++/* ++ * File name selection pattern ++ */ ++tSCC zDarwin_Ucred__AtomicList[] = ++ "sys/ucred.h\0"; ++/* ++ * Machine/OS name selection pattern ++ */ ++tSCC* apzDarwin_Ucred__AtomicMachs[] = { ++ "*-*-darwin18.5.*", ++ (const char*)NULL }; ++ ++/* ++ * content selection pattern - do fix if pattern found ++ */ ++tSCC zDarwin_Ucred__AtomicSelect0[] = ++ "_Atomic"; ++ ++#define DARWIN_UCRED__ATOMIC_TEST_CT 1 ++static tTestDesc aDarwin_Ucred__AtomicTests[] = { ++ { TT_EGREP, zDarwin_Ucred__AtomicSelect0, (regex_t*)NULL }, }; ++ ++/* ++ * Fix Command Arguments for Darwin_Ucred__Atomic ++ */ ++static const char* apzDarwin_Ucred__AtomicPatch[] = { ++ "wrap", ++ "\n\ ++#if defined(__cplusplus) && __cplusplus >= 201103L\n\ ++# define _Atomic volatile\n\ ++#endif\n", ++ "\n\ ++#if defined(__cplusplus) && __cplusplus >= 201103L\n\ ++# undef _Atomic\n\ ++#endif\n", ++ (char*)NULL }; ++ ++/* * * * * * * * * * * * * * * * * * * * * * * * * * ++ * + * Description of Darwin_9_Long_Double_Funcs_2 fix + */ + tSCC zDarwin_9_Long_Double_Funcs_2Name[] = +@@ -10099,9 +10143,9 @@ + * + * List of all fixes + */ +-#define REGEX_COUNT 287 ++#define REGEX_COUNT 288 + #define MACH_LIST_SIZE_LIMIT 187 +-#define FIX_COUNT 249 ++#define FIX_COUNT 250 + + /* + * Enumerate the fixes +@@ -10168,6 +10212,7 @@ + CTRL_QUOTES_USE_FIXIDX, + CXX_UNREADY_FIXIDX, + DARWIN_AVAILABILITYINTERNAL_FIXIDX, ++ DARWIN_UCRED__ATOMIC_FIXIDX, + DARWIN_9_LONG_DOUBLE_FUNCS_2_FIXIDX, + DARWIN_EXTERNC_FIXIDX, + DARWIN_GCC4_BREAKAGE_FIXIDX, +@@ -10664,6 +10709,11 @@ + DARWIN_AVAILABILITYINTERNAL_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_AvailabilityinternalTests, apzDarwin_AvailabilityinternalPatch, 0 }, + ++ { zDarwin_Ucred__AtomicName, zDarwin_Ucred__AtomicList, ++ apzDarwin_Ucred__AtomicMachs, ++ DARWIN_UCRED__ATOMIC_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, ++ aDarwin_Ucred__AtomicTests, apzDarwin_Ucred__AtomicPatch, 0 }, ++ + { zDarwin_9_Long_Double_Funcs_2Name, zDarwin_9_Long_Double_Funcs_2List, + apzDarwin_9_Long_Double_Funcs_2Machs, + DARWIN_9_LONG_DOUBLE_FUNCS_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, +diff -ruN gcc-8.3.0-old/fixincludes/inclhack.def gcc-8.3.0/fixincludes/inclhack.def +--- gcc-8.3.0-old/fixincludes/inclhack.def 2018-02-22 11:12:26.000000000 -0500 ++++ gcc-8.3.0/fixincludes/inclhack.def 2019-03-28 15:59:18.739714124 -0400 +@@ -1268,6 +1268,36 @@ + }; + + /* ++ * macOS 10.14.4 uses the C _Atomic keyword in C++ code. ++ */ ++fix = { ++ hackname = darwin_ucred__Atomic; ++ mach = "*-*-darwin18.5.*"; ++ files = sys/ucred.h; ++ select = "_Atomic"; ++ ++ c_fix = wrap; ++ ++ c_fix_arg = <<- _EOArg_ ++ ++ #if defined(__cplusplus) && __cplusplus >= 201103L ++ # define _Atomic volatile ++ #endif ++ ++ _EOArg_; ++ ++ c_fix_arg = <<- _EOArg_ ++ ++ #if defined(__cplusplus) && __cplusplus >= 201103L ++ # undef _Atomic ++ #endif ++ ++ _EOArg_; ++ ++ test_text = "#include \n"; ++}; ++ ++/* + * For the AAB_darwin7_9_long_double_funcs fix to be useful, + * you have to not use "" includes. + */ +diff -ruN gcc-8.3.0-old/gcc/config/darwin-driver.c gcc-8.3.0/gcc/config/darwin-driver.c +--- gcc-8.3.0-old/gcc/config/darwin-driver.c 2018-01-03 05:03:58.000000000 -0500 ++++ gcc-8.3.0/gcc/config/darwin-driver.c 2019-03-28 16:05:19.856598766 -0400 +@@ -27,7 +27,9 @@ + #include "diagnostic-core.h" + + #ifndef CROSS_DIRECTORY_STRUCTURE ++#define _Atomic volatile + #include ++#undef _Atomic + #include "xregex.h" + + static char *