From 35d488e972a9dd75ce3867c000405f128b79c615 Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Sun, 15 Jan 2023 12:14:05 +0000 Subject: reorganise things a bit to align further with the actual names/structure --- .../Src/Options/Glue/ParserGlue-mach-ppc-cc.c | 8 +-- .../Src/Options/Glue/TargetOptimizer-ppc-mach.c | 71 ++++++++++++++++++ .../Src/Options/Glue/TargetWarningHelpers-ppc-cc.c | 84 ---------------------- .../MacOS_PPC/Tools_PPC/Src/Plugin/cc-mach-ppc.c | 4 +- .../Tools_PPC/Src/Plugin/libimp-mach-ppc.c | 4 +- .../Tools_PPC/Src/Static/cc-mach-ppc-mw.c | 12 ++-- 6 files changed, 85 insertions(+), 98 deletions(-) create mode 100644 compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/TargetOptimizer-ppc-mach.c delete mode 100644 compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/TargetWarningHelpers-ppc-cc.c (limited to 'compiler_and_linker/CmdLine_Tools/MacOS_PPC') diff --git a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/ParserGlue-mach-ppc-cc.c b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/ParserGlue-mach-ppc-cc.c index f605817..ba38b17 100644 --- a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/ParserGlue-mach-ppc-cc.c +++ b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/ParserGlue-mach-ppc-cc.c @@ -58,7 +58,7 @@ static PrefDataPanel stPrefPanels[] = { "CmdLine Linker Panel", &pCmdLineLinker, sizeof(pCmdLineLinker) }; -static int PreParse() { +static int PreParse(void) { setLinkerOutputFilename = 0; linkerOutputFilename[0] = 0; definesHandle = NULL; @@ -67,7 +67,7 @@ static int PreParse() { return 1; } -static int MidParse() { +static int MidParse(void) { const char *match; const char *env; @@ -85,7 +85,7 @@ static int MidParse() { return 1; } -static int PostParse() { +static int PostParse(void) { if (!SetupPragmas(irPragmas) || !SetupPragmas(warningPragmas)) return 0; @@ -132,6 +132,6 @@ static ParserTool parser = { &PostParse }; -int RegisterStaticParserToolInfo() { +int RegisterStaticParserToolInfo(void) { return SetParserToolInfo(&parser); } diff --git a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/TargetOptimizer-ppc-mach.c b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/TargetOptimizer-ppc-mach.c new file mode 100644 index 0000000..6c86356 --- /dev/null +++ b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/TargetOptimizer-ppc-mach.c @@ -0,0 +1,71 @@ +#include "parser.h" + +char schedule_ppc_default; + +int TargetSetOptFlags(short val, Boolean set) { + switch (val) { + case 'Pe': + pBackEnd.peephole = set; + break; + case 'Sn': + pBackEnd.schedule = 0; + break; + case 'Sh': + pBackEnd.schedule = set; + break; + case 'S?': + pBackEnd.processor = schedule_ppc_default; + break; + case 'SG': + pBackEnd.processor = schedule_ppc_default = PrefCPU_Generic; + break; + case 'S1': + pBackEnd.processor = schedule_ppc_default = PrefCPU_601; + break; + case 'S3': + pBackEnd.processor = schedule_ppc_default = PrefCPU_603; + break; + case 'S#': + pBackEnd.processor = schedule_ppc_default = PrefCPU_603e; + break; + case 'S4': + pBackEnd.processor = schedule_ppc_default = PrefCPU_604; + break; + case 'S%': + pBackEnd.processor = schedule_ppc_default = PrefCPU_604e; + break; + case 'S7': + pBackEnd.processor = schedule_ppc_default = PrefCPU_750; + break; + case 'SA': + pBackEnd.processor = schedule_ppc_default = PrefCPU_Altivec; + break; + default: + return 0; + } + + return 1; +} + +void TargetDisplayOptimizationOptions(Handle txt) { + PrefCPU p; + + if (!pBackEnd.schedule) { + HPrintF(txt, "\t- no instruction scheduling\n"); + } else { + HPrintF(txt, "\t- schedule for %s\n", + !(p = (PrefCPU) pBackEnd.processor) ? "generic PPC" : + (p == PrefCPU_601) ? "601" : + (p == PrefCPU_603) ? "603" : + (p == PrefCPU_603e) ? "603e" : + (p == PrefCPU_604) ? "604" : + (p == PrefCPU_604e) ? "604e" : + (p == PrefCPU_750) ? "750" : + (p == PrefCPU_Altivec) ? "Altivec" : + "???" + ); + } +} + +void TargetSetPragmaOptimizationsToUnspecified(void) { +} diff --git a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/TargetWarningHelpers-ppc-cc.c b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/TargetWarningHelpers-ppc-cc.c deleted file mode 100644 index db6165c..0000000 --- a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Options/Glue/TargetWarningHelpers-ppc-cc.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "parser.h" - -// I'm making assumptions about the name of this file -// based on TargetWarningHelpers-ppc-ld.c existing in the linker - -PExtraWarningC pExtraWarningC = {0}; -Pragma warningPragmas[] = { - &pExtraWarningC.warn_largeargs, "warn_largeargs", 0, - &pExtraWarningC.warn_padding, "warn_padding", 0, - &pExtraWarningC.warn_resultnotused, "warn_resultnotused", 0, - &pExtraWarningC.warn_ptr_int_conv, "warn_ptr_int_conv", 0, - &pExtraWarningC.warn_no_side_effect, "warn_no_side_effect", 0, - 0, 0, 0 -}; - -int TargetSetWarningFlags(short val, Boolean set) { - switch (val) { - case 'Ip': pWarningC.warn_illpragma = set; break; - case 'Ed': pWarningC.warn_emptydecl = set; break; - case 'Pu': pWarningC.warn_possunwant = set; break; - case 'Uv': pWarningC.warn_unusedvar = set; break; - case 'Ua': pWarningC.warn_unusedarg = set; break; - case 'Ec': pWarningC.warn_extracomma = set; break; - case 'Pd': pWarningC.pedantic = set; break; - case 'Hv': pWarningC.warn_hidevirtual = set; break; - case 'Ic': pWarningC.warn_implicitconv = set; break; - case 'Ni': pWarningC.warn_notinlined = set; break; - case 'Sc': pWarningC.warn_structclass = set; break; - case 'Pa': pExtraWarningC.warn_padding = set ? PR_ON : PR_OFF; break; - case 'Nu': pExtraWarningC.warn_resultnotused = set ? PR_ON : PR_OFF; break; - case 'Se': pExtraWarningC.warn_no_side_effect = set ? PR_ON : PR_OFF; break; - case 'PI': pExtraWarningC.warn_ptr_int_conv = set ? PR_ON : PR_OFF; break; - case 'La': pExtraWarningC.warn_largeargs = set ? PR_ON : PR_OFF; break; - case 'We': pWarningC.warningerrors = set; break; - case 'Cp': pFrontEndC.checkprotos = set; break; - default: return 0; - } - - return 1; -} - -void TargetDisplayWarningOptions(Handle txt) { - HPrintF(txt, "C language warning options:\n"); - - if (pWarningC.warn_illpragma) - HPrintF(txt, "\t- illegal pragmas\n"); - if (pWarningC.warn_emptydecl) - HPrintF(txt, "\t- empty declarations\n"); - if (pWarningC.warn_possunwant) - HPrintF(txt, "\t- possible unwanted effects\n"); - if (pWarningC.warn_unusedvar) - HPrintF(txt, "\t- unused variables\n"); - if (pWarningC.warn_unusedarg) - HPrintF(txt, "\t- unused arguments\n"); - if (pWarningC.warn_extracomma) - HPrintF(txt, "\t- extra commas\n"); - if (pWarningC.pedantic) - HPrintF(txt, "\t- pedantic\n"); - if (pWarningC.warn_hidevirtual) - HPrintF(txt, "\t- hidden virtual functions\n"); - if (pWarningC.warn_implicitconv) - HPrintF(txt, "\t- implicit conversions\n"); - if (pWarningC.warn_notinlined) - HPrintF(txt, "\t- 'inline' not performed\n"); - if (pWarningC.warn_structclass) - HPrintF(txt, "\t- struct/class conflict\n"); - if (pExtraWarningC.warn_largeargs == 1) - HPrintF(txt, "\t- large args passed to unprototyped functions\n"); - if (pExtraWarningC.warn_padding == 1) - HPrintF(txt, "\t- padding added between struct members\n"); - if (pExtraWarningC.warn_resultnotused == 1) - HPrintF(txt, "\t- result of non-void function call not used\n"); - if (pExtraWarningC.warn_no_side_effect == 1) - HPrintF(txt, "\t- use of expressions as statements without side effects\n"); - if (pExtraWarningC.warn_ptr_int_conv == 1) - HPrintF(txt, "\t- implicit integer/pointer conversions\n"); - if (pFrontEndC.checkprotos) - HPrintF(txt, "\t- checking prototypes\n"); - - if (pWarningC.warningerrors) - HPrintF(txt, "\t- warnings are errors\n"); - else - HPrintF(txt, "\t- warnings are not errors\n"); -} diff --git a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/cc-mach-ppc.c b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/cc-mach-ppc.c index 5965d11..912c21a 100644 --- a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/cc-mach-ppc.c +++ b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/cc-mach-ppc.c @@ -246,7 +246,7 @@ static CompilerLinkerPluginCallbacks lk_cl_cb = { NULL }; -int RegisterStaticCompilerPlugin() { +int RegisterStaticCompilerPlugin(void) { return RegisterStaticCompilerLinkerPlugin(&plugin_cb, &plugin_cl_cb) && RegisterStaticCompilerLinkerPlugin(&lk_cb, &lk_cl_cb); } @@ -563,6 +563,6 @@ static const char *STR10100[] = { NULL }; -int RegisterCompilerResources() { +int RegisterCompilerResources(void) { return RegisterResource("Compiler Errors", 10000, STR10000) && RegisterResource("Compiler Strings", 10100, STR10100); } diff --git a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/libimp-mach-ppc.c b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/libimp-mach-ppc.c index 484db0f..4eb55d5 100644 --- a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/libimp-mach-ppc.c +++ b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Plugin/libimp-mach-ppc.c @@ -135,12 +135,12 @@ static CompilerLinkerPluginCallbacks machlibimport_cl_cb = { NULL }; -int RegisterStaticLibImporterPlugin() { +int RegisterStaticLibImporterPlugin(void) { return RegisterStaticCompilerLinkerPlugin(&machlibimport_cb, &machlibimport_cl_cb); } #include "compiler_and_linker/Plugin_Tools/MacOS_PPC/Lib_Importer_Mach/Resources/Errors.r" -int RegisterLibImporterResources() { +int RegisterLibImporterResources(void) { return RegisterResource("Mach-O Lib Importer Errors", 911, STR911); } diff --git a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Static/cc-mach-ppc-mw.c b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Static/cc-mach-ppc-mw.c index 25a9f49..95dabf6 100644 --- a/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Static/cc-mach-ppc-mw.c +++ b/compiler_and_linker/CmdLine_Tools/MacOS_PPC/Tools_PPC/Src/Static/cc-mach-ppc-mw.c @@ -1,11 +1,11 @@ #include "cmdline.h" // cc-mach-ppc.c -extern int RegisterStaticCompilerPlugin(); -extern int RegisterCompilerResources(); +extern int RegisterStaticCompilerPlugin(void); +extern int RegisterCompilerResources(void); // libimp-mach-ppc.c -extern int RegisterStaticLibImporterPlugin(); -extern int RegisterLibImporterResources(); +extern int RegisterStaticLibImporterPlugin(void); +extern int RegisterLibImporterResources(void); void GetStaticTarget(OSType *cpu, OSType *os) { *cpu = targetCPUPowerPC; @@ -21,11 +21,11 @@ void GetStaticParserPluginType(OSType *style) { *style = CWFOURCHAR('S','e','e','p'); } -int RegisterStaticTargetPlugins() { +int RegisterStaticTargetPlugins(void) { return RegisterStaticCompilerPlugin() && RegisterStaticLibImporterPlugin(); } -int RegisterStaticTargetResources() { +int RegisterStaticTargetResources(void) { OS_UseMacResourceForkInfo(1); return RegisterCompilerResources() && RegisterLibImporterResources(); } -- cgit v1.2.3