]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/m2/gm2-compiler/M2Options.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-compiler / M2Options.def
CommitLineData
1eee94d3
GM
1(* M2Options.def initializes the user options.
2
83ffe9cd 3Copyright (C) 2001-2023 Free Software Foundation, Inc.
1eee94d3
GM
4Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
5
6This file is part of GNU Modula-2.
7
8GNU Modula-2 is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GNU Modula-2 is distributed in the hope that it will be useful, but
14WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GNU Modula-2; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. *)
21
22DEFINITION MODULE M2Options ;
23
24(*
25 Author : Gaius Mulley
26 Title : M2Options
27 Date : 27/5/87 [$Date: 2013/08/14 20:39:40 $]
28 SYSTEM : UNIX (GNU Modula-2)
29 Description: Initializes the user options in the Modula-2 compiler.
30 Version : $Revision: 1.31 $
31*)
32
33FROM SYSTEM IMPORT ADDRESS ;
34FROM DynamicStrings IMPORT String ;
35FROM m2linemap IMPORT location_t ;
36
37EXPORT QUALIFIED SetReturnCheck, SetNilCheck, SetCaseCheck,
38 SetCheckAll, SetVerboseUnbounded, SetQuiet, SetCpp, GetCpp,
39 (* SetMakeall, SetMakeall0, SetIncludePath, *) SetAutoInit,
40 SetUnboundedByReference,
41 SetSearchPath, SetISO, SetPIM, SetPIM2, SetPIM3, SetPIM4,
42 SetPositiveModFloor, SetCompilerDebugging, SetExceptions,
43 SetStyle, SetPedantic, SetPedanticParamNames, SetPedanticCast,
44 SetExtendedOpaque, SetXCode, SetQuadDebugging, SetSources,
45 SetDumpSystemExports,
46 SetSwig, SetOptimizing, SetForcedLocation,
47 SetCC1Quiet, SetWholeProgram, SetDebugTraceQuad, SetDebugTraceAPI,
48 SetVerbose, SetM2g, GetM2g,
49 GetISO, GetPIM, GetPIM2, GetPIM3, GetPIM4,
50 GetPositiveModFloor,
51 SetFloatValueCheck, GetFloatValueCheck,
52 SetWholeValueCheck, GetWholeValueCheck,
53 SetLowerCaseKeywords,
54 SetIndex, SetRange, SetWholeDiv, SetStrictTypeChecking,
55 Setc, Getc, SetUselist, GetUselist, GetUselistFilename,
56 SetShared, SetB,
57
58 Iso, Pim, Pim2, Pim3, Pim4,
59 cflag,
60 PositiveModFloorDiv,
61 Pedantic, Verbose, Statistics,
62 UnboundedByReference, VerboseUnbounded,
63 Profiling, Coding, Optimizing,
64 OptimizeBasicBlock, OptimizeUncalledProcedures,
65 OptimizeCommonSubExpressions,
66 StyleChecking, WholeProgram,
67 NilChecking,
68 WholeDivChecking, WholeValueChecking,
69 IndexChecking, RangeChecking,
70 ReturnChecking, CaseElseChecking,
71 AutoInit,
72 VariantValueChecking,
73 UnusedVariableChecking, UnusedParameterChecking,
74 SetUnusedVariableChecking, SetUnusedParameterChecking,
75 Quiet, LineDirectives, StrictTypeChecking,
76 CPreProcessor, Xcode, ExtendedOpaque,
77 LowerCaseKeywords,
78 PedanticParamNames, PedanticCast,
79 DisplayQuadruples, DebugTraceQuad, DebugTraceAPI,
80 CompilerDebugging, GenerateDebugging, GenerateLineDebug,
81 DumpSystemExports, GenerateSwig, Exceptions,
82 OverrideLocation, FinaliseOptions,
83 DebugBuiltins, setdefextension, setmodextension,
84 SetStatistics, SetWall,
85 SetSaveTemps, SetSaveTempsDir, SaveTemps, GetSaveTempsDir,
86 GenModuleList,
87 CppArg, CppCommandLine, CppRemember,
88 SetDebugFunctionLineNumbers, DebugFunctionLineNumbers,
89 SetGenerateStatementNote, GenerateStatementNote,
90 ScaffoldDynamic, ScaffoldStatic,
91 SetScaffoldDynamic, SetScaffoldStatic,
92 SetScaffoldMain, ScaffoldMain,
93 SetRuntimeModuleOverride, GetRuntimeModuleOverride,
94 SetGenModuleList, GetGenModuleFilename, SharedFlag,
95 GetB ;
96
97
98VAR
99 cflag, (* -c flag present? *)
100 Iso, (* -fiso use ISO SYSTEM.def *)
101 Pim, (* -fpim use PIM [234] SYSTEM.def *)
102 Pim2, (* -fpim2 use strict rules. *)
103 Pim3, (* -fpim3 use strict rules. *)
104 Pim4, (* -fpim4 use strict rules. *)
105 PositiveModFloorDiv, (* Force PIM4 behaviour for DIV and MOD *)
106 CompilerDebugging, (* -fd internal debugging messages *)
107 DebugTraceQuad, (* -fdebug-trace-quad *)
108 DebugTraceAPI, (* -fdebug-trace-api *)
109 GenerateDebugging, (* -g option to generate info for gdb/dbx *)
110 GenerateLineDebug, (* -gline to generate line debugging. *)
111 Verbose, (* -verbose produce verbose error messages. *)
112 Pedantic, (* -pedantic be pedantic on error checking. *)
113 PedanticParamNames, (* -Wpedantic-param-names *)
114 PedanticCast, (* -Wpedantic-cast warns if sizes differ. *)
115 Statistics, (* -fstatistics information about code *)
116 StyleChecking, (* -Wstudents checks for common student errs*)
117 DisplayQuadruples, (* -Wq option will display quadruples. *)
118 UnboundedByReference, (* -funbounded-by-reference *)
119 VerboseUnbounded, (* -Wverbose-unbounded *)
120 OptimizeUncalledProcedures, (* -Ouncalled removes uncalled procedures *)
121 OptimizeBasicBlock, (* -Obb create basic blocks and optimize. *)
122 OptimizeCommonSubExpressions, (* -Ocse optimize common subexpressions *)
123 WholeProgram, (* -fwhole-program optimization. *)
124 NilChecking, (* -fnil makes compiler test for pointer *)
125 (* NIL. *)
126 WholeDivChecking, (* -fwholediv produces code to raise an *)
127 (* exception if a whole number divide by *)
128 (* zero occurs. *)
129 WholeValueChecking, (* -fwholevalue produces code to raise an *)
130 (* exception if a whole value variable is *)
131 (* about to exceed the type limits. *)
132 FloatValueChecking, (* -ffloatvalue produces code to raise an *)
133 (* exception if a floating point variable *)
134 (* is about to exceed the type limits. *)
135 IndexChecking, (* -findex array bounds checking. *)
136 RangeChecking, (* -frange assignment, set values, *)
137 (* constructor values in range. *)
138 ReturnChecking, (* -freturn checks that functions always *)
139 (* exit with a RETURN statement. *)
140 CaseElseChecking, (* -fcase checks program does not need an *)
141 (* else statement within an case statement *)
142 (* when the user omits one *)
143 VariantValueChecking, (* Should we check all values are present *)
144 (* in a variant record? True for ISO and *)
145 (* false for PIM. *)
146 Quiet, (* -fquiet option specified. *)
147 LineDirectives, (* Should compiler understand preprocessor *)
148 (* # linenumber "filename" markers? *)
149 StrictTypeChecking, (* -fm2-strict-type experimental checker. *)
150 CPreProcessor, (* Must we run the cpp on the source? *)
151 Xcode, (* Should errors follow Xcode format? *)
152 ExtendedOpaque, (* Do we allow non pointer opaque types? *)
153 DumpSystemExports, (* Print all inbuilt system items? *)
154 GenerateSwig, (* Should we generate a swig interface file?*)
155 Exceptions, (* Should we generate exception code? *)
156 UnusedVariableChecking, (* Should we warn about unused variables? *)
157 UnusedParameterChecking, (* Should we warn about unused parameters? *)
158 LowerCaseKeywords, (* Should keywords in errors be in lower? *)
159 DebugBuiltins, (* Should we always call a real function? *)
160 AutoInit, (* -fauto-init assigns pointers to NIL. *)
161 SaveTemps, (* -save-temps save all temporary files. *)
162 ScaffoldDynamic, (* Should we generate a dynamic scaffold? *)
163 ScaffoldStatic, (* Should we generate a static scaffold? *)
164 ScaffoldMain, (* Should we generate a main function? *)
165 GenModuleList, (* Should the compiler generate a list of *)
166 (* all modules used? *)
167 SharedFlag, (* -fshared indicating this module needs *)
168 (* the shared library version of the *)
169 (* scaffold. *)
170 ForcedLocation,
171 DebugFunctionLineNumbers,
172 GenerateStatementNote,
173 Optimizing,
174 Coding,
175 Profiling : BOOLEAN ;
176
177
178(*
179 Setc - set the cflag (compile only flag -c) to value.
180*)
181
182PROCEDURE Setc (value: BOOLEAN) ;
183
184
185(*
186 Getc - get the cflag (compile only flag -c).
187*)
188
189PROCEDURE Getc () : BOOLEAN ;
190
191
192(*
193 SetB - assigns Barg to arg.
194*)
195
196PROCEDURE SetB (arg: ADDRESS) ;
197
198
199(*
200 GetB - returns argument to the -B option as a string or NIL if it were never set.
201*)
202
203PROCEDURE GetB () : ADDRESS ;
204
205
206(*
207 SetScaffoldDynamic - set the -fscaffold-dynamic flag.
208*)
209
210PROCEDURE SetScaffoldDynamic (value: BOOLEAN) ;
211
212
213(*
214 SetScaffoldStatic - set the -fscaffold-static flag.
215*)
216
217PROCEDURE SetScaffoldStatic (value: BOOLEAN) ;
218
219
220(*
221 GetScaffoldDynamic - get the -fscaffold-dynamic flag.
222*)
223
224PROCEDURE GetScaffoldDynamic () : BOOLEAN ;
225
226
227(*
228 GetScaffoldStatic - get the -fscaffold-static flag.
229*)
230
231PROCEDURE GetScaffoldStatic () : BOOLEAN ;
232
233
234(*
235 SetScaffoldMain - set the -fscaffold-main flag.
236*)
237
238PROCEDURE SetScaffoldMain (value: BOOLEAN) ;
239
240
241(*
242 SetRuntimeModuleOverride - set the override sequence used for module
243 initialization and finialization.
244*)
245
246PROCEDURE SetRuntimeModuleOverride (override: ADDRESS) ;
247
248
249(*
250 GetRuntimeModuleOverride - return a string containing any user override
251 or the default module initialization override
252 sequence.
253*)
254
255PROCEDURE GetRuntimeModuleOverride () : ADDRESS ;
256
257
258(*
259 SetUselist - set the uselist flag to value and remember the filename.
260*)
261
262PROCEDURE SetUselist (value: BOOLEAN; filename: ADDRESS) ;
263
264
265(*
266 GetUselist - return the uselist flag.
267*)
268
269PROCEDURE GetUselist () : BOOLEAN ;
270
271
272(*
273 GetUselistFilename - return the uselist filename as a String.
274*)
275
276PROCEDURE GetUselistFilename () : String ;
277
278
279(*
280 SetWholeProgram - sets the WholeProgram flag (-fwhole-program).
281*)
282
283PROCEDURE SetWholeProgram (value: BOOLEAN) ;
284
285
286(*
287 SetAutoInit - set the auto initialization flag to value. If the value
288 is true then all pointers are automatically
289 initialized to NIL.
290*)
291
292PROCEDURE SetAutoInit (value: BOOLEAN) : BOOLEAN ;
293
294
295(*
296 SetReturnCheck - set return statement checking in procedure functions
297 to value.
298*)
299
300PROCEDURE SetReturnCheck (value: BOOLEAN) : BOOLEAN ;
301
302
303(*
304 SetNilCheck - set access through NIL violation runtime checking to value.
305*)
306
307PROCEDURE SetNilCheck (value: BOOLEAN) : BOOLEAN ;
308
309
310(*
311 SetCaseCheck - set else case checking to, value.
312*)
313
314PROCEDURE SetCaseCheck (value: BOOLEAN) : BOOLEAN ;
315
316
317(*
318 SetCheckAll - set all runtime checking to, value.
319*)
320
321PROCEDURE SetCheckAll (value: BOOLEAN) : BOOLEAN ;
322
323
324(*
325 SetVerboseUnbounded - sets the VerboseUnbounded flag to, value.
326*)
327
328PROCEDURE SetVerboseUnbounded (value: BOOLEAN) : BOOLEAN ;
329
330
331(*
332 SetQuiet - sets the quiet flag to, value.
333*)
334
335PROCEDURE SetQuiet (value: BOOLEAN) : BOOLEAN ;
336
337
338(*
339 SetCC1Quiet - sets the cc1quiet flag to, value.
340*)
341
342PROCEDURE SetCC1Quiet (value: BOOLEAN) ;
343
344
345(*
346 SetCpp -
347*)
348
349PROCEDURE SetCpp (value: BOOLEAN) : BOOLEAN ;
350
351
352(*
353 GetCpp - returns TRUE if the C preprocessor was used.
354*)
355
356PROCEDURE GetCpp () : BOOLEAN ;
357
358
359(*
360 SetM2g - set the -fm2-g flag.
361*)
362
363PROCEDURE SetM2g (value: BOOLEAN) : BOOLEAN ;
364
365
366(*
367 GetM2g - returns TRUE if the -fm2-g flags was used.
368*)
369
370PROCEDURE GetM2g () : BOOLEAN ;
371
372
373(*
374 SetLowerCaseKeywords - set the lower case keyword flag and return the result.
375*)
376
377PROCEDURE SetLowerCaseKeywords (value: BOOLEAN) : BOOLEAN ;
378
379
380(*
381 SetMakeall -
382
383PROCEDURE SetMakeall (value: BOOLEAN) : BOOLEAN ;
384*)
385
386
387(*
388 SetMakeall0 -
389
390PROCEDURE SetMakeall0 (value: BOOLEAN) : BOOLEAN ;
391*)
392
393
394(*
395 SetIncludePath -
396
397PROCEDURE SetIncludePath (arg: ADDRESS) : BOOLEAN ;
398*)
399
400
401(*
402 SetUnboundedByReference -
403*)
404
405PROCEDURE SetUnboundedByReference (value: BOOLEAN) : BOOLEAN ;
406
407
408(*
409 SetSearchPath -
410*)
411
412PROCEDURE SetSearchPath (arg: ADDRESS) ;
413
414
415(*
416 SetISO -
417*)
418
419PROCEDURE SetISO (value: BOOLEAN) ;
420
421
422(*
423 SetPIM -
424*)
425
426PROCEDURE SetPIM (value: BOOLEAN) ;
427
428
429(*
430 SetPIM2 -
431*)
432
433PROCEDURE SetPIM2 (value: BOOLEAN) ;
434
435
436(*
437 SetPIM3 -
438*)
439
440PROCEDURE SetPIM3 (value: BOOLEAN) ;
441
442
443(*
444 SetPIM4 -
445*)
446
447PROCEDURE SetPIM4 (value: BOOLEAN) ;
448
449
450(*
451 SetPositiveModFloor -
452*)
453
454PROCEDURE SetPositiveModFloor (value: BOOLEAN) ;
455
456
457(*
458 SetWholeDiv - sets the whole division flag.
459*)
460
461PROCEDURE SetWholeDiv (value: BOOLEAN) ;
462
463
464(*
465 SetIndex - sets the runtime array index checking flag.
466*)
467
468PROCEDURE SetIndex (value: BOOLEAN) ;
469
470
471(*
472 SetRange - sets the runtime range checking flag.
473*)
474
475PROCEDURE SetRange (value: BOOLEAN) ;
476
477
478(*
479 SetExceptions -
480*)
481
482PROCEDURE SetExceptions (value: BOOLEAN) ;
483
484
485(*
486 SetStyle -
487*)
488
489PROCEDURE SetStyle (value: BOOLEAN) ;
490
491
492(*
493 SetPedantic -
494*)
495
496PROCEDURE SetPedantic (value: BOOLEAN) ;
497
498
499(*
500 SetPedanticParamNames -
501*)
502
503PROCEDURE SetPedanticParamNames (value: BOOLEAN) ;
504
505
506(*
507 SetPedanticCast -
508*)
509
510PROCEDURE SetPedanticCast (value: BOOLEAN) ;
511
512
513(*
514 SetExtendedOpaque -
515*)
516
517PROCEDURE SetExtendedOpaque (value: BOOLEAN) ;
518
519
520(*
521 SetXCode -
522*)
523
524PROCEDURE SetXCode (value: BOOLEAN) ;
525
526
527(*
528 SetCompilerDebugging - turn on internal compiler debugging.
529*)
530
531PROCEDURE SetCompilerDebugging (value: BOOLEAN) ;
532
533
534(*
535 SetQuadDebugging - display the quadruples (internal debugging).
536*)
537
538PROCEDURE SetQuadDebugging (value: BOOLEAN) ;
539
540
541(*
542 SetDebugTraceQuad -
543*)
544
545PROCEDURE SetDebugTraceQuad (value: BOOLEAN) ;
546
547
548(*
549 SetDebugTraceAPI -
550*)
551
552PROCEDURE SetDebugTraceAPI (value: BOOLEAN) ;
553
554
555(*
556 SetDebugFunctionLineNumbers - turn DebugFunctionLineNumbers on/off
557 (used internally for debugging).
558*)
559
560PROCEDURE SetDebugFunctionLineNumbers (value: BOOLEAN) ;
561
562
563(*
564 SetGenerateStatementNote - turn on generation of nops if necessary
565 to generate pedalogical single stepping.
566*)
567
568PROCEDURE SetGenerateStatementNote (value: BOOLEAN) ;
569
570
571(*
572 SetSources -
573*)
574
575PROCEDURE SetSources (value: BOOLEAN) ;
576
577
578(*
579 SetDumpSystemExports -
580*)
581
582PROCEDURE SetDumpSystemExports (value: BOOLEAN) ;
583
584
585(*
586 SetSwig -
587*)
588
589PROCEDURE SetSwig (value: BOOLEAN) ;
590
591
592(*
593 SetOptimizing -
594*)
595
596PROCEDURE SetOptimizing (value: CARDINAL) ;
597
598
599(*
600 OverrideLocation - possibly override the location value, depending upon
601 whether the -flocation= option was used.
602*)
603
604PROCEDURE OverrideLocation (location: location_t) : location_t ;
605
606
607(*
608 SetForcedLocation - sets the location for the lifetime of this compile to, location.
609 This is primarily an internal debugging switch.
610*)
611
612PROCEDURE SetForcedLocation (location: location_t) ;
613
614
615(*
616 SetUnusedVariableChecking - assigns the UnusedVariableChecking to value.
617*)
618
619PROCEDURE SetUnusedVariableChecking (value: BOOLEAN) ;
620
621
622(*
623 SetUnusedParameterChecking - assigns the UnusedParameterChecking to value.
624*)
625
626PROCEDURE SetUnusedParameterChecking (value: BOOLEAN) ;
627
628
629(*
630 SetStrictTypeChecking - assigns the StrictTypeChecking flag to value.
631*)
632
633PROCEDURE SetStrictTypeChecking (value: BOOLEAN) ;
634
635
636(*
637 setdefextension -
638*)
639
640PROCEDURE setdefextension (arg: ADDRESS) ;
641
642
643(*
644 setmodextension -
645*)
646
647PROCEDURE setmodextension (arg: ADDRESS) ;
648
649
650(*
651 SetStatistics - turn on/off generate of compile time statistics.
652*)
653
654PROCEDURE SetStatistics (on: BOOLEAN) ;
655
656
657(*
658 SetVerbose - set the Verbose flag to, value. It returns TRUE.
659*)
660
661PROCEDURE SetVerbose (value: BOOLEAN) : BOOLEAN ;
662
663
664(*
665 CppArg - sets the option and arg in the cpp command line.
666*)
667
668PROCEDURE CppArg (opt, arg: ADDRESS; joined: BOOLEAN) ;
669
670
671(*
672 CppCommandLine - returns the Cpp command line and all arguments.
673*)
674
675PROCEDURE CppCommandLine () : String ;
676
677
678(*
679 CppRemember - remember a string, s, as a cpp related argument.
680 The string, s, is not garbage collected.
681*)
682
683PROCEDURE CppRemember (s: String) ;
684
685
686(*
687 GetISO - return TRUE if -fiso was present on the command line.
688*)
689
690PROCEDURE GetISO () : BOOLEAN ;
691
692
693(*
694 GetPIM - return TRUE if -fpim was present on the command line.
695*)
696
697PROCEDURE GetPIM () : BOOLEAN ;
698
699
700(*
701 GetPIM2 - return TRUE if -fpim2 was present on the command line.
702*)
703
704PROCEDURE GetPIM2 () : BOOLEAN ;
705
706
707(*
708 GetPIM3 - return TRUE if -fpim3 was present on the command line.
709*)
710
711PROCEDURE GetPIM3 () : BOOLEAN ;
712
713
714(*
715 GetPIM4 - return TRUE if -fpim4 was present on the command line.
716*)
717
718PROCEDURE GetPIM4 () : BOOLEAN ;
719
720
721(*
722 GetPositiveModFloor - return TRUE if -fpositive-mod-floor was present
723 on the command line.
724*)
725
726PROCEDURE GetPositiveModFloor () : BOOLEAN ;
727
728
729(*
730 GetFloatValueCheck - return TRUE if -ffloatvalue was present on the
731 command line.
732*)
733
734PROCEDURE GetFloatValueCheck () : BOOLEAN ;
735
736
737(*
738 SetFloatValueCheck - set depending upon the -ffloatvalue.
739*)
740
741PROCEDURE SetFloatValueCheck (value: BOOLEAN) ;
742
743
744(*
745 GetWholeValueCheck - return TRUE if -fwholevalue was present on the
746 command line.
747*)
748
749PROCEDURE GetWholeValueCheck () : BOOLEAN ;
750
751
752(*
753 SetWholeValueCheck - set depending upon the -fwholevalue.
754*)
755
756PROCEDURE SetWholeValueCheck (value: BOOLEAN) ;
757
758
759(*
760 SetWall - set all warnings to, value.
761*)
762
763PROCEDURE SetWall (value: BOOLEAN) ;
764
765
766(*
767 SetSaveTemps - turn on/off -save-temps.
768*)
769
770PROCEDURE SetSaveTemps (value: BOOLEAN) ;
771
772
773(*
774 SetSaveTempsDir - turn on/off -save-temps specifying the
775 directory.
776*)
777
778PROCEDURE SetSaveTempsDir (arg: ADDRESS) ;
779
780
781(*
782 GetSaveTempsDir - return SaveTempsDir or NIL if -save-temps was not used.
783*)
784
785PROCEDURE GetSaveTempsDir () : String ;
786
787
788(*
789 SetGenModuleList - set the GenModuleList flag to value and pass
790 set GenModuleListFilename to filename.
791*)
792
793PROCEDURE SetGenModuleList (value: BOOLEAN; filename: ADDRESS) ;
794
795
796(*
797 GetGenModuleFilename - returns the filename set by SetGenModuleList.
798*)
799
800PROCEDURE GetGenModuleFilename () : String ;
801
802
803(*
804 SetShared - sets the SharedFlag to value.
805*)
806
807PROCEDURE SetShared (value: BOOLEAN) ;
808
809
810(*
811 FinaliseOptions - once all options have been parsed we set any inferred
812 values.
813*)
814
815PROCEDURE FinaliseOptions ;
816
817
818END M2Options.