1 (* M2Options.mod initializes the user options.
3 Copyright (C) 2001-2024 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU Modula-2; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. *)
22 IMPLEMENTATION MODULE M2Options ;
26 FROM SArgs IMPORT GetArg, Narg ;
27 FROM M2Search IMPORT SetDefExtension, SetModExtension ;
28 FROM PathName IMPORT DumpPathName, AddInclude ;
29 FROM M2Printf IMPORT printf0, printf1, fprintf1 ;
30 FROM FIO IMPORT StdErr ;
31 FROM libc IMPORT exit, printf ;
32 FROM Debug IMPORT Halt ;
33 FROM gcctypes IMPORT location_t ;
34 FROM m2configure IMPORT FullPathCPP, TargetIEEEQuadDefault ;
35 FROM M2Error IMPORT InternalError ;
36 FROM FormatStrings IMPORT Sprintf1 ;
37 FROM m2misc IMPORT cerror ;
39 FROM DynamicStrings IMPORT String, Length, InitString, Mark, Slice, EqualArray,
40 InitStringCharStar, ConCatChar, ConCat, KillString,
41 Dup, string, char, Index,
42 PushAllocation, PopAllocationExemption,
43 InitStringDB, InitStringCharStarDB,
44 InitStringCharDB, MultDB, DupDB, SliceDB ;
47 #define InitString(X) InitStringDB(X, __FILE__, __LINE__)
48 #define InitStringCharStar(X) InitStringCharStarDB(X, __FILE__, __LINE__)
49 #define InitStringChar(X) InitStringCharDB(X, __FILE__, __LINE__)
50 #define Mult(X,Y) MultDB(X, Y, __FILE__, __LINE__)
51 #define Dup(X) DupDB(X, __FILE__, __LINE__)
52 #define Slice(X,Y,Z) SliceDB(X, Y, Z, __FILE__, __LINE__)
57 DefaultRuntimeModuleOverride = "m2iso:RTentity,m2iso:Storage,m2iso:SYSTEM,m2iso:M2RTS,m2iso:RTExceptions,m2iso:IOLink" ;
75 GenModuleListFilename,
77 RuntimeModuleOverride,
79 DebugFunctionLineNumbers,
80 DebugTraceQuad, (* -fm2-debug-trace=quad. *)
81 DebugTraceLine, (* -fm2-debug-trace=line. *)
82 DebugTraceToken, (* -fm2-debug-trace=token. *)
83 DebugTraceTree, (* -fm2-debug-trace=tree. (not yet implemented). *)
84 DumpDecl, (* -fm2-dump=decl. *)
85 DumpGimple, (* -fm2-dump=gimple. *)
86 DumpQuad, (* -fq, -fm2-dump=quad dump quadruples. *)
96 SeenSources : BOOLEAN ;
97 ForcedLocationValue : location_t ;
100 (* String garbage collection debugging routines.
106 PROCEDURE doDSdbEnter ;
116 PROCEDURE doDSdbExit (s: String) ;
118 s := PopAllocationExemption (TRUE, s)
126 PROCEDURE DSdbEnter ;
135 PROCEDURE DSdbExit (s: String) ;
141 #define DSdbEnter doDSdbEnter
142 #define DSdbExit doDSdbExit
147 SetM2Prefix - assign arg to M2Prefix.
150 PROCEDURE SetM2Prefix (arg: ADDRESS) ;
152 M2Prefix := KillString (M2Prefix) ;
153 M2Prefix := InitStringCharStar (arg)
158 GetM2Prefix - return M2Prefix as a C string.
161 PROCEDURE GetM2Prefix () : ADDRESS ;
163 RETURN string (M2Prefix)
168 SetM2PathName - assign arg to M2PathName.
171 PROCEDURE SetM2PathName (arg: ADDRESS) ;
173 M2PathName := KillString (M2PathName) ;
174 M2PathName := InitStringCharStar (arg) ;
175 (* fprintf1 (StdErr, "M2PathName = %s\n", M2PathName) *)
180 GetM2PathName - return M2PathName as a C string.
183 PROCEDURE GetM2PathName () : ADDRESS ;
185 RETURN string (M2PathName)
190 SetB - assigns Barg to arg.
193 PROCEDURE SetB (arg: ADDRESS) ;
195 Barg := KillString (Barg) ;
196 Barg := InitStringCharStar (arg)
201 GetB - returns Barg value as a C string or NIL if it was never set.
204 PROCEDURE GetB () : ADDRESS ;
211 SetM - set the MFlag.
214 PROCEDURE SetM (value: BOOLEAN) ;
221 GetM - set the MFlag.
224 PROCEDURE GetM () : BOOLEAN ;
231 SetMM - set the MMFlag.
234 PROCEDURE SetMM (value: BOOLEAN) ;
241 GetMM - set the MMFlag.
244 PROCEDURE GetMM () : BOOLEAN ;
251 SetMD - set the MDFlag to value.
254 PROCEDURE SetMD (value: BOOLEAN) ;
261 GetMD - return the MDFlag.
264 PROCEDURE GetMD () : BOOLEAN ;
271 SetMMD - set the MMDFlag to value.
274 PROCEDURE SetMMD (value: BOOLEAN) ;
281 GetMMD - return the MMDFlag.
284 PROCEDURE GetMMD () : BOOLEAN ;
291 SetMF - assigns MFarg to the filename from arg.
294 PROCEDURE SetMF (arg: ADDRESS) ;
296 MFarg := KillString (MFarg) ;
297 MFarg := InitStringCharStar (arg)
302 GetMF - returns MFarg or NIL if never set.
305 PROCEDURE GetMF () : ADDRESS ;
307 RETURN string (MFarg)
312 SetMP - set the MPflag to value.
315 PROCEDURE SetMP (value: BOOLEAN) ;
322 GetMP - get the MPflag.
325 PROCEDURE GetMP () : BOOLEAN ;
335 PROCEDURE errors1 (format: ARRAY OF CHAR; arg: String) ;
340 message := Sprintf1 (InitString (format), arg) ;
341 cstr := string (message) ;
348 AddWord - concats a word to sentence inserting a space if necessary.
349 sentence is returned. sentence will be created if it is NIL.
352 PROCEDURE AddWord (sentence, word: String) : String ;
358 sentence := Dup (word)
360 sentence := ConCatChar (sentence, ' ') ;
361 sentence := ConCat (sentence, word)
369 QuoteTarget - quote the '$' character.
372 PROCEDURE QuoteTarget (target: String) : String ;
377 quoted := InitString ('') ;
379 n := Length (target) ;
381 CASE char (target, i) OF
383 '$': quoted := ConCat (quoted, Mark (InitString ('$$')))
386 quoted := ConCatChar (quoted, char (target, i))
395 SetMQ - adds a quoted target arg to the DepTarget sentence.
398 PROCEDURE SetMQ (arg: ADDRESS) ;
400 DepTarget := AddWord (DepTarget, QuoteTarget (InitStringCharStar (arg))) ;
401 MQFlag := AddWord (MQFlag, Mark (InitString ('-MQ'))) ;
402 MQFlag := AddWord (MQFlag, Mark (InitStringCharStar (arg)))
407 GetMQ - returns a C string containing all the -MQ arg values.
410 PROCEDURE GetMQ () : ADDRESS ;
412 RETURN string (MQFlag)
417 SetMT - adds a target arg to the DepTarget sentence.
420 PROCEDURE SetMT (arg: ADDRESS) ;
422 DepTarget := AddWord (DepTarget, InitStringCharStar (arg)) ;
423 MTFlag := AddWord (MTFlag, Mark (InitString ('-MT'))) ;
424 MTFlag := AddWord (MTFlag, Mark (InitStringCharStar (arg)))
429 GetMT - returns a C string containing all the -MT arg values.
432 PROCEDURE GetMT () : ADDRESS ;
434 RETURN string (MTFlag)
439 GetDepTarget - returns the DepTarget as a C string.
442 PROCEDURE GetDepTarget () : ADDRESS ;
444 RETURN string (DepTarget)
449 SetObj - assigns CmdLineObj to the filename from arg.
452 PROCEDURE SetObj (arg: ADDRESS) ;
454 CmdLineObj := KillString (CmdLineObj) ;
455 CmdLineObj := InitStringCharStar (arg)
460 GetObj - returns CmdLineObj filename as a c-string or NIL if it was never set.
463 PROCEDURE GetObj () : ADDRESS ;
465 RETURN string (CmdLineObj)
470 CppCommandLine - returns the Cpp command line and all arguments.
471 NIL is returned if the -fcpp is absent.
474 PROCEDURE CppCommandLine () : String ;
480 s := InitStringCharStar (FullPathCPP ()) ;
481 s := ConCat (ConCatChar (s, ' '), CppArgs) ;
484 s := ConCat (ConCatChar (s, ' '), Mark (InitString ('-quiet')))
494 CppArg - sets the option and arg in the cpp command line.
497 PROCEDURE CppArg (opt, arg: ADDRESS; joined: BOOLEAN) ;
501 s := InitStringCharStar(opt) ;
502 IF EqualArray(s, '-fcpp-begin') OR EqualArray(s, '-fcpp-end')
506 IF NOT EqualArray(CppArgs, '')
508 CppArgs := ConCatChar(CppArgs, ' ')
510 CppArgs := ConCat(CppArgs, Mark(s)) ;
513 s := InitStringCharStar(arg) ;
516 CppArgs := ConCatChar(CppArgs, ' ')
518 CppArgs := ConCat(CppArgs, s)
525 CppRemember - remember a string, s, as a cpp related argument.
526 The string, s, is not garbage collected.
529 PROCEDURE CppRemember (s: String) ;
531 IF (CppArgs=NIL) OR EqualArray (CppArgs, '')
535 CppArgs := ConCatChar (CppArgs, ' ') ;
536 CppArgs := ConCat (CppArgs, s)
542 FinaliseOptions - once all options have been parsed we set any inferred
546 PROCEDURE FinaliseOptions ;
548 (* currently only one value, this could be make an option in the future *)
549 VariantValueChecking := Iso
550 END FinaliseOptions ;
554 SetWholeProgram - sets the WholeProgram flag (-fwhole-program).
557 PROCEDURE SetWholeProgram (value: BOOLEAN) ;
559 WholeProgram := value
560 END SetWholeProgram ;
567 PROCEDURE SetReturnCheck (value: BOOLEAN) : BOOLEAN ;
569 ReturnChecking := value ;
578 PROCEDURE SetNilCheck (value: BOOLEAN) : BOOLEAN ;
580 NilChecking := value ;
586 SetCaseCheck - set else case checking to, value.
589 PROCEDURE SetCaseCheck (value: BOOLEAN) : BOOLEAN ;
591 CaseElseChecking := value ;
597 SetCheckAll - set all runtime checking to, value.
600 PROCEDURE SetCheckAll (value: BOOLEAN) : BOOLEAN ;
602 NilChecking := value ;
603 WholeDivChecking := value ;
604 IndexChecking := value ;
605 RangeChecking := value ;
606 ReturnChecking := value ;
607 NilChecking := value ;
608 CaseElseChecking := value ;
609 FloatValueChecking := value ;
610 WholeValueChecking := value ;
616 SetAutoInit - -fauto-init turns on automatic initialization of pointers to NIL.
620 PROCEDURE SetAutoInit (value: BOOLEAN) ;
628 SetUnusedVariableChecking - assigns the UnusedVariableChecking to value.
631 PROCEDURE SetUnusedVariableChecking (value: BOOLEAN) ;
633 UnusedVariableChecking := value
634 END SetUnusedVariableChecking ;
638 SetUnusedParameterChecking - assigns the UnusedParameterChecking to value.
641 PROCEDURE SetUnusedParameterChecking (value: BOOLEAN) ;
643 UnusedParameterChecking := value
644 END SetUnusedParameterChecking ;
648 SetStrictTypeChecking - assigns the StrictTypeChecking flag to value.
651 PROCEDURE SetStrictTypeChecking (value: BOOLEAN) ;
653 StrictTypeChecking := value
654 END SetStrictTypeChecking ;
658 SetVerboseUnbounded - sets the VerboseUnbounded flag to, value.
661 PROCEDURE SetVerboseUnbounded (value: BOOLEAN) : BOOLEAN ;
663 VerboseUnbounded := value ;
665 END SetVerboseUnbounded ;
669 SetQuiet - sets the quiet flag to, value.
672 PROCEDURE SetQuiet (value: BOOLEAN) : BOOLEAN ;
680 SetCpp - enables the source to be preprocessed and enables the
681 recognition of C preprocessor line directives.
684 PROCEDURE SetCpp (value: BOOLEAN) : BOOLEAN ;
686 CPreProcessor := value ;
687 LineDirectives := value ;
693 GetCpp - returns TRUE if the C preprocessor was used.
696 PROCEDURE GetCpp () : BOOLEAN ;
703 GetLineDirectives - returns TRUE if line directives are allowed.
706 PROCEDURE GetLineDirectives () : BOOLEAN ;
708 RETURN LineDirectives
709 END GetLineDirectives ;
713 SetPPOnly - set the PPonly (preprocess only) to value.
716 PROCEDURE SetPPOnly (value: BOOLEAN) ;
722 GetPPOnly - get the PPonly (preprocess only).
725 PROCEDURE GetPPOnly () : BOOLEAN ;
732 Setc - set the cflag (compile only flag -c) to value.
735 PROCEDURE Setc (value: BOOLEAN) ;
742 Getc - get the cflag (compile only flag -c).
745 PROCEDURE Getc () : BOOLEAN ;
752 SetUselist - set the uselist flag to value and remember the filename.
755 PROCEDURE SetUselist (value: BOOLEAN; filename: ADDRESS) ;
757 UselistFlag := value ;
758 UselistFilename := KillString (UselistFilename) ;
761 UselistFilename := InitStringCharStar (filename)
767 GetUselist - return the uselist flag.
770 PROCEDURE GetUselist () : BOOLEAN ;
777 GetUselistFilename - return the uselist filename as a String.
780 PROCEDURE GetUselistFilename () : String ;
782 RETURN UselistFilename
783 END GetUselistFilename ;
787 SetM2g - set GenerateStatementNote to value and return value.
788 Corresponds to the -fm2-g flag.
791 PROCEDURE SetM2g (value: BOOLEAN) : BOOLEAN ;
793 GenerateStatementNote := value ;
794 RETURN GenerateStatementNote
799 GetM2g - returns TRUE if the -fm2-g flags was used.
802 PROCEDURE GetM2g () : BOOLEAN ;
804 RETURN GenerateStatementNote
809 SetLowerCaseKeywords - set the lower case keyword flag and return the result.
812 PROCEDURE SetLowerCaseKeywords (value: BOOLEAN) : BOOLEAN ;
814 LowerCaseKeywords := value ;
815 RETURN LowerCaseKeywords
816 END SetLowerCaseKeywords ;
820 SetVerbose - set the Verbose flag to, value. It returns TRUE.
823 PROCEDURE SetVerbose (value: BOOLEAN) : BOOLEAN ;
833 PROCEDURE SetMakeall (value: BOOLEAN) : BOOLEAN ;
835 (* value is unused *)
844 PROCEDURE SetMakeall0 (value: BOOLEAN) : BOOLEAN ;
846 (* value is unused *)
855 PROCEDURE SetIncludePath (arg: ADDRESS) : BOOLEAN ;
863 SetUnboundedByReference -
866 PROCEDURE SetUnboundedByReference (value: BOOLEAN) : BOOLEAN ;
868 UnboundedByReference := value ;
870 END SetUnboundedByReference ;
875 SetDebugging - sets the debugging flag to, v.
878 PROCEDURE SetDebugging (value: BOOLEAN) ;
880 GenerateDebugging := value
885 SetProfiling - dummy procedure, as profiling is implemented in the gcc backend.
888 PROCEDURE SetProfiling (value: BOOLEAN) ;
899 PROCEDURE SetISO (value: BOOLEAN) ;
904 (* Pim4 is the default, leave it alone since the DIV and MOD rules are the
913 PROCEDURE SetPIM (value: BOOLEAN) ;
924 PROCEDURE SetPIM2 (value: BOOLEAN) ;
931 (* Pim4 is the default, turn it off. *)
941 PROCEDURE SetPIM3 (value: BOOLEAN) ;
948 (* Pim4 is the default, turn it off. *)
958 PROCEDURE SetPIM4 (value: BOOLEAN) ;
967 SetPositiveModFloor - sets the positive mod floor option.
970 PROCEDURE SetPositiveModFloor (value: BOOLEAN) ;
972 PositiveModFloorDiv := value
973 END SetPositiveModFloor ;
977 SetWholeDiv - sets the whole division flag.
980 PROCEDURE SetWholeDiv (value: BOOLEAN) ;
982 WholeDivChecking := value
987 SetIndex - sets the runtime array index checking flag.
990 PROCEDURE SetIndex (value: BOOLEAN) ;
992 IndexChecking := value
997 SetRange - sets the runtime range checking flag.
1000 PROCEDURE SetRange (value: BOOLEAN) ;
1002 RangeChecking := value
1007 SetExceptions - sets the enable runtime exceptions flag.
1010 PROCEDURE SetExceptions (value: BOOLEAN) ;
1020 PROCEDURE SetStyle (value: BOOLEAN) ;
1022 StyleChecking := value
1030 PROCEDURE SetPedantic (value: BOOLEAN) ;
1037 SetPedanticParamNames - sets the pedantic parameter name flag.
1040 PROCEDURE SetPedanticParamNames (value: BOOLEAN) ;
1042 PedanticParamNames := value
1043 END SetPedanticParamNames ;
1047 SetPedanticCast - sets the pedantic cast flag.
1050 PROCEDURE SetPedanticCast (value: BOOLEAN) ;
1052 PedanticCast := value
1053 END SetPedanticCast ;
1057 SetExtendedOpaque - sets the ExtendedOpaque flag.
1060 PROCEDURE SetExtendedOpaque (value: BOOLEAN) ;
1062 ExtendedOpaque := value
1063 END SetExtendedOpaque ;
1067 SetXCode - sets the xcode flag.
1070 PROCEDURE SetXCode (value: BOOLEAN) ;
1080 PROCEDURE SetSwig (value: BOOLEAN) ;
1082 GenerateSwig := value
1087 SetQuadDebugging - display the quadruples (internal debugging).
1090 PROCEDURE SetQuadDebugging (value: BOOLEAN) ;
1093 DumpQuadFilename := KillString (DumpQuadFilename) ;
1094 DumpQuadFilename := InitString ('-')
1095 END SetQuadDebugging ;
1099 SetCompilerDebugging - turn on internal compiler debugging.
1102 PROCEDURE SetCompilerDebugging (value: BOOLEAN) ;
1104 CompilerDebugging := value
1105 END SetCompilerDebugging ;
1109 SetM2DebugTraceFilter - set internal debug flags. The flags should be
1110 specified as a comma separated list. The full
1111 list allowed is quad,line,token,all.
1114 PROCEDURE SetM2DebugTraceFilter (value: BOOLEAN; filter: ADDRESS) ;
1121 full := InitStringCharStar (filter) ;
1124 i := Index (full, ',', start) ;
1127 word := Slice (full, start, 0)
1129 word := Slice (full, start, i)
1131 SetM2DebugTrace (word, value) ;
1132 word := KillString (word) ;
1135 full := KillString (full) ;
1136 END SetM2DebugTraceFilter ;
1143 PROCEDURE SetM2DebugTrace (word: String; value: BOOLEAN) ;
1145 IF EqualArray (word, 'all')
1147 (* DebugTraceTree := value ; *)
1148 DebugTraceQuad := value ;
1149 DebugTraceToken := value ;
1150 DebugTraceLine := value
1151 ELSIF EqualArray (word, 'quad')
1153 DebugTraceQuad := value
1154 ELSIF EqualArray (word, 'token')
1156 DebugTraceToken := value
1157 ELSIF EqualArray (word, 'line')
1159 DebugTraceLine := value
1161 errors1 ("unrecognized filter %s seen in -fm2-debug-trace= option\n", word)
1163 END SetM2DebugTrace ;
1167 SetDebugFunctionLineNumbers - set DebugFunctionLineNumbers.
1170 PROCEDURE SetDebugFunctionLineNumbers (value: BOOLEAN) ;
1172 DebugFunctionLineNumbers := value
1173 END SetDebugFunctionLineNumbers ;
1177 GetDebugTraceQuad - return DebugTraceQuad.
1180 PROCEDURE GetDebugTraceQuad () : BOOLEAN ;
1182 RETURN DebugTraceQuad
1183 END GetDebugTraceQuad ;
1187 GetDebugTraceTree - return DebugTraceTree.
1190 PROCEDURE GetDebugTraceTree () : BOOLEAN ;
1192 RETURN DebugTraceTree
1193 END GetDebugTraceTree ;
1197 GetDebugTraceToken - return DebugTraceToken.
1200 PROCEDURE GetDebugTraceToken () : BOOLEAN ;
1202 RETURN DebugTraceToken
1203 END GetDebugTraceToken ;
1207 GetDebugTraceLine - return DebugTraceLine.
1210 PROCEDURE GetDebugTraceLine () : BOOLEAN ;
1212 RETURN DebugTraceLine
1213 END GetDebugTraceLine ;
1217 GetDebugFunctionLineNumbers - return DebugFunctionLineNumbers.
1220 PROCEDURE GetDebugFunctionLineNumbers () : BOOLEAN ;
1222 RETURN DebugFunctionLineNumbers
1223 END GetDebugFunctionLineNumbers ;
1230 PROCEDURE SetSources (value: BOOLEAN) ;
1232 Quiet := NOT value ;
1233 SeenSources := value
1238 SetDumpSystemExports -
1241 PROCEDURE SetDumpSystemExports (value: BOOLEAN) ;
1243 DumpSystemExports := value
1244 END SetDumpSystemExports ;
1251 PROCEDURE SetSearchPath (arg: ADDRESS) ;
1255 s := InitStringCharStar (arg) ;
1256 AddInclude (M2PathName, s) ;
1259 DumpPathName ("path name entries: ")
1266 setdefextension - set the source file definition module extension to arg.
1267 This should include the . and by default it is set to .def.
1270 PROCEDURE setdefextension (arg: ADDRESS) ;
1274 s := InitStringCharStar (arg) ;
1275 SetDefExtension (s) ;
1277 END setdefextension ;
1281 setmodextension - set the source file module extension to arg.
1282 This should include the . and by default it is set to .mod.
1285 PROCEDURE setmodextension (arg: ADDRESS) ;
1289 s := InitStringCharStar (arg) ;
1290 SetModExtension (s) ;
1292 END setmodextension ;
1299 PROCEDURE SetOptimizing (value: CARDINAL) ;
1303 Optimizing := TRUE ;
1304 OptimizeBasicBlock := TRUE ;
1305 OptimizeUncalledProcedures := TRUE ;
1306 OptimizeCommonSubExpressions := TRUE
1308 Optimizing := FALSE ;
1309 OptimizeBasicBlock := FALSE ;
1310 OptimizeUncalledProcedures := FALSE ;
1311 OptimizeCommonSubExpressions := FALSE
1317 SetForcedLocation - sets the location for the lifetime of this compile to, location.
1318 This is primarily an internal debugging switch.
1321 PROCEDURE SetForcedLocation (location: location_t) ;
1323 ForcedLocation := TRUE ;
1324 ForcedLocationValue := location
1325 END SetForcedLocation ;
1329 SetCC1Quiet - sets the cc1quiet flag to, value.
1332 PROCEDURE SetCC1Quiet (value: BOOLEAN) ;
1339 SetStatistics - turn on/off generate of compile time statistics.
1342 PROCEDURE SetStatistics (on: BOOLEAN) ;
1349 OverrideLocation - possibly override the location value, depending upon
1350 whether the -flocation= option was used.
1353 PROCEDURE OverrideLocation (location: location_t) : location_t ;
1357 RETURN( ForcedLocationValue )
1361 END OverrideLocation ;
1365 SetGenerateStatementNote - turn on generation of nops if necessary
1366 to generate pedalogical single stepping.
1369 PROCEDURE SetGenerateStatementNote (value: BOOLEAN) ;
1371 GenerateStatementNote := value
1372 END SetGenerateStatementNote ;
1376 GetISO - return TRUE if -fiso was present on the command line.
1379 PROCEDURE GetISO () : BOOLEAN ;
1386 GetPIM - return TRUE if -fpim was present on the command line.
1389 PROCEDURE GetPIM () : BOOLEAN ;
1396 GetPIM2 - return TRUE if -fpim2 was present on the command line.
1399 PROCEDURE GetPIM2 () : BOOLEAN ;
1406 GetPIM3 - return TRUE if -fpim3 was present on the command line.
1409 PROCEDURE GetPIM3 () : BOOLEAN ;
1416 GetPIM4 - return TRUE if -fpim4 was present on the command line.
1419 PROCEDURE GetPIM4 () : BOOLEAN ;
1426 GetPositiveModFloor - return TRUE if -fpositive-mod-floor was present
1427 on the command line.
1430 PROCEDURE GetPositiveModFloor () : BOOLEAN ;
1432 RETURN PositiveModFloorDiv
1433 END GetPositiveModFloor ;
1437 GetFloatValueCheck - return TRUE if -ffloatvalue was present on the
1441 PROCEDURE GetFloatValueCheck () : BOOLEAN ;
1443 RETURN FloatValueChecking
1444 END GetFloatValueCheck ;
1448 SetFloatValueCheck - set depending upon the -ffloatvalue.
1451 PROCEDURE SetFloatValueCheck (value: BOOLEAN) ;
1453 FloatValueChecking := value
1454 END SetFloatValueCheck ;
1458 GetWholeValueCheck - return TRUE if -fwholevalue was present on the
1462 PROCEDURE GetWholeValueCheck () : BOOLEAN ;
1464 RETURN WholeValueChecking
1465 END GetWholeValueCheck ;
1469 SetWholeValueCheck - set depending upon the -fwholevalue.
1472 PROCEDURE SetWholeValueCheck (value: BOOLEAN) ;
1474 WholeValueChecking := value
1475 END SetWholeValueCheck ;
1479 SetWall - set all warnings to, value.
1482 PROCEDURE SetWall (value: BOOLEAN) ;
1484 UnusedVariableChecking := value ;
1485 UnusedParameterChecking := value ;
1486 UninitVariableChecking := value ;
1487 PedanticCast := value ;
1488 PedanticParamNames := value ;
1489 StyleChecking := value ;
1490 CaseEnumChecking := value
1495 SetSaveTemps - turn on/off -save-temps.
1498 PROCEDURE SetSaveTemps (value: BOOLEAN) ;
1505 SetSaveTempsDir - turn on/off -save-temps and specify the directory.
1508 PROCEDURE SetSaveTempsDir (arg: ADDRESS) ;
1510 SaveTempsDir := InitStringCharStar (arg) ;
1512 END SetSaveTempsDir ;
1516 GetSaveTempsDir - return SaveTempsDir or NIL if -save-temps was not used.
1519 PROCEDURE GetSaveTempsDir () : String ;
1522 END GetSaveTempsDir ;
1526 SetDumpDir - Set the dump dir.
1529 PROCEDURE SetDumpDir (arg: ADDRESS) ;
1531 DumpDir := InitStringCharStar (arg)
1536 GetDumpDir - return DumpDir or NIL.
1539 PROCEDURE GetDumpDir () : String ;
1545 SetScaffoldDynamic - set the -fscaffold-dynamic flag.
1548 PROCEDURE SetScaffoldDynamic (value: BOOLEAN) ;
1550 ScaffoldDynamic := value ;
1553 ScaffoldStatic := FALSE
1555 END SetScaffoldDynamic ;
1559 SetScaffoldStatic - set the -fscaffold-static flag.
1562 PROCEDURE SetScaffoldStatic (value: BOOLEAN) ;
1564 ScaffoldStatic := value ;
1567 ScaffoldDynamic := FALSE
1569 END SetScaffoldStatic ;
1573 GetScaffoldDynamic - get the -fscaffold-dynamic flag.
1576 PROCEDURE GetScaffoldDynamic () : BOOLEAN ;
1578 RETURN ScaffoldDynamic
1579 END GetScaffoldDynamic ;
1583 GetScaffoldStatic - get the -fscaffold-static flag.
1586 PROCEDURE GetScaffoldStatic () : BOOLEAN ;
1588 RETURN ScaffoldStatic
1589 END GetScaffoldStatic ;
1593 SetScaffoldMain - set the -fscaffold-main flag.
1596 PROCEDURE SetScaffoldMain (value: BOOLEAN) ;
1598 ScaffoldMain := value
1599 END SetScaffoldMain ;
1603 SetRuntimeModuleOverride - set the override sequence used for module
1604 initialization and finialization.
1607 PROCEDURE SetRuntimeModuleOverride (override: ADDRESS) ;
1609 RuntimeModuleOverride := KillString (RuntimeModuleOverride) ;
1610 RuntimeModuleOverride := InitStringCharStar (override)
1611 END SetRuntimeModuleOverride ;
1615 GetRuntimeModuleOverride - return a string containing any user override
1616 or the default module initialization override
1620 PROCEDURE GetRuntimeModuleOverride () : ADDRESS ;
1622 RETURN string (RuntimeModuleOverride)
1623 END GetRuntimeModuleOverride ;
1627 SetGenModuleList - set the GenModuleList flag to true and pass
1628 set GenModuleListFilename to filename.
1631 PROCEDURE SetGenModuleList (value: BOOLEAN; filename: ADDRESS) ;
1633 GenModuleListFilename := KillString (GenModuleListFilename) ;
1636 GenModuleListFilename := InitStringCharStar (filename)
1638 GenModuleList := value
1639 END SetGenModuleList ;
1643 GetGenModuleFilename - returns the filename set by SetGenModuleList.
1646 PROCEDURE GetGenModuleFilename () : String ;
1648 RETURN GenModuleListFilename
1649 END GetGenModuleFilename ;
1653 SetShared - sets the SharedFlag to value.
1656 PROCEDURE SetShared (value: BOOLEAN) ;
1663 SetUninitVariableChecking - sets the UninitVariableChecking and
1664 UninitVariableConditionalChecking flags to value
1665 depending upon arg string. The arg string
1666 can be: "all", "known,cond", "cond,known", "known"
1670 PROCEDURE SetUninitVariableChecking (value: BOOLEAN; arg: ADDRESS) : INTEGER ;
1678 printf ("SetUninitVariableChecking (TRUE, %s)\n", arg)
1680 printf ("SetUninitVariableChecking (FALSE, %s)\n", arg)
1683 s := InitStringCharStar (arg) ;
1684 IF EqualArray (s, "all") OR
1685 EqualArray (s, "known,cond") OR
1686 EqualArray (s, "cond,known")
1688 UninitVariableChecking := value ;
1689 UninitVariableConditionalChecking := value ;
1690 s := KillString (s) ;
1692 ELSIF EqualArray (s, "known")
1694 UninitVariableChecking := value ;
1695 s := KillString (s) ;
1697 ELSIF EqualArray (s, "cond")
1699 UninitVariableConditionalChecking := value ;
1700 s := KillString (s) ;
1703 s := KillString (s) ;
1706 END SetUninitVariableChecking ;
1710 SetCaseEnumChecking - sets the CaseEnumChecking to value.
1713 PROCEDURE SetCaseEnumChecking (value: BOOLEAN) ;
1715 CaseEnumChecking := value
1716 END SetCaseEnumChecking ;
1720 SetDebugBuiltins - sets the DebugBuiltins to value.
1723 PROCEDURE SetDebugBuiltins (value: BOOLEAN) ;
1725 DebugBuiltins := value
1726 END SetDebugBuiltins ;
1730 SetIBMLongDouble - enable/disable LONGREAL to map onto the
1731 IBM long double 128 bit data type.
1732 (Only available on the ppc).
1735 PROCEDURE SetIBMLongDouble (value: BOOLEAN) ;
1737 IBMLongDouble := value ;
1740 IEEELongDouble := FALSE
1742 END SetIBMLongDouble ;
1746 GetIBMLongDouble - return the value of IBMLongDouble.
1749 PROCEDURE GetIBMLongDouble () : BOOLEAN ;
1751 RETURN IBMLongDouble
1752 END GetIBMLongDouble ;
1756 SetIEEELongDouble - enable/disable LONGREAL to map onto the
1757 IEEE long double 128 bit data type.
1758 (Only available on the ppc).
1761 PROCEDURE SetIEEELongDouble (value: BOOLEAN) ;
1763 IEEELongDouble := value ;
1766 IBMLongDouble := FALSE
1768 END SetIEEELongDouble ;
1772 GetIEEELongDouble - return the value of IEEELongDouble.
1775 PROCEDURE GetIEEELongDouble () : BOOLEAN ;
1777 RETURN IEEELongDouble
1778 END GetIEEELongDouble ;
1782 InitializeLongDoubleFlags - initialize the long double related flags
1783 with default values given during gcc configure.
1786 PROCEDURE InitializeLongDoubleFlags ;
1788 IBMLongDouble := FALSE ;
1789 IEEELongDouble := FALSE ;
1790 CASE TargetIEEEQuadDefault () OF
1793 0: IBMLongDouble := TRUE |
1794 1: IEEELongDouble := TRUE
1797 InternalError ('unexpected value returned from TargetIEEEQuadDefault ()')
1799 END InitializeLongDoubleFlags ;
1803 GetDumpDeclFilename - returns the DumpDeclFilename.
1806 PROCEDURE GetDumpDeclFilename () : String ;
1808 RETURN DumpDeclFilename
1809 END GetDumpDeclFilename ;
1813 SetDumpDeclFilename -
1816 PROCEDURE SetDumpDeclFilename (value: BOOLEAN; filename: ADDRESS) ;
1819 DumpDeclFilename := KillString (DumpDeclFilename) ;
1822 DumpDeclFilename := InitStringCharStar (filename)
1824 END SetDumpDeclFilename ;
1828 GetDumpQuadFilename - returns the DumpQuadFilename.
1831 PROCEDURE GetDumpQuadFilename () : String ;
1833 RETURN DumpQuadFilename
1834 END GetDumpQuadFilename ;
1838 SetDumpQuadFilename -
1841 PROCEDURE SetDumpQuadFilename (value: BOOLEAN; filename: ADDRESS) ;
1844 DumpQuadFilename := KillString (DumpQuadFilename) ;
1847 DumpQuadFilename := InitStringCharStar (filename)
1849 END SetDumpQuadFilename ;
1853 GetDumpGimpleFilename - returns the DumpGimpleFilename.
1856 PROCEDURE GetDumpGimpleFilename () : String ;
1858 RETURN DumpGimpleFilename
1859 END GetDumpGimpleFilename ;
1863 SetDumpGimpleFilename - set DumpGimpleFilename to filename.
1866 PROCEDURE SetDumpGimpleFilename (value: BOOLEAN; filename: ADDRESS) ;
1868 DumpGimple := value ;
1869 DumpGimpleFilename := KillString (DumpGimpleFilename) ;
1870 IF value AND (filename # NIL)
1872 DumpGimpleFilename := InitStringCharStar (filename)
1874 END SetDumpGimpleFilename ;
1878 SetM2DumpFilter - sets the filter to a comma separated list of procedures
1879 and modules. Not to be confused with SetM2Dump below
1880 which enables the class of data structures to be dumped.
1883 PROCEDURE SetM2DumpFilter (value: BOOLEAN; filter: ADDRESS) ;
1885 M2DumpFilter := KillString (M2DumpFilter) ;
1886 IF value AND (filter # NIL)
1888 M2DumpFilter := InitStringCharStar (filter)
1890 END SetM2DumpFilter ;
1894 GetM2DumpFilter - returns the dump filter.
1897 PROCEDURE GetM2DumpFilter () : ADDRESS ;
1899 IF M2DumpFilter = NIL
1903 RETURN string (M2DumpFilter)
1905 END GetM2DumpFilter ;
1909 MatchDump - enable/disable dump using value. It returns TRUE if dump
1913 PROCEDURE MatchDump (dump: String; value: BOOLEAN) : BOOLEAN ;
1915 IF EqualArray (dump, 'all')
1919 DumpGimple := value ;
1921 ELSIF EqualArray (dump, 'decl')
1925 ELSIF EqualArray (dump, 'gimple')
1927 DumpGimple := value ;
1929 ELSIF EqualArray (dump, 'quad')
1939 SetM2Dump - sets the dump via a comma separated list: quad,decl,gimple,all.
1940 It returns TRUE if the comma separated list is valid.
1943 PROCEDURE SetM2Dump (value: BOOLEAN; filter: ADDRESS) : BOOLEAN ;
1956 M2Dump := KillString (M2Dump)
1958 M2Dump := InitStringCharStar (filter) ;
1961 i := Index (M2Dump, ',', start) ;
1964 dump := Slice (M2Dump, start, 0)
1966 dump := Slice (M2Dump, start, i)
1968 result := MatchDump (dump, value) ;
1969 dump := KillString (dump) ;
1981 GetDumpGimple - return TRUE if the dump gimple flag is set from SetM2Dump.
1984 PROCEDURE GetDumpGimple () : BOOLEAN ;
1991 GetDumpQuad - return TRUE if the dump quad flag is set from SetM2Dump.
1994 PROCEDURE GetDumpQuad () : BOOLEAN ;
2001 GetDumpDecl - return TRUE if the dump decl flag is set from SetM2Dump.
2004 PROCEDURE GetDumpDecl () : BOOLEAN ;
2011 GetDumpLangGimple - return TRUE if the gimple flag is set from SetM2Dump.
2014 PROCEDURE GetDumpGimple () : BOOLEAN ;
2021 cflag := FALSE ; (* -c. *)
2022 RuntimeModuleOverride := InitString (DefaultRuntimeModuleOverride) ;
2023 CppArgs := InitString ('') ;
2028 PositiveModFloorDiv := FALSE ;
2030 SeenSources := FALSE ;
2031 Statistics := FALSE ;
2032 StyleChecking := FALSE ;
2033 CompilerDebugging := FALSE ;
2034 GenerateDebugging := FALSE ;
2035 Optimizing := FALSE ;
2040 Profiling := FALSE ;
2042 OptimizeBasicBlock := FALSE ;
2043 OptimizeUncalledProcedures := FALSE ;
2044 OptimizeCommonSubExpressions := FALSE ;
2045 NilChecking := FALSE ;
2046 WholeDivChecking := FALSE ;
2047 WholeValueChecking := FALSE ;
2048 FloatValueChecking := FALSE ;
2049 IndexChecking := FALSE ;
2050 RangeChecking := FALSE ;
2051 ReturnChecking := FALSE ;
2052 CaseElseChecking := FALSE ;
2053 CPreProcessor := FALSE ;
2054 LineDirectives := TRUE ;
2055 ExtendedOpaque := FALSE ;
2056 UnboundedByReference := FALSE ;
2057 VerboseUnbounded := FALSE ;
2058 PedanticParamNames := FALSE ;
2059 PedanticCast := FALSE ;
2061 DumpSystemExports := FALSE ;
2062 GenerateSwig := FALSE ;
2063 Exceptions := TRUE ;
2064 DebugBuiltins := FALSE ;
2065 ForcedLocation := FALSE ;
2066 WholeProgram := FALSE ;
2067 DebugTraceQuad := FALSE ;
2068 DebugTraceTree := FALSE ;
2069 DebugTraceLine := FALSE ;
2070 DebugTraceToken := FALSE ;
2071 DebugFunctionLineNumbers := FALSE ;
2072 GenerateStatementNote := FALSE ;
2073 LowerCaseKeywords := FALSE ;
2074 UnusedVariableChecking := FALSE ;
2075 UnusedParameterChecking := FALSE ;
2076 StrictTypeChecking := TRUE ;
2078 SaveTemps := FALSE ;
2079 ScaffoldDynamic := TRUE ;
2080 ScaffoldStatic := FALSE ;
2081 ScaffoldMain := FALSE ;
2082 UselistFilename := NIL ;
2083 GenModuleList := FALSE ;
2084 GenModuleListFilename := NIL ;
2085 SharedFlag := FALSE ;
2091 SaveTempsDir := NIL ;
2093 UninitVariableChecking := FALSE ;
2094 UninitVariableConditionalChecking := FALSE ;
2095 CaseEnumChecking := FALSE ;
2101 InitializeLongDoubleFlags ;
2102 M2Prefix := InitString ('') ;
2103 M2PathName := InitString ('') ;
2104 DumpQuadFilename := NIL ;
2105 DumpGimpleFilename := NIL ;
2106 DumpDeclFilename := NIL ;
2109 DumpGimple := FALSE ;