Branch data Line data Source code
1 : : /* do not edit automatically generated by mc from M2Options. */
2 : : /* M2Options.mod initializes the user options.
3 : :
4 : : Copyright (C) 2001-2025 Free Software Foundation, Inc.
5 : : Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 : :
7 : : This file is part of GNU Modula-2.
8 : :
9 : : GNU Modula-2 is free software; you can redistribute it and/or modify
10 : : it under the terms of the GNU General Public License as published by
11 : : the Free Software Foundation; either version 3, or (at your option)
12 : : any later version.
13 : :
14 : : GNU Modula-2 is distributed in the hope that it will be useful, but
15 : : WITHOUT ANY WARRANTY; without even the implied warranty of
16 : : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 : : General Public License for more details.
18 : :
19 : : You should have received a copy of the GNU General Public License
20 : : along with GNU Modula-2; see the file COPYING3. If not see
21 : : <http://www.gnu.org/licenses/>. */
22 : :
23 : : #include "config.h"
24 : : #include "system.h"
25 : : #include "gcc-consolidation.h"
26 : :
27 : : #include <stdbool.h>
28 : : # if !defined (PROC_D)
29 : : # define PROC_D
30 : : typedef void (*PROC_t) (void);
31 : : typedef struct { PROC_t proc; } PROC;
32 : : # endif
33 : :
34 : : # if !defined (TRUE)
35 : : # define TRUE (1==1)
36 : : # endif
37 : :
38 : : # if !defined (FALSE)
39 : : # define FALSE (1==0)
40 : : # endif
41 : :
42 : : #if defined(__cplusplus)
43 : : # undef NULL
44 : : # define NULL 0
45 : : #endif
46 : : #define _M2Options_C
47 : :
48 : : #include "GM2Options.h"
49 : : # include "GCmdArgs.h"
50 : : # include "GSArgs.h"
51 : : # include "GM2Search.h"
52 : : # include "GPathName.h"
53 : : # include "GM2Printf.h"
54 : : # include "GFIO.h"
55 : : # include "Glibc.h"
56 : : # include "GDebug.h"
57 : : # include "Ggcctypes.h"
58 : : # include "Gm2configure.h"
59 : : # include "GM2Error.h"
60 : : # include "GFormatStrings.h"
61 : : # include "Gm2misc.h"
62 : : # include "GDynamicStrings.h"
63 : :
64 : : # define Debugging false
65 : : # define DefaultRuntimeModuleOverride "m2iso:RTentity,m2iso:Storage,m2iso:SYSTEM,m2iso:M2RTS,m2iso:RTExceptions,m2iso:IOLink"
66 : : static DynamicStrings_String DumpDeclFilename;
67 : : static DynamicStrings_String DumpQuadFilename;
68 : : static DynamicStrings_String DumpGimpleFilename;
69 : : static DynamicStrings_String M2Dump;
70 : : static DynamicStrings_String M2DumpFilter;
71 : : static DynamicStrings_String M2Prefix;
72 : : static DynamicStrings_String M2PathName;
73 : : static DynamicStrings_String Barg;
74 : : static DynamicStrings_String MFarg;
75 : : static DynamicStrings_String MTFlag;
76 : : static DynamicStrings_String MQFlag;
77 : : static DynamicStrings_String DepTarget;
78 : : static DynamicStrings_String CmdLineObj;
79 : : static DynamicStrings_String SaveTempsDir;
80 : : static DynamicStrings_String DumpDir;
81 : : static DynamicStrings_String GenModuleListFilename;
82 : : static DynamicStrings_String UselistFilename;
83 : : static DynamicStrings_String RuntimeModuleOverride;
84 : : static DynamicStrings_String CppArgs;
85 : : static bool EnableForward;
86 : : static bool DebugFunctionLineNumbers;
87 : : static bool DebugTraceQuad;
88 : : static bool DebugTraceLine;
89 : : static bool DebugTraceToken;
90 : : static bool DebugTraceTree;
91 : : static bool DumpDecl;
92 : : static bool DumpGimple;
93 : : static bool DumpQuad;
94 : : static bool WidesetFlag;
95 : : static bool MFlag;
96 : : static bool MMFlag;
97 : : static bool MPFlag;
98 : : static bool MDFlag;
99 : : static bool MMDFlag;
100 : : static bool IBMLongDouble;
101 : : static bool IEEELongDouble;
102 : : static bool UselistFlag;
103 : : static bool CC1Quiet;
104 : : static bool SeenSources;
105 : : static unsigned int OffTBits;
106 : : static location_t ForcedLocationValue;
107 : :
108 : : /*
109 : : SetM - set the MFlag.
110 : : */
111 : :
112 : : extern "C" void M2Options_SetM (bool value);
113 : :
114 : : /*
115 : : GetM - set the MFlag.
116 : : */
117 : :
118 : : extern "C" bool M2Options_GetM (void);
119 : :
120 : : /*
121 : : SetMM - set the MMFlag.
122 : : */
123 : :
124 : : extern "C" void M2Options_SetMM (bool value);
125 : :
126 : : /*
127 : : GetMM - set the MMFlag.
128 : : */
129 : :
130 : : extern "C" bool M2Options_GetMM (void);
131 : :
132 : : /*
133 : : SetMF - assigns MFarg to the filename from arg.
134 : : */
135 : :
136 : : extern "C" void M2Options_SetMF (void * arg);
137 : :
138 : : /*
139 : : GetMF - returns MFarg or NIL if never set.
140 : : */
141 : :
142 : : extern "C" void * M2Options_GetMF (void);
143 : :
144 : : /*
145 : : SetM2Prefix - assign arg to M2Prefix.
146 : : */
147 : :
148 : : extern "C" void M2Options_SetM2Prefix (void * arg);
149 : :
150 : : /*
151 : : GetM2Prefix - return M2Prefix as a C string.
152 : : */
153 : :
154 : : extern "C" void * M2Options_GetM2Prefix (void);
155 : :
156 : : /*
157 : : SetM2PathName - assign arg to M2PathName.
158 : : */
159 : :
160 : : extern "C" void M2Options_SetM2PathName (void * arg);
161 : :
162 : : /*
163 : : GetM2PathName - return M2PathName as a C string.
164 : : */
165 : :
166 : : extern "C" void * M2Options_GetM2PathName (void);
167 : :
168 : : /*
169 : : SetPPOnly - set the PPonly (preprocess only) to value.
170 : : */
171 : :
172 : : extern "C" void M2Options_SetPPOnly (bool value);
173 : :
174 : : /*
175 : : GetPPOnly - get the PPonly (preprocess only).
176 : : */
177 : :
178 : : extern "C" bool M2Options_GetPPOnly (void);
179 : :
180 : : /*
181 : : Setc - set the cflag (compile only flag -c) to value.
182 : : */
183 : :
184 : : extern "C" void M2Options_Setc (bool value);
185 : :
186 : : /*
187 : : Getc - get the cflag (compile only flag -c).
188 : : */
189 : :
190 : : extern "C" bool M2Options_Getc (void);
191 : :
192 : : /*
193 : : SetB - assigns Barg to arg.
194 : : */
195 : :
196 : : extern "C" void M2Options_SetB (void * arg);
197 : :
198 : : /*
199 : : GetB - returns Barg value as a C string or NIL if it was never set.
200 : : */
201 : :
202 : : extern "C" void * M2Options_GetB (void);
203 : :
204 : : /*
205 : : SetMD - set the MDFlag to value.
206 : : */
207 : :
208 : : extern "C" void M2Options_SetMD (bool value);
209 : :
210 : : /*
211 : : GetMD - return the MDFlag.
212 : : */
213 : :
214 : : extern "C" bool M2Options_GetMD (void);
215 : :
216 : : /*
217 : : SetMMD - set the MMDFlag to value.
218 : : */
219 : :
220 : : extern "C" void M2Options_SetMMD (bool value);
221 : :
222 : : /*
223 : : GetMMD - return the MMDFlag.
224 : : */
225 : :
226 : : extern "C" bool M2Options_GetMMD (void);
227 : :
228 : : /*
229 : : SetMQ - adds a quoted target arg to the DepTarget sentence.
230 : : */
231 : :
232 : : extern "C" void M2Options_SetMQ (void * arg);
233 : :
234 : : /*
235 : : GetMQ - returns a C string containing all the -MQ arg values.
236 : : */
237 : :
238 : : extern "C" void * M2Options_GetMQ (void);
239 : :
240 : : /*
241 : : SetMT - adds a target arg to the DepTarget sentence.
242 : : */
243 : :
244 : : extern "C" void M2Options_SetMT (void * arg);
245 : :
246 : : /*
247 : : GetMT - returns a C string containing all the -MT arg values.
248 : : */
249 : :
250 : : extern "C" void * M2Options_GetMT (void);
251 : :
252 : : /*
253 : : GetDepTarget - returns the DepTarget as a C string.
254 : : */
255 : :
256 : : extern "C" void * M2Options_GetDepTarget (void);
257 : :
258 : : /*
259 : : SetMP - set the MPflag to value.
260 : : */
261 : :
262 : : extern "C" void M2Options_SetMP (bool value);
263 : :
264 : : /*
265 : : GetMP - get the MPflag.
266 : : */
267 : :
268 : : extern "C" bool M2Options_GetMP (void);
269 : :
270 : : /*
271 : : SetObj - assigns CmdLineObj to the filename from arg.
272 : : */
273 : :
274 : : extern "C" void M2Options_SetObj (void * arg);
275 : :
276 : : /*
277 : : GetObj - returns CmdLineObj filename as a c-string or NIL if it was never set.
278 : : */
279 : :
280 : : extern "C" void * M2Options_GetObj (void);
281 : :
282 : : /*
283 : : SetCpp - enables the source to be preprocessed and enables the
284 : : recognition of C preprocessor line directives.
285 : : */
286 : :
287 : : extern "C" bool M2Options_SetCpp (bool value);
288 : :
289 : : /*
290 : : GetCpp - returns TRUE if the C preprocessor was used.
291 : : */
292 : :
293 : : extern "C" bool M2Options_GetCpp (void);
294 : :
295 : : /*
296 : : GetLineDirectives - returns TRUE if line directives are allowed.
297 : : */
298 : :
299 : : extern "C" bool M2Options_GetLineDirectives (void);
300 : :
301 : : /*
302 : : SetScaffoldDynamic - set the -fscaffold-dynamic flag.
303 : : */
304 : :
305 : : extern "C" void M2Options_SetScaffoldDynamic (bool value);
306 : :
307 : : /*
308 : : SetScaffoldStatic - set the -fscaffold-static flag.
309 : : */
310 : :
311 : : extern "C" void M2Options_SetScaffoldStatic (bool value);
312 : :
313 : : /*
314 : : GetScaffoldDynamic - get the -fscaffold-dynamic flag.
315 : : */
316 : :
317 : : extern "C" bool M2Options_GetScaffoldDynamic (void);
318 : :
319 : : /*
320 : : GetScaffoldStatic - get the -fscaffold-static flag.
321 : : */
322 : :
323 : : extern "C" bool M2Options_GetScaffoldStatic (void);
324 : :
325 : : /*
326 : : SetScaffoldMain - set the -fscaffold-main flag.
327 : : */
328 : :
329 : : extern "C" void M2Options_SetScaffoldMain (bool value);
330 : :
331 : : /*
332 : : SetRuntimeModuleOverride - set the override sequence used for module
333 : : initialization and finialization.
334 : : */
335 : :
336 : : extern "C" void M2Options_SetRuntimeModuleOverride (void * override);
337 : :
338 : : /*
339 : : GetRuntimeModuleOverride - return a string containing any user override
340 : : or the default module initialization override
341 : : sequence.
342 : : */
343 : :
344 : : extern "C" void * M2Options_GetRuntimeModuleOverride (void);
345 : :
346 : : /*
347 : : SetUselist - set the uselist flag to value and remember the filename.
348 : : */
349 : :
350 : : extern "C" void M2Options_SetUselist (bool value, void * filename);
351 : :
352 : : /*
353 : : GetUselist - return the uselist flag.
354 : : */
355 : :
356 : : extern "C" bool M2Options_GetUselist (void);
357 : :
358 : : /*
359 : : GetUselistFilename - return the uselist filename as a String.
360 : : */
361 : :
362 : : extern "C" DynamicStrings_String M2Options_GetUselistFilename (void);
363 : :
364 : : /*
365 : : SetWholeProgram - sets the WholeProgram flag (-fwhole-program).
366 : : */
367 : :
368 : : extern "C" void M2Options_SetWholeProgram (bool value);
369 : :
370 : : /*
371 : : SetAutoInit - -fauto-init turns on automatic initialization of pointers to NIL.
372 : : TRUE is returned.
373 : : */
374 : :
375 : : extern "C" bool M2Options_SetAutoInit (bool value);
376 : :
377 : : /*
378 : : SetReturnCheck -
379 : : */
380 : :
381 : : extern "C" bool M2Options_SetReturnCheck (bool value);
382 : :
383 : : /*
384 : : SetNilCheck -
385 : : */
386 : :
387 : : extern "C" bool M2Options_SetNilCheck (bool value);
388 : :
389 : : /*
390 : : SetCaseCheck - set else case checking to, value.
391 : : */
392 : :
393 : : extern "C" bool M2Options_SetCaseCheck (bool value);
394 : :
395 : : /*
396 : : SetCheckAll - set all runtime checking to, value.
397 : : */
398 : :
399 : : extern "C" bool M2Options_SetCheckAll (bool value);
400 : :
401 : : /*
402 : : SetVerboseUnbounded - sets the VerboseUnbounded flag to, value.
403 : : */
404 : :
405 : : extern "C" bool M2Options_SetVerboseUnbounded (bool value);
406 : :
407 : : /*
408 : : SetQuiet - sets the quiet flag to, value.
409 : : */
410 : :
411 : : extern "C" bool M2Options_SetQuiet (bool value);
412 : :
413 : : /*
414 : : SetCC1Quiet - sets the cc1quiet flag to, value.
415 : : */
416 : :
417 : : extern "C" void M2Options_SetCC1Quiet (bool value);
418 : :
419 : : /*
420 : : SetM2g - set GenerateStatementNote to value and return value.
421 : : Corresponds to the -fm2-g flag.
422 : : */
423 : :
424 : : extern "C" bool M2Options_SetM2g (bool value);
425 : :
426 : : /*
427 : : GetM2g - returns TRUE if the -fm2-g flags was used.
428 : : */
429 : :
430 : : extern "C" bool M2Options_GetM2g (void);
431 : :
432 : : /*
433 : : SetLowerCaseKeywords - set the lower case keyword flag and return the result.
434 : : */
435 : :
436 : : extern "C" bool M2Options_SetLowerCaseKeywords (bool value);
437 : :
438 : : /*
439 : : SetUnboundedByReference -
440 : : */
441 : :
442 : : extern "C" bool M2Options_SetUnboundedByReference (bool value);
443 : :
444 : : /*
445 : : SetSearchPath -
446 : : */
447 : :
448 : : extern "C" void M2Options_SetSearchPath (void * arg);
449 : :
450 : : /*
451 : : SetISO -
452 : : */
453 : :
454 : : extern "C" void M2Options_SetISO (bool value);
455 : :
456 : : /*
457 : : SetPIM -
458 : : */
459 : :
460 : : extern "C" void M2Options_SetPIM (bool value);
461 : :
462 : : /*
463 : : SetPIM2 -
464 : : */
465 : :
466 : : extern "C" void M2Options_SetPIM2 (bool value);
467 : :
468 : : /*
469 : : SetPIM3 -
470 : : */
471 : :
472 : : extern "C" void M2Options_SetPIM3 (bool value);
473 : :
474 : : /*
475 : : SetPIM4 -
476 : : */
477 : :
478 : : extern "C" void M2Options_SetPIM4 (bool value);
479 : :
480 : : /*
481 : : SetPositiveModFloor - sets the positive mod floor option.
482 : : */
483 : :
484 : : extern "C" void M2Options_SetPositiveModFloor (bool value);
485 : :
486 : : /*
487 : : SetWholeDiv - sets the whole division flag.
488 : : */
489 : :
490 : : extern "C" void M2Options_SetWholeDiv (bool value);
491 : :
492 : : /*
493 : : SetIndex - sets the runtime array index checking flag.
494 : : */
495 : :
496 : : extern "C" void M2Options_SetIndex (bool value);
497 : :
498 : : /*
499 : : SetRange - sets the runtime range checking flag.
500 : : */
501 : :
502 : : extern "C" void M2Options_SetRange (bool value);
503 : :
504 : : /*
505 : : SetExceptions - sets the enable runtime exceptions flag.
506 : : */
507 : :
508 : : extern "C" void M2Options_SetExceptions (bool value);
509 : :
510 : : /*
511 : : SetStyle -
512 : : */
513 : :
514 : : extern "C" void M2Options_SetStyle (bool value);
515 : :
516 : : /*
517 : : SetPedantic -
518 : : */
519 : :
520 : : extern "C" void M2Options_SetPedantic (bool value);
521 : :
522 : : /*
523 : : SetPedanticParamNames - sets the pedantic parameter name flag.
524 : : */
525 : :
526 : : extern "C" void M2Options_SetPedanticParamNames (bool value);
527 : :
528 : : /*
529 : : SetPedanticCast - sets the pedantic cast flag.
530 : : */
531 : :
532 : : extern "C" void M2Options_SetPedanticCast (bool value);
533 : :
534 : : /*
535 : : SetExtendedOpaque - sets the ExtendedOpaque flag.
536 : : */
537 : :
538 : : extern "C" void M2Options_SetExtendedOpaque (bool value);
539 : :
540 : : /*
541 : : SetXCode - sets the xcode flag.
542 : : */
543 : :
544 : : extern "C" void M2Options_SetXCode (bool value);
545 : :
546 : : /*
547 : : SetCompilerDebugging - turn on internal compiler debugging.
548 : : Enabled via the command line option -fd.
549 : : */
550 : :
551 : : extern "C" void M2Options_SetCompilerDebugging (bool value);
552 : :
553 : : /*
554 : : SetQuadDebugging - display the quadruples (internal debugging).
555 : : */
556 : :
557 : : extern "C" void M2Options_SetQuadDebugging (bool value);
558 : :
559 : : /*
560 : : SetM2DebugTraceFilter - set internal debug flags. The flags should be
561 : : specified as a comma separated list. The full
562 : : list allowed is quad,line,token,all.
563 : : */
564 : :
565 : : extern "C" void M2Options_SetM2DebugTraceFilter (bool value, void * filter);
566 : :
567 : : /*
568 : : SetDebugFunctionLineNumbers - set DebugFunctionLineNumbers.
569 : : */
570 : :
571 : : extern "C" void M2Options_SetDebugFunctionLineNumbers (bool value);
572 : :
573 : : /*
574 : : SetGenerateStatementNote - turn on generation of nops if necessary
575 : : to generate pedalogical single stepping.
576 : : */
577 : :
578 : : extern "C" void M2Options_SetGenerateStatementNote (bool value);
579 : :
580 : : /*
581 : : SetSources -
582 : : */
583 : :
584 : : extern "C" void M2Options_SetSources (bool value);
585 : :
586 : : /*
587 : : SetDumpSystemExports -
588 : : */
589 : :
590 : : extern "C" void M2Options_SetDumpSystemExports (bool value);
591 : :
592 : : /*
593 : : SetSwig -
594 : : */
595 : :
596 : : extern "C" void M2Options_SetSwig (bool value);
597 : :
598 : : /*
599 : : SetOptimizing -
600 : : */
601 : :
602 : : extern "C" void M2Options_SetOptimizing (unsigned int value);
603 : :
604 : : /*
605 : : OverrideLocation - possibly override the location value, depending upon
606 : : whether the -flocation= option was used.
607 : : */
608 : :
609 : : extern "C" location_t M2Options_OverrideLocation (location_t location);
610 : :
611 : : /*
612 : : SetForcedLocation - sets the location for the lifetime of this compile to, location.
613 : : This is primarily an internal debugging switch.
614 : : */
615 : :
616 : : extern "C" void M2Options_SetForcedLocation (location_t location);
617 : :
618 : : /*
619 : : SetUnusedVariableChecking - assigns the UnusedVariableChecking to value.
620 : : */
621 : :
622 : : extern "C" void M2Options_SetUnusedVariableChecking (bool value);
623 : :
624 : : /*
625 : : SetUnusedParameterChecking - assigns the UnusedParameterChecking to value.
626 : : */
627 : :
628 : : extern "C" void M2Options_SetUnusedParameterChecking (bool value);
629 : :
630 : : /*
631 : : SetStrictTypeChecking - assigns the StrictTypeChecking flag to value.
632 : : */
633 : :
634 : : extern "C" void M2Options_SetStrictTypeChecking (bool value);
635 : :
636 : : /*
637 : : SetStrictTypeAssignment - assigns the StrictTypeAssignment flag to value.
638 : : */
639 : :
640 : : extern "C" void M2Options_SetStrictTypeAssignment (bool value);
641 : :
642 : : /*
643 : : SetStrictTypeReason - assigns the StrictTypeReason flag to value.
644 : : */
645 : :
646 : : extern "C" void M2Options_SetStrictTypeReason (bool value);
647 : :
648 : : /*
649 : : setdefextension - set the source file definition module extension to arg.
650 : : This should include the . and by default it is set to .def.
651 : : */
652 : :
653 : : extern "C" void M2Options_setdefextension (void * arg);
654 : :
655 : : /*
656 : : setmodextension - set the source file module extension to arg.
657 : : This should include the . and by default it is set to .mod.
658 : : */
659 : :
660 : : extern "C" void M2Options_setmodextension (void * arg);
661 : :
662 : : /*
663 : : SetStatistics - turn on/off generate of compile time statistics.
664 : : */
665 : :
666 : : extern "C" void M2Options_SetStatistics (bool on);
667 : :
668 : : /*
669 : : SetVerbose - set the Verbose flag to, value. It returns TRUE.
670 : : */
671 : :
672 : : extern "C" bool M2Options_SetVerbose (bool value);
673 : :
674 : : /*
675 : : CppArg - sets the option and arg in the cpp command line.
676 : : */
677 : :
678 : : extern "C" void M2Options_CppArg (void * opt, void * arg, bool joined);
679 : :
680 : : /*
681 : : CppCommandLine - returns the Cpp command line and all arguments.
682 : : NIL is returned if the -fcpp is absent.
683 : : */
684 : :
685 : : extern "C" DynamicStrings_String M2Options_CppCommandLine (void);
686 : :
687 : : /*
688 : : CppRemember - remember a string, s, as a cpp related argument.
689 : : The string, s, is not garbage collected.
690 : : */
691 : :
692 : : extern "C" void M2Options_CppRemember (DynamicStrings_String s);
693 : :
694 : : /*
695 : : GetISO - return TRUE if -fiso was present on the command line.
696 : : */
697 : :
698 : : extern "C" bool M2Options_GetISO (void);
699 : :
700 : : /*
701 : : GetPIM - return TRUE if -fpim was present on the command line.
702 : : */
703 : :
704 : : extern "C" bool M2Options_GetPIM (void);
705 : :
706 : : /*
707 : : GetPIM2 - return TRUE if -fpim2 was present on the command line.
708 : : */
709 : :
710 : : extern "C" bool M2Options_GetPIM2 (void);
711 : :
712 : : /*
713 : : GetPIM3 - return TRUE if -fpim3 was present on the command line.
714 : : */
715 : :
716 : : extern "C" bool M2Options_GetPIM3 (void);
717 : :
718 : : /*
719 : : GetPIM4 - return TRUE if -fpim4 was present on the command line.
720 : : */
721 : :
722 : : extern "C" bool M2Options_GetPIM4 (void);
723 : :
724 : : /*
725 : : GetPositiveModFloor - return TRUE if -fpositive-mod-floor was present
726 : : on the command line.
727 : : */
728 : :
729 : : extern "C" bool M2Options_GetPositiveModFloor (void);
730 : :
731 : : /*
732 : : GetFloatValueCheck - return TRUE if -ffloatvalue was present on the
733 : : command line.
734 : : */
735 : :
736 : : extern "C" bool M2Options_GetFloatValueCheck (void);
737 : :
738 : : /*
739 : : SetFloatValueCheck - set depending upon the -ffloatvalue.
740 : : */
741 : :
742 : : extern "C" void M2Options_SetFloatValueCheck (bool value);
743 : :
744 : : /*
745 : : GetWholeValueCheck - return TRUE if -fwholevalue was present on the
746 : : command line.
747 : : */
748 : :
749 : : extern "C" bool M2Options_GetWholeValueCheck (void);
750 : :
751 : : /*
752 : : SetWholeValueCheck - set depending upon the -fwholevalue.
753 : : */
754 : :
755 : : extern "C" void M2Options_SetWholeValueCheck (bool value);
756 : :
757 : : /*
758 : : SetWall - set all warnings to, value.
759 : : */
760 : :
761 : : extern "C" void M2Options_SetWall (bool value);
762 : :
763 : : /*
764 : : SetSaveTemps - turn on/off -save-temps.
765 : : */
766 : :
767 : : extern "C" void M2Options_SetSaveTemps (bool value);
768 : :
769 : : /*
770 : : SetSaveTempsDir - turn on/off -save-temps and specify the directory.
771 : : */
772 : :
773 : : extern "C" void M2Options_SetSaveTempsDir (void * arg);
774 : :
775 : : /*
776 : : GetSaveTempsDir - return SaveTempsDir or NIL if -save-temps was not used.
777 : : */
778 : :
779 : : extern "C" DynamicStrings_String M2Options_GetSaveTempsDir (void);
780 : :
781 : : /*
782 : : SetDumpDir - Set the dump dir.
783 : : */
784 : :
785 : : extern "C" void M2Options_SetDumpDir (void * arg);
786 : :
787 : : /*
788 : : GetDumpDir - return DumpDir or NIL.
789 : : */
790 : :
791 : : extern "C" DynamicStrings_String M2Options_GetDumpDir (void);
792 : :
793 : : /*
794 : : SetGenModuleList - set the GenModuleList flag to true and pass
795 : : set GenModuleListFilename to filename.
796 : : */
797 : :
798 : : extern "C" void M2Options_SetGenModuleList (bool value, void * filename);
799 : :
800 : : /*
801 : : GetGenModuleFilename - returns the filename set by SetGenModuleList.
802 : : */
803 : :
804 : : extern "C" DynamicStrings_String M2Options_GetGenModuleFilename (void);
805 : :
806 : : /*
807 : : SetShared - sets the SharedFlag to value.
808 : : */
809 : :
810 : : extern "C" void M2Options_SetShared (bool value);
811 : :
812 : : /*
813 : : SetUninitVariableChecking - sets the UninitVariableChecking and
814 : : UninitVariableConditionalChecking flags to value
815 : : depending upon arg string. The arg string
816 : : can be: "all", "known,cond", "cond,known", "known"
817 : : or "cond".
818 : : */
819 : :
820 : : extern "C" int M2Options_SetUninitVariableChecking (bool value, void * arg);
821 : :
822 : : /*
823 : : SetCaseEnumChecking - sets the CaseEnumChecking to value.
824 : : */
825 : :
826 : : extern "C" void M2Options_SetCaseEnumChecking (bool value);
827 : :
828 : : /*
829 : : SetDebugBuiltins - sets the DebugBuiltins to value.
830 : : */
831 : :
832 : : extern "C" void M2Options_SetDebugBuiltins (bool value);
833 : :
834 : : /*
835 : : SetIBMLongDouble - enable/disable LONGREAL to map onto the
836 : : IBM long double 128 bit data type.
837 : : (Only available on the ppc).
838 : : */
839 : :
840 : : extern "C" void M2Options_SetIBMLongDouble (bool value);
841 : :
842 : : /*
843 : : GetIBMLongDouble - return the value of IBMLongDouble.
844 : : */
845 : :
846 : : extern "C" bool M2Options_GetIBMLongDouble (void);
847 : :
848 : : /*
849 : : SetIEEELongDouble - enable/disable LONGREAL to map onto the
850 : : IEEE long double 128 bit data type.
851 : : (Only available on the ppc).
852 : : */
853 : :
854 : : extern "C" void M2Options_SetIEEELongDouble (bool value);
855 : :
856 : : /*
857 : : GetIEEELongDouble - return the value of IEEELongDouble.
858 : : */
859 : :
860 : : extern "C" bool M2Options_GetIEEELongDouble (void);
861 : :
862 : : /*
863 : : GetDumpDeclFilename - returns the DumpDeclFilename.
864 : : */
865 : :
866 : : extern "C" DynamicStrings_String M2Options_GetDumpDeclFilename (void);
867 : :
868 : : /*
869 : : SetDumpDeclFilename -
870 : : */
871 : :
872 : : extern "C" void M2Options_SetDumpDeclFilename (bool value, void * filename);
873 : :
874 : : /*
875 : : GetDumpQuadFilename - returns the DumpQuadFilename.
876 : : */
877 : :
878 : : extern "C" DynamicStrings_String M2Options_GetDumpQuadFilename (void);
879 : :
880 : : /*
881 : : SetDumpQuadFilename -
882 : : */
883 : :
884 : : extern "C" void M2Options_SetDumpQuadFilename (bool value, void * filename);
885 : :
886 : : /*
887 : : GetDumpGimpleFilename - returns the DumpGimpleFilename.
888 : : */
889 : :
890 : : extern "C" DynamicStrings_String M2Options_GetDumpGimpleFilename (void);
891 : :
892 : : /*
893 : : SetDumpGimpleFilename - set DumpGimpleFilename to filename.
894 : : */
895 : :
896 : : extern "C" void M2Options_SetDumpGimpleFilename (bool value, void * filename);
897 : :
898 : : /*
899 : : SetM2DumpFilter - sets the filter to a comma separated list of procedures
900 : : and modules. Not to be confused with SetM2Dump below
901 : : which enables the class of data structures to be dumped.
902 : : */
903 : :
904 : : extern "C" void M2Options_SetM2DumpFilter (bool value, void * filter);
905 : :
906 : : /*
907 : : GetM2DumpFilter - returns the dump filter.
908 : : */
909 : :
910 : : extern "C" void * M2Options_GetM2DumpFilter (void);
911 : :
912 : : /*
913 : : SetM2Dump - sets the dump via a comma separated list: quad,decl,gimple,all.
914 : : It returns TRUE if the comma separated list is valid.
915 : : */
916 : :
917 : : extern "C" bool M2Options_SetM2Dump (bool value, void * filter);
918 : :
919 : : /*
920 : : GetDumpGimple - return TRUE if the dump gimple flag is set from SetM2Dump.
921 : : */
922 : :
923 : : extern "C" bool M2Options_GetDumpGimple (void);
924 : :
925 : : /*
926 : : GetDumpQuad - return TRUE if the dump quad flag is set from SetM2Dump.
927 : : */
928 : :
929 : : extern "C" bool M2Options_GetDumpQuad (void);
930 : :
931 : : /*
932 : : GetDumpDecl - return TRUE if the dump decl flag is set from SetM2Dump.
933 : : */
934 : :
935 : : extern "C" bool M2Options_GetDumpDecl (void);
936 : :
937 : : /*
938 : : GetDebugTraceQuad - return DebugTraceQuad.
939 : : */
940 : :
941 : : extern "C" bool M2Options_GetDebugTraceQuad (void);
942 : :
943 : : /*
944 : : GetDebugTraceTree - return DebugTraceTree.
945 : : */
946 : :
947 : : extern "C" bool M2Options_GetDebugTraceTree (void);
948 : :
949 : : /*
950 : : GetDebugTraceToken - return DebugTraceToken.
951 : : */
952 : :
953 : : extern "C" bool M2Options_GetDebugTraceToken (void);
954 : :
955 : : /*
956 : : GetDebugTraceLine - return DebugTraceLine.
957 : : */
958 : :
959 : : extern "C" bool M2Options_GetDebugTraceLine (void);
960 : :
961 : : /*
962 : : GetDebugFunctionLineNumbers - return DebugFunctionLineNumbers.
963 : : */
964 : :
965 : : extern "C" bool M2Options_GetDebugFunctionLineNumbers (void);
966 : :
967 : : /*
968 : : GetEnableForward - return EnableForward.
969 : : */
970 : :
971 : : extern "C" bool M2Options_GetEnableForward (void);
972 : :
973 : : /*
974 : : SetEnableForward - set EnableForward to value.
975 : : */
976 : :
977 : : extern "C" void M2Options_SetEnableForward (bool value);
978 : :
979 : : /*
980 : : SetFileOffsetBits - create SYSTEM.COFF_T as a signed integer of size bits.
981 : : */
982 : :
983 : : extern "C" bool M2Options_SetFileOffsetBits (bool value, unsigned int bits);
984 : :
985 : : /*
986 : : GetFileOffsetBits - return the number of bits used to create SYSTEM.COFF_T.
987 : : */
988 : :
989 : : extern "C" unsigned int M2Options_GetFileOffsetBits (void);
990 : :
991 : : /*
992 : : SetMemReport - set MemReport to value.
993 : : */
994 : :
995 : : extern "C" void M2Options_SetMemReport (bool value);
996 : :
997 : : /*
998 : : SetTimeReport - set TimeReport to value.
999 : : */
1000 : :
1001 : : extern "C" void M2Options_SetTimeReport (bool value);
1002 : :
1003 : : /*
1004 : : SetWideset - set the Wideset flag to value.
1005 : : */
1006 : :
1007 : : extern "C" void M2Options_SetWideset (bool value);
1008 : :
1009 : : /*
1010 : : GetWideset - return the Wideset flag value.
1011 : : */
1012 : :
1013 : : extern "C" bool M2Options_GetWideset (void);
1014 : :
1015 : : /*
1016 : : FinaliseOptions - once all options have been parsed we set any inferred
1017 : : values.
1018 : : */
1019 : :
1020 : : extern "C" void M2Options_FinaliseOptions (void);
1021 : :
1022 : : /*
1023 : : errors1 -
1024 : : */
1025 : :
1026 : : static void errors1 (const char *format_, unsigned int _format_high, DynamicStrings_String arg);
1027 : :
1028 : : /*
1029 : : AddWord - concats a word to sentence inserting a space if necessary.
1030 : : sentence is returned. sentence will be created if it is NIL.
1031 : : */
1032 : :
1033 : : static DynamicStrings_String AddWord (DynamicStrings_String sentence, DynamicStrings_String word);
1034 : :
1035 : : /*
1036 : : QuoteTarget - quote the '$' character.
1037 : : */
1038 : :
1039 : : static DynamicStrings_String QuoteTarget (DynamicStrings_String target);
1040 : :
1041 : : /*
1042 : : SetM2DebugTrace -
1043 : : */
1044 : :
1045 : : static void SetM2DebugTrace (DynamicStrings_String word, bool value);
1046 : :
1047 : : /*
1048 : : InitializeLongDoubleFlags - initialize the long double related flags
1049 : : with default values given during gcc configure.
1050 : : */
1051 : :
1052 : : static void InitializeLongDoubleFlags (void);
1053 : :
1054 : : /*
1055 : : MatchDump - enable/disable dump using value. It returns TRUE if dump
1056 : : is valid.
1057 : : */
1058 : :
1059 : : static bool MatchDump (DynamicStrings_String dump, bool value);
1060 : :
1061 : :
1062 : : /*
1063 : : errors1 -
1064 : : */
1065 : :
1066 : 0 : static void errors1 (const char *format_, unsigned int _format_high, DynamicStrings_String arg)
1067 : : {
1068 : 0 : DynamicStrings_String message;
1069 : 0 : void * cstr;
1070 : 0 : char format[_format_high+1];
1071 : :
1072 : : /* make a local copy of each unbounded array. */
1073 : 0 : memcpy (format, format_, _format_high+1);
1074 : :
1075 : 0 : message = FormatStrings_Sprintf1 (DynamicStrings_InitString ((const char *) format, _format_high), (const unsigned char *) &arg, (sizeof (arg)-1));
1076 : 0 : cstr = DynamicStrings_string (message);
1077 : 0 : m2misc_cerror (cstr);
1078 : 0 : libc_exit (1);
1079 : 0 : }
1080 : :
1081 : :
1082 : : /*
1083 : : AddWord - concats a word to sentence inserting a space if necessary.
1084 : : sentence is returned. sentence will be created if it is NIL.
1085 : : */
1086 : :
1087 : 0 : static DynamicStrings_String AddWord (DynamicStrings_String sentence, DynamicStrings_String word)
1088 : : {
1089 : 0 : if (word != NULL)
1090 : : {
1091 : : /* avoid gcc warning by using compound statement even if not strictly necessary. */
1092 : 0 : if (sentence == NULL)
1093 : : {
1094 : 0 : sentence = DynamicStrings_Dup (word);
1095 : : }
1096 : : else
1097 : : {
1098 : 0 : sentence = DynamicStrings_ConCatChar (sentence, ' ');
1099 : 0 : sentence = DynamicStrings_ConCat (sentence, word);
1100 : : }
1101 : : }
1102 : 0 : return sentence;
1103 : : /* static analysis guarentees a RETURN statement will be used before here. */
1104 : : __builtin_unreachable ();
1105 : : }
1106 : :
1107 : :
1108 : : /*
1109 : : QuoteTarget - quote the '$' character.
1110 : : */
1111 : :
1112 : 0 : static DynamicStrings_String QuoteTarget (DynamicStrings_String target)
1113 : : {
1114 : 0 : DynamicStrings_String quoted;
1115 : 0 : unsigned int i;
1116 : 0 : unsigned int n;
1117 : :
1118 : 0 : quoted = DynamicStrings_InitString ((const char *) "", 0);
1119 : 0 : i = 0;
1120 : 0 : n = DynamicStrings_Length (target);
1121 : 0 : while (i < n)
1122 : : {
1123 : 0 : switch (DynamicStrings_char (target, static_cast<int> (i)))
1124 : : {
1125 : 0 : case '$':
1126 : 0 : quoted = DynamicStrings_ConCat (quoted, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "$$", 2)));
1127 : 0 : break;
1128 : :
1129 : :
1130 : 0 : default:
1131 : 0 : quoted = DynamicStrings_ConCatChar (quoted, DynamicStrings_char (target, static_cast<int> (i)));
1132 : 0 : break;
1133 : : }
1134 : 0 : i += 1;
1135 : : }
1136 : 0 : return quoted;
1137 : : /* static analysis guarentees a RETURN statement will be used before here. */
1138 : : __builtin_unreachable ();
1139 : : }
1140 : :
1141 : :
1142 : : /*
1143 : : SetM2DebugTrace -
1144 : : */
1145 : :
1146 : 0 : static void SetM2DebugTrace (DynamicStrings_String word, bool value)
1147 : : {
1148 : 0 : if (DynamicStrings_EqualArray (word, (const char *) "all", 3))
1149 : : {
1150 : : /* DebugTraceTree := value ; */
1151 : 0 : DebugTraceQuad = value;
1152 : 0 : DebugTraceToken = value;
1153 : 0 : DebugTraceLine = value;
1154 : : }
1155 : 0 : else if (DynamicStrings_EqualArray (word, (const char *) "quad", 4))
1156 : : {
1157 : : /* avoid dangling else. */
1158 : 0 : DebugTraceQuad = value;
1159 : : }
1160 : 0 : else if (DynamicStrings_EqualArray (word, (const char *) "token", 5))
1161 : : {
1162 : : /* avoid dangling else. */
1163 : 0 : DebugTraceToken = value;
1164 : : }
1165 : 0 : else if (DynamicStrings_EqualArray (word, (const char *) "line", 4))
1166 : : {
1167 : : /* avoid dangling else. */
1168 : 0 : DebugTraceLine = value;
1169 : : }
1170 : : else
1171 : : {
1172 : : /* avoid dangling else. */
1173 : 0 : errors1 ((const char *) "unrecognized filter %s seen in -fm2-debug-trace= option\\n", 57, word);
1174 : : }
1175 : 0 : }
1176 : :
1177 : :
1178 : : /*
1179 : : InitializeLongDoubleFlags - initialize the long double related flags
1180 : : with default values given during gcc configure.
1181 : : */
1182 : :
1183 : 15507 : static void InitializeLongDoubleFlags (void)
1184 : : {
1185 : 15507 : IBMLongDouble = false;
1186 : 15507 : IEEELongDouble = false;
1187 : 15507 : switch (m2configure_TargetIEEEQuadDefault ())
1188 : : {
1189 : : case -1:
1190 : : break;
1191 : :
1192 : 0 : case 0:
1193 : 0 : IBMLongDouble = true;
1194 : 0 : break;
1195 : :
1196 : 0 : case 1:
1197 : 0 : IEEELongDouble = true;
1198 : 0 : break;
1199 : :
1200 : :
1201 : 0 : default:
1202 : 0 : M2Error_InternalError ((const char *) "unexpected value returned from TargetIEEEQuadDefault ()", 55);
1203 : 15507 : break;
1204 : : }
1205 : 15507 : }
1206 : :
1207 : :
1208 : : /*
1209 : : MatchDump - enable/disable dump using value. It returns TRUE if dump
1210 : : is valid.
1211 : : */
1212 : :
1213 : 0 : static bool MatchDump (DynamicStrings_String dump, bool value)
1214 : : {
1215 : 0 : if (DynamicStrings_EqualArray (dump, (const char *) "all", 3))
1216 : : {
1217 : 0 : DumpDecl = value;
1218 : 0 : DumpQuad = value;
1219 : 0 : DumpGimple = value;
1220 : 0 : return true;
1221 : : }
1222 : 0 : else if (DynamicStrings_EqualArray (dump, (const char *) "decl", 4))
1223 : : {
1224 : : /* avoid dangling else. */
1225 : 0 : DumpDecl = value;
1226 : 0 : return true;
1227 : : }
1228 : 0 : else if (DynamicStrings_EqualArray (dump, (const char *) "gimple", 6))
1229 : : {
1230 : : /* avoid dangling else. */
1231 : 0 : DumpGimple = value;
1232 : 0 : return true;
1233 : : }
1234 : 0 : else if (DynamicStrings_EqualArray (dump, (const char *) "quad", 4))
1235 : : {
1236 : : /* avoid dangling else. */
1237 : 0 : DumpQuad = value;
1238 : 0 : return true;
1239 : : }
1240 : : return false;
1241 : : /* static analysis guarentees a RETURN statement will be used before here. */
1242 : : __builtin_unreachable ();
1243 : : }
1244 : :
1245 : :
1246 : : /*
1247 : : SetM - set the MFlag.
1248 : : */
1249 : :
1250 : 0 : extern "C" void M2Options_SetM (bool value)
1251 : : {
1252 : 0 : MFlag = value;
1253 : 0 : }
1254 : :
1255 : :
1256 : : /*
1257 : : GetM - set the MFlag.
1258 : : */
1259 : :
1260 : 33719 : extern "C" bool M2Options_GetM (void)
1261 : : {
1262 : 33719 : return MFlag;
1263 : : /* static analysis guarentees a RETURN statement will be used before here. */
1264 : : __builtin_unreachable ();
1265 : : }
1266 : :
1267 : :
1268 : : /*
1269 : : SetMM - set the MMFlag.
1270 : : */
1271 : :
1272 : 0 : extern "C" void M2Options_SetMM (bool value)
1273 : : {
1274 : 0 : MMFlag = value;
1275 : 0 : }
1276 : :
1277 : :
1278 : : /*
1279 : : GetMM - set the MMFlag.
1280 : : */
1281 : :
1282 : 33719 : extern "C" bool M2Options_GetMM (void)
1283 : : {
1284 : 33719 : return MMFlag;
1285 : : /* static analysis guarentees a RETURN statement will be used before here. */
1286 : : __builtin_unreachable ();
1287 : : }
1288 : :
1289 : :
1290 : : /*
1291 : : SetMF - assigns MFarg to the filename from arg.
1292 : : */
1293 : :
1294 : 0 : extern "C" void M2Options_SetMF (void * arg)
1295 : : {
1296 : 0 : MFarg = DynamicStrings_KillString (MFarg);
1297 : 0 : MFarg = DynamicStrings_InitStringCharStar (arg);
1298 : 0 : }
1299 : :
1300 : :
1301 : : /*
1302 : : GetMF - returns MFarg or NIL if never set.
1303 : : */
1304 : :
1305 : 15506 : extern "C" void * M2Options_GetMF (void)
1306 : : {
1307 : 15506 : return DynamicStrings_string (MFarg);
1308 : : /* static analysis guarentees a RETURN statement will be used before here. */
1309 : : __builtin_unreachable ();
1310 : : }
1311 : :
1312 : :
1313 : : /*
1314 : : SetM2Prefix - assign arg to M2Prefix.
1315 : : */
1316 : :
1317 : 620 : extern "C" void M2Options_SetM2Prefix (void * arg)
1318 : : {
1319 : 620 : M2Prefix = DynamicStrings_KillString (M2Prefix);
1320 : 620 : M2Prefix = DynamicStrings_InitStringCharStar (arg);
1321 : 620 : }
1322 : :
1323 : :
1324 : : /*
1325 : : GetM2Prefix - return M2Prefix as a C string.
1326 : : */
1327 : :
1328 : 15495 : extern "C" void * M2Options_GetM2Prefix (void)
1329 : : {
1330 : 15495 : return DynamicStrings_string (M2Prefix);
1331 : : /* static analysis guarentees a RETURN statement will be used before here. */
1332 : : __builtin_unreachable ();
1333 : : }
1334 : :
1335 : :
1336 : : /*
1337 : : SetM2PathName - assign arg to M2PathName.
1338 : : */
1339 : :
1340 : 307482 : extern "C" void M2Options_SetM2PathName (void * arg)
1341 : : {
1342 : 307482 : M2PathName = DynamicStrings_KillString (M2PathName);
1343 : 307482 : M2PathName = DynamicStrings_InitStringCharStar (arg);
1344 : 307482 : }
1345 : :
1346 : :
1347 : : /*
1348 : : GetM2PathName - return M2PathName as a C string.
1349 : : */
1350 : :
1351 : 356059 : extern "C" void * M2Options_GetM2PathName (void)
1352 : : {
1353 : 356059 : return DynamicStrings_string (M2PathName);
1354 : : /* static analysis guarentees a RETURN statement will be used before here. */
1355 : : __builtin_unreachable ();
1356 : : }
1357 : :
1358 : :
1359 : : /*
1360 : : SetPPOnly - set the PPonly (preprocess only) to value.
1361 : : */
1362 : :
1363 : 0 : extern "C" void M2Options_SetPPOnly (bool value)
1364 : : {
1365 : 0 : M2Options_PPonly = value;
1366 : 0 : }
1367 : :
1368 : :
1369 : : /*
1370 : : GetPPOnly - get the PPonly (preprocess only).
1371 : : */
1372 : :
1373 : 60510 : extern "C" bool M2Options_GetPPOnly (void)
1374 : : {
1375 : 60510 : return M2Options_PPonly;
1376 : : /* static analysis guarentees a RETURN statement will be used before here. */
1377 : : __builtin_unreachable ();
1378 : : }
1379 : :
1380 : :
1381 : : /*
1382 : : Setc - set the cflag (compile only flag -c) to value.
1383 : : */
1384 : :
1385 : 12807 : extern "C" void M2Options_Setc (bool value)
1386 : : {
1387 : 12807 : M2Options_cflag = value;
1388 : 12807 : }
1389 : :
1390 : :
1391 : : /*
1392 : : Getc - get the cflag (compile only flag -c).
1393 : : */
1394 : :
1395 : 0 : extern "C" bool M2Options_Getc (void)
1396 : : {
1397 : 0 : return M2Options_cflag;
1398 : : /* static analysis guarentees a RETURN statement will be used before here. */
1399 : : __builtin_unreachable ();
1400 : : }
1401 : :
1402 : :
1403 : : /*
1404 : : SetB - assigns Barg to arg.
1405 : : */
1406 : :
1407 : 15507 : extern "C" void M2Options_SetB (void * arg)
1408 : : {
1409 : 15507 : Barg = DynamicStrings_KillString (Barg);
1410 : 15507 : Barg = DynamicStrings_InitStringCharStar (arg);
1411 : 15507 : }
1412 : :
1413 : :
1414 : : /*
1415 : : GetB - returns Barg value as a C string or NIL if it was never set.
1416 : : */
1417 : :
1418 : 2868 : extern "C" void * M2Options_GetB (void)
1419 : : {
1420 : 2868 : return DynamicStrings_string (Barg);
1421 : : /* static analysis guarentees a RETURN statement will be used before here. */
1422 : : __builtin_unreachable ();
1423 : : }
1424 : :
1425 : :
1426 : : /*
1427 : : SetMD - set the MDFlag to value.
1428 : : */
1429 : :
1430 : 0 : extern "C" void M2Options_SetMD (bool value)
1431 : : {
1432 : 0 : MDFlag = value;
1433 : 0 : }
1434 : :
1435 : :
1436 : : /*
1437 : : GetMD - return the MDFlag.
1438 : : */
1439 : :
1440 : 528 : extern "C" bool M2Options_GetMD (void)
1441 : : {
1442 : 528 : return MDFlag;
1443 : : /* static analysis guarentees a RETURN statement will be used before here. */
1444 : : __builtin_unreachable ();
1445 : : }
1446 : :
1447 : :
1448 : : /*
1449 : : SetMMD - set the MMDFlag to value.
1450 : : */
1451 : :
1452 : 0 : extern "C" void M2Options_SetMMD (bool value)
1453 : : {
1454 : 0 : MMDFlag = value;
1455 : 0 : }
1456 : :
1457 : :
1458 : : /*
1459 : : GetMMD - return the MMDFlag.
1460 : : */
1461 : :
1462 : 528 : extern "C" bool M2Options_GetMMD (void)
1463 : : {
1464 : 528 : return MMDFlag;
1465 : : /* static analysis guarentees a RETURN statement will be used before here. */
1466 : : __builtin_unreachable ();
1467 : : }
1468 : :
1469 : :
1470 : : /*
1471 : : SetMQ - adds a quoted target arg to the DepTarget sentence.
1472 : : */
1473 : :
1474 : 0 : extern "C" void M2Options_SetMQ (void * arg)
1475 : : {
1476 : 0 : DepTarget = AddWord (DepTarget, QuoteTarget (DynamicStrings_InitStringCharStar (arg)));
1477 : 0 : MQFlag = AddWord (MQFlag, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "-MQ", 3)));
1478 : 0 : MQFlag = AddWord (MQFlag, DynamicStrings_Mark (DynamicStrings_InitStringCharStar (arg)));
1479 : 0 : }
1480 : :
1481 : :
1482 : : /*
1483 : : GetMQ - returns a C string containing all the -MQ arg values.
1484 : : */
1485 : :
1486 : 0 : extern "C" void * M2Options_GetMQ (void)
1487 : : {
1488 : 0 : return DynamicStrings_string (MQFlag);
1489 : : /* static analysis guarentees a RETURN statement will be used before here. */
1490 : : __builtin_unreachable ();
1491 : : }
1492 : :
1493 : :
1494 : : /*
1495 : : SetMT - adds a target arg to the DepTarget sentence.
1496 : : */
1497 : :
1498 : 0 : extern "C" void M2Options_SetMT (void * arg)
1499 : : {
1500 : 0 : DepTarget = AddWord (DepTarget, DynamicStrings_InitStringCharStar (arg));
1501 : 0 : MTFlag = AddWord (MTFlag, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "-MT", 3)));
1502 : 0 : MTFlag = AddWord (MTFlag, DynamicStrings_Mark (DynamicStrings_InitStringCharStar (arg)));
1503 : 0 : }
1504 : :
1505 : :
1506 : : /*
1507 : : GetMT - returns a C string containing all the -MT arg values.
1508 : : */
1509 : :
1510 : 0 : extern "C" void * M2Options_GetMT (void)
1511 : : {
1512 : 0 : return DynamicStrings_string (MTFlag);
1513 : : /* static analysis guarentees a RETURN statement will be used before here. */
1514 : : __builtin_unreachable ();
1515 : : }
1516 : :
1517 : :
1518 : : /*
1519 : : GetDepTarget - returns the DepTarget as a C string.
1520 : : */
1521 : :
1522 : 0 : extern "C" void * M2Options_GetDepTarget (void)
1523 : : {
1524 : 0 : return DynamicStrings_string (DepTarget);
1525 : : /* static analysis guarentees a RETURN statement will be used before here. */
1526 : : __builtin_unreachable ();
1527 : : }
1528 : :
1529 : :
1530 : : /*
1531 : : SetMP - set the MPflag to value.
1532 : : */
1533 : :
1534 : 0 : extern "C" void M2Options_SetMP (bool value)
1535 : : {
1536 : 0 : MPFlag = value;
1537 : 0 : }
1538 : :
1539 : :
1540 : : /*
1541 : : GetMP - get the MPflag.
1542 : : */
1543 : :
1544 : 0 : extern "C" bool M2Options_GetMP (void)
1545 : : {
1546 : 0 : return MPFlag;
1547 : : /* static analysis guarentees a RETURN statement will be used before here. */
1548 : : __builtin_unreachable ();
1549 : : }
1550 : :
1551 : :
1552 : : /*
1553 : : SetObj - assigns CmdLineObj to the filename from arg.
1554 : : */
1555 : :
1556 : 15507 : extern "C" void M2Options_SetObj (void * arg)
1557 : : {
1558 : 15507 : CmdLineObj = DynamicStrings_KillString (CmdLineObj);
1559 : 15507 : CmdLineObj = DynamicStrings_InitStringCharStar (arg);
1560 : 15507 : }
1561 : :
1562 : :
1563 : : /*
1564 : : GetObj - returns CmdLineObj filename as a c-string or NIL if it was never set.
1565 : : */
1566 : :
1567 : 0 : extern "C" void * M2Options_GetObj (void)
1568 : : {
1569 : 0 : return DynamicStrings_string (CmdLineObj);
1570 : : /* static analysis guarentees a RETURN statement will be used before here. */
1571 : : __builtin_unreachable ();
1572 : : }
1573 : :
1574 : :
1575 : : /*
1576 : : SetCpp - enables the source to be preprocessed and enables the
1577 : : recognition of C preprocessor line directives.
1578 : : */
1579 : :
1580 : 528 : extern "C" bool M2Options_SetCpp (bool value)
1581 : : {
1582 : 528 : M2Options_CPreProcessor = value;
1583 : 528 : M2Options_LineDirectives = value;
1584 : 528 : return true;
1585 : : /* static analysis guarentees a RETURN statement will be used before here. */
1586 : : __builtin_unreachable ();
1587 : : }
1588 : :
1589 : :
1590 : : /*
1591 : : GetCpp - returns TRUE if the C preprocessor was used.
1592 : : */
1593 : :
1594 : 27523044 : extern "C" bool M2Options_GetCpp (void)
1595 : : {
1596 : 27523044 : return M2Options_CPreProcessor;
1597 : : /* static analysis guarentees a RETURN statement will be used before here. */
1598 : : __builtin_unreachable ();
1599 : : }
1600 : :
1601 : :
1602 : : /*
1603 : : GetLineDirectives - returns TRUE if line directives are allowed.
1604 : : */
1605 : :
1606 : 32474 : extern "C" bool M2Options_GetLineDirectives (void)
1607 : : {
1608 : 32474 : return M2Options_LineDirectives;
1609 : : /* static analysis guarentees a RETURN statement will be used before here. */
1610 : : __builtin_unreachable ();
1611 : : }
1612 : :
1613 : :
1614 : : /*
1615 : : SetScaffoldDynamic - set the -fscaffold-dynamic flag.
1616 : : */
1617 : :
1618 : 15507 : extern "C" void M2Options_SetScaffoldDynamic (bool value)
1619 : : {
1620 : 15507 : M2Options_ScaffoldDynamic = value;
1621 : 15507 : if (M2Options_ScaffoldDynamic)
1622 : : {
1623 : 15463 : M2Options_ScaffoldStatic = false;
1624 : : }
1625 : 15507 : }
1626 : :
1627 : :
1628 : : /*
1629 : : SetScaffoldStatic - set the -fscaffold-static flag.
1630 : : */
1631 : :
1632 : 22 : extern "C" void M2Options_SetScaffoldStatic (bool value)
1633 : : {
1634 : 22 : M2Options_ScaffoldStatic = value;
1635 : 22 : if (M2Options_ScaffoldStatic)
1636 : : {
1637 : 0 : M2Options_ScaffoldDynamic = false;
1638 : : }
1639 : 22 : }
1640 : :
1641 : :
1642 : : /*
1643 : : GetScaffoldDynamic - get the -fscaffold-dynamic flag.
1644 : : */
1645 : :
1646 : 0 : extern "C" bool M2Options_GetScaffoldDynamic (void)
1647 : : {
1648 : 0 : return M2Options_ScaffoldDynamic;
1649 : : /* static analysis guarentees a RETURN statement will be used before here. */
1650 : : __builtin_unreachable ();
1651 : : }
1652 : :
1653 : :
1654 : : /*
1655 : : GetScaffoldStatic - get the -fscaffold-static flag.
1656 : : */
1657 : :
1658 : 0 : extern "C" bool M2Options_GetScaffoldStatic (void)
1659 : : {
1660 : 0 : return M2Options_ScaffoldStatic;
1661 : : /* static analysis guarentees a RETURN statement will be used before here. */
1662 : : __builtin_unreachable ();
1663 : : }
1664 : :
1665 : :
1666 : : /*
1667 : : SetScaffoldMain - set the -fscaffold-main flag.
1668 : : */
1669 : :
1670 : 2714 : extern "C" void M2Options_SetScaffoldMain (bool value)
1671 : : {
1672 : 2714 : M2Options_ScaffoldMain = value;
1673 : 2714 : }
1674 : :
1675 : :
1676 : : /*
1677 : : SetRuntimeModuleOverride - set the override sequence used for module
1678 : : initialization and finialization.
1679 : : */
1680 : :
1681 : 0 : extern "C" void M2Options_SetRuntimeModuleOverride (void * override)
1682 : : {
1683 : 0 : RuntimeModuleOverride = DynamicStrings_KillString (RuntimeModuleOverride);
1684 : 0 : RuntimeModuleOverride = DynamicStrings_InitStringCharStar (override);
1685 : 0 : }
1686 : :
1687 : :
1688 : : /*
1689 : : GetRuntimeModuleOverride - return a string containing any user override
1690 : : or the default module initialization override
1691 : : sequence.
1692 : : */
1693 : :
1694 : 2670 : extern "C" void * M2Options_GetRuntimeModuleOverride (void)
1695 : : {
1696 : 2670 : return DynamicStrings_string (RuntimeModuleOverride);
1697 : : /* static analysis guarentees a RETURN statement will be used before here. */
1698 : : __builtin_unreachable ();
1699 : : }
1700 : :
1701 : :
1702 : : /*
1703 : : SetUselist - set the uselist flag to value and remember the filename.
1704 : : */
1705 : :
1706 : 0 : extern "C" void M2Options_SetUselist (bool value, void * filename)
1707 : : {
1708 : 0 : UselistFlag = value;
1709 : 0 : UselistFilename = DynamicStrings_KillString (UselistFilename);
1710 : 0 : if (filename != NULL)
1711 : : {
1712 : 0 : UselistFilename = DynamicStrings_InitStringCharStar (filename);
1713 : : }
1714 : 0 : }
1715 : :
1716 : :
1717 : : /*
1718 : : GetUselist - return the uselist flag.
1719 : : */
1720 : :
1721 : 15135 : extern "C" bool M2Options_GetUselist (void)
1722 : : {
1723 : 15135 : return UselistFlag;
1724 : : /* static analysis guarentees a RETURN statement will be used before here. */
1725 : : __builtin_unreachable ();
1726 : : }
1727 : :
1728 : :
1729 : : /*
1730 : : GetUselistFilename - return the uselist filename as a String.
1731 : : */
1732 : :
1733 : 0 : extern "C" DynamicStrings_String M2Options_GetUselistFilename (void)
1734 : : {
1735 : 0 : return UselistFilename;
1736 : : /* static analysis guarentees a RETURN statement will be used before here. */
1737 : : __builtin_unreachable ();
1738 : : }
1739 : :
1740 : :
1741 : : /*
1742 : : SetWholeProgram - sets the WholeProgram flag (-fwhole-program).
1743 : : */
1744 : :
1745 : 24 : extern "C" void M2Options_SetWholeProgram (bool value)
1746 : : {
1747 : 24 : M2Options_WholeProgram = value;
1748 : 24 : }
1749 : :
1750 : :
1751 : : /*
1752 : : SetAutoInit - -fauto-init turns on automatic initialization of pointers to NIL.
1753 : : TRUE is returned.
1754 : : */
1755 : :
1756 : 12 : extern "C" bool M2Options_SetAutoInit (bool value)
1757 : : {
1758 : 12 : M2Options_AutoInit = value;
1759 : 12 : return true;
1760 : : /* static analysis guarentees a RETURN statement will be used before here. */
1761 : : __builtin_unreachable ();
1762 : : }
1763 : :
1764 : :
1765 : : /*
1766 : : SetReturnCheck -
1767 : : */
1768 : :
1769 : 0 : extern "C" bool M2Options_SetReturnCheck (bool value)
1770 : : {
1771 : 0 : M2Options_ReturnChecking = value;
1772 : 0 : return true;
1773 : : /* static analysis guarentees a RETURN statement will be used before here. */
1774 : : __builtin_unreachable ();
1775 : : }
1776 : :
1777 : :
1778 : : /*
1779 : : SetNilCheck -
1780 : : */
1781 : :
1782 : 0 : extern "C" bool M2Options_SetNilCheck (bool value)
1783 : : {
1784 : 0 : M2Options_NilChecking = value;
1785 : 0 : return true;
1786 : : /* static analysis guarentees a RETURN statement will be used before here. */
1787 : : __builtin_unreachable ();
1788 : : }
1789 : :
1790 : :
1791 : : /*
1792 : : SetCaseCheck - set else case checking to, value.
1793 : : */
1794 : :
1795 : 612 : extern "C" bool M2Options_SetCaseCheck (bool value)
1796 : : {
1797 : 612 : M2Options_CaseElseChecking = value;
1798 : 612 : return true;
1799 : : /* static analysis guarentees a RETURN statement will be used before here. */
1800 : : __builtin_unreachable ();
1801 : : }
1802 : :
1803 : :
1804 : : /*
1805 : : SetCheckAll - set all runtime checking to, value.
1806 : : */
1807 : :
1808 : 1929 : extern "C" bool M2Options_SetCheckAll (bool value)
1809 : : {
1810 : 1929 : M2Options_NilChecking = value;
1811 : 1929 : M2Options_WholeDivChecking = value;
1812 : 1929 : M2Options_IndexChecking = value;
1813 : 1929 : M2Options_RangeChecking = value;
1814 : 1929 : M2Options_ReturnChecking = value;
1815 : 1929 : M2Options_NilChecking = value;
1816 : 1929 : M2Options_CaseElseChecking = value;
1817 : 1929 : M2Options_FloatValueChecking = value;
1818 : 1929 : M2Options_WholeValueChecking = value;
1819 : 1929 : return true;
1820 : : /* static analysis guarentees a RETURN statement will be used before here. */
1821 : : __builtin_unreachable ();
1822 : : }
1823 : :
1824 : :
1825 : : /*
1826 : : SetVerboseUnbounded - sets the VerboseUnbounded flag to, value.
1827 : : */
1828 : :
1829 : 0 : extern "C" bool M2Options_SetVerboseUnbounded (bool value)
1830 : : {
1831 : 0 : M2Options_VerboseUnbounded = value;
1832 : 0 : return true;
1833 : : /* static analysis guarentees a RETURN statement will be used before here. */
1834 : : __builtin_unreachable ();
1835 : : }
1836 : :
1837 : :
1838 : : /*
1839 : : SetQuiet - sets the quiet flag to, value.
1840 : : */
1841 : :
1842 : 16035 : extern "C" bool M2Options_SetQuiet (bool value)
1843 : : {
1844 : 16035 : M2Options_Quiet = value;
1845 : 16035 : return true;
1846 : : /* static analysis guarentees a RETURN statement will be used before here. */
1847 : : __builtin_unreachable ();
1848 : : }
1849 : :
1850 : :
1851 : : /*
1852 : : SetCC1Quiet - sets the cc1quiet flag to, value.
1853 : : */
1854 : :
1855 : 15507 : extern "C" void M2Options_SetCC1Quiet (bool value)
1856 : : {
1857 : 15507 : CC1Quiet = value;
1858 : 15507 : }
1859 : :
1860 : :
1861 : : /*
1862 : : SetM2g - set GenerateStatementNote to value and return value.
1863 : : Corresponds to the -fm2-g flag.
1864 : : */
1865 : :
1866 : 516 : extern "C" bool M2Options_SetM2g (bool value)
1867 : : {
1868 : 516 : M2Options_GenerateStatementNote = value;
1869 : 516 : return M2Options_GenerateStatementNote;
1870 : : /* static analysis guarentees a RETURN statement will be used before here. */
1871 : : __builtin_unreachable ();
1872 : : }
1873 : :
1874 : :
1875 : : /*
1876 : : GetM2g - returns TRUE if the -fm2-g flags was used.
1877 : : */
1878 : :
1879 : 408674 : extern "C" bool M2Options_GetM2g (void)
1880 : : {
1881 : 408674 : return M2Options_GenerateStatementNote;
1882 : : /* static analysis guarentees a RETURN statement will be used before here. */
1883 : : __builtin_unreachable ();
1884 : : }
1885 : :
1886 : :
1887 : : /*
1888 : : SetLowerCaseKeywords - set the lower case keyword flag and return the result.
1889 : : */
1890 : :
1891 : 0 : extern "C" bool M2Options_SetLowerCaseKeywords (bool value)
1892 : : {
1893 : 0 : M2Options_LowerCaseKeywords = value;
1894 : 0 : return M2Options_LowerCaseKeywords;
1895 : : /* static analysis guarentees a RETURN statement will be used before here. */
1896 : : __builtin_unreachable ();
1897 : : }
1898 : :
1899 : :
1900 : : /*
1901 : : SetUnboundedByReference -
1902 : : */
1903 : :
1904 : 0 : extern "C" bool M2Options_SetUnboundedByReference (bool value)
1905 : : {
1906 : 0 : M2Options_UnboundedByReference = value;
1907 : 0 : return true;
1908 : : /* static analysis guarentees a RETURN statement will be used before here. */
1909 : : __builtin_unreachable ();
1910 : : }
1911 : :
1912 : :
1913 : : /*
1914 : : SetSearchPath -
1915 : : */
1916 : :
1917 : 253674 : extern "C" void M2Options_SetSearchPath (void * arg)
1918 : : {
1919 : 253674 : DynamicStrings_String s;
1920 : :
1921 : 253674 : s = DynamicStrings_InitStringCharStar (arg);
1922 : 253674 : PathName_AddInclude (M2PathName, s);
1923 : 253674 : if (Debugging)
1924 : : {
1925 : : PathName_DumpPathName ((const char *) "path name entries: ", 19);
1926 : : }
1927 : 253674 : s = DynamicStrings_KillString (s);
1928 : 253674 : }
1929 : :
1930 : :
1931 : : /*
1932 : : SetISO -
1933 : : */
1934 : :
1935 : 4286 : extern "C" void M2Options_SetISO (bool value)
1936 : : {
1937 : 4286 : M2Options_Iso = value;
1938 : 4286 : M2Options_Pim = ! value;
1939 : 4286 : M2Options_Pim2 = ! value;
1940 : 4286 : }
1941 : :
1942 : :
1943 : : /*
1944 : : SetPIM -
1945 : : */
1946 : :
1947 : 10732 : extern "C" void M2Options_SetPIM (bool value)
1948 : : {
1949 : 10732 : M2Options_Pim = value;
1950 : 10732 : M2Options_Iso = ! value;
1951 : 10732 : }
1952 : :
1953 : :
1954 : : /*
1955 : : SetPIM2 -
1956 : : */
1957 : :
1958 : 86 : extern "C" void M2Options_SetPIM2 (bool value)
1959 : : {
1960 : 86 : M2Options_Pim = value;
1961 : 86 : M2Options_Pim2 = value;
1962 : 86 : M2Options_Iso = ! value;
1963 : 86 : if (value)
1964 : : {
1965 : : /* Pim4 is the default, turn it off. */
1966 : 86 : M2Options_Pim4 = false;
1967 : : }
1968 : 86 : }
1969 : :
1970 : :
1971 : : /*
1972 : : SetPIM3 -
1973 : : */
1974 : :
1975 : 12 : extern "C" void M2Options_SetPIM3 (bool value)
1976 : : {
1977 : 12 : M2Options_Pim = value;
1978 : 12 : M2Options_Pim3 = value;
1979 : 12 : M2Options_Iso = ! value;
1980 : 12 : if (value)
1981 : : {
1982 : : /* Pim4 is the default, turn it off. */
1983 : 12 : M2Options_Pim4 = false;
1984 : : }
1985 : 12 : }
1986 : :
1987 : :
1988 : : /*
1989 : : SetPIM4 -
1990 : : */
1991 : :
1992 : 75 : extern "C" void M2Options_SetPIM4 (bool value)
1993 : : {
1994 : 75 : M2Options_Pim = value;
1995 : 75 : M2Options_Pim4 = value;
1996 : 75 : M2Options_Iso = ! value;
1997 : 75 : }
1998 : :
1999 : :
2000 : : /*
2001 : : SetPositiveModFloor - sets the positive mod floor option.
2002 : : */
2003 : :
2004 : 0 : extern "C" void M2Options_SetPositiveModFloor (bool value)
2005 : : {
2006 : 0 : M2Options_PositiveModFloorDiv = value;
2007 : 0 : }
2008 : :
2009 : :
2010 : : /*
2011 : : SetWholeDiv - sets the whole division flag.
2012 : : */
2013 : :
2014 : 0 : extern "C" void M2Options_SetWholeDiv (bool value)
2015 : : {
2016 : 0 : M2Options_WholeDivChecking = value;
2017 : 0 : }
2018 : :
2019 : :
2020 : : /*
2021 : : SetIndex - sets the runtime array index checking flag.
2022 : : */
2023 : :
2024 : 0 : extern "C" void M2Options_SetIndex (bool value)
2025 : : {
2026 : 0 : M2Options_IndexChecking = value;
2027 : 0 : }
2028 : :
2029 : :
2030 : : /*
2031 : : SetRange - sets the runtime range checking flag.
2032 : : */
2033 : :
2034 : 6 : extern "C" void M2Options_SetRange (bool value)
2035 : : {
2036 : 6 : M2Options_RangeChecking = value;
2037 : 6 : }
2038 : :
2039 : :
2040 : : /*
2041 : : SetExceptions - sets the enable runtime exceptions flag.
2042 : : */
2043 : :
2044 : 18 : extern "C" void M2Options_SetExceptions (bool value)
2045 : : {
2046 : 18 : M2Options_Exceptions = value;
2047 : 18 : }
2048 : :
2049 : :
2050 : : /*
2051 : : SetStyle -
2052 : : */
2053 : :
2054 : 0 : extern "C" void M2Options_SetStyle (bool value)
2055 : : {
2056 : 0 : M2Options_StyleChecking = value;
2057 : 0 : }
2058 : :
2059 : :
2060 : : /*
2061 : : SetPedantic -
2062 : : */
2063 : :
2064 : 366 : extern "C" void M2Options_SetPedantic (bool value)
2065 : : {
2066 : 366 : M2Options_Pedantic = value;
2067 : 366 : }
2068 : :
2069 : :
2070 : : /*
2071 : : SetPedanticParamNames - sets the pedantic parameter name flag.
2072 : : */
2073 : :
2074 : 12 : extern "C" void M2Options_SetPedanticParamNames (bool value)
2075 : : {
2076 : 12 : M2Options_PedanticParamNames = value;
2077 : 12 : }
2078 : :
2079 : :
2080 : : /*
2081 : : SetPedanticCast - sets the pedantic cast flag.
2082 : : */
2083 : :
2084 : 0 : extern "C" void M2Options_SetPedanticCast (bool value)
2085 : : {
2086 : 0 : M2Options_PedanticCast = value;
2087 : 0 : }
2088 : :
2089 : :
2090 : : /*
2091 : : SetExtendedOpaque - sets the ExtendedOpaque flag.
2092 : : */
2093 : :
2094 : 328 : extern "C" void M2Options_SetExtendedOpaque (bool value)
2095 : : {
2096 : 328 : M2Options_ExtendedOpaque = value;
2097 : 328 : }
2098 : :
2099 : :
2100 : : /*
2101 : : SetXCode - sets the xcode flag.
2102 : : */
2103 : :
2104 : 0 : extern "C" void M2Options_SetXCode (bool value)
2105 : : {
2106 : 0 : M2Options_Xcode = value;
2107 : 0 : }
2108 : :
2109 : :
2110 : : /*
2111 : : SetCompilerDebugging - turn on internal compiler debugging.
2112 : : Enabled via the command line option -fd.
2113 : : */
2114 : :
2115 : 0 : extern "C" void M2Options_SetCompilerDebugging (bool value)
2116 : : {
2117 : 0 : M2Options_CompilerDebugging = value;
2118 : 0 : }
2119 : :
2120 : :
2121 : : /*
2122 : : SetQuadDebugging - display the quadruples (internal debugging).
2123 : : */
2124 : :
2125 : 0 : extern "C" void M2Options_SetQuadDebugging (bool value)
2126 : : {
2127 : 0 : DumpQuad = value;
2128 : 0 : DumpQuadFilename = DynamicStrings_KillString (DumpQuadFilename);
2129 : 0 : DumpQuadFilename = DynamicStrings_InitString ((const char *) "-", 1);
2130 : 0 : }
2131 : :
2132 : :
2133 : : /*
2134 : : SetM2DebugTraceFilter - set internal debug flags. The flags should be
2135 : : specified as a comma separated list. The full
2136 : : list allowed is quad,line,token,all.
2137 : : */
2138 : :
2139 : 0 : extern "C" void M2Options_SetM2DebugTraceFilter (bool value, void * filter)
2140 : : {
2141 : 0 : DynamicStrings_String word;
2142 : 0 : DynamicStrings_String full;
2143 : 0 : int start;
2144 : 0 : int i;
2145 : :
2146 : 0 : full = DynamicStrings_InitStringCharStar (filter);
2147 : 0 : start = 0;
2148 : 0 : do {
2149 : 0 : i = DynamicStrings_Index (full, ',', static_cast<unsigned int> (start));
2150 : 0 : if (i == -1)
2151 : : {
2152 : 0 : word = DynamicStrings_Slice (full, start, 0);
2153 : : }
2154 : : else
2155 : : {
2156 : 0 : word = DynamicStrings_Slice (full, start, i);
2157 : : }
2158 : 0 : SetM2DebugTrace (word, value);
2159 : 0 : word = DynamicStrings_KillString (word);
2160 : 0 : start = i+1;
2161 : 0 : } while (! (i == -1));
2162 : 0 : full = DynamicStrings_KillString (full);
2163 : 0 : }
2164 : :
2165 : :
2166 : : /*
2167 : : SetDebugFunctionLineNumbers - set DebugFunctionLineNumbers.
2168 : : */
2169 : :
2170 : 0 : extern "C" void M2Options_SetDebugFunctionLineNumbers (bool value)
2171 : : {
2172 : 0 : DebugFunctionLineNumbers = value;
2173 : 0 : }
2174 : :
2175 : :
2176 : : /*
2177 : : SetGenerateStatementNote - turn on generation of nops if necessary
2178 : : to generate pedalogical single stepping.
2179 : : */
2180 : :
2181 : 0 : extern "C" void M2Options_SetGenerateStatementNote (bool value)
2182 : : {
2183 : 0 : M2Options_GenerateStatementNote = value;
2184 : 0 : }
2185 : :
2186 : :
2187 : : /*
2188 : : SetSources -
2189 : : */
2190 : :
2191 : 0 : extern "C" void M2Options_SetSources (bool value)
2192 : : {
2193 : 0 : M2Options_Quiet = ! value;
2194 : 0 : SeenSources = value;
2195 : 0 : }
2196 : :
2197 : :
2198 : : /*
2199 : : SetDumpSystemExports -
2200 : : */
2201 : :
2202 : 22 : extern "C" void M2Options_SetDumpSystemExports (bool value)
2203 : : {
2204 : 22 : M2Options_DumpSystemExports = value;
2205 : 22 : }
2206 : :
2207 : :
2208 : : /*
2209 : : SetSwig -
2210 : : */
2211 : :
2212 : 0 : extern "C" void M2Options_SetSwig (bool value)
2213 : : {
2214 : 0 : M2Options_GenerateSwig = value;
2215 : 0 : }
2216 : :
2217 : :
2218 : : /*
2219 : : SetOptimizing -
2220 : : */
2221 : :
2222 : 7785 : extern "C" void M2Options_SetOptimizing (unsigned int value)
2223 : : {
2224 : 7785 : if (value > 0)
2225 : : {
2226 : 7785 : M2Options_Optimizing = true;
2227 : 7785 : M2Options_OptimizeBasicBlock = true;
2228 : 7785 : M2Options_OptimizeUncalledProcedures = true;
2229 : 7785 : M2Options_OptimizeCommonSubExpressions = true;
2230 : 7785 : M2Options_OptimizeSets = true;
2231 : : }
2232 : : else
2233 : : {
2234 : 0 : M2Options_Optimizing = false;
2235 : 0 : M2Options_OptimizeBasicBlock = false;
2236 : 0 : M2Options_OptimizeUncalledProcedures = false;
2237 : 0 : M2Options_OptimizeCommonSubExpressions = false;
2238 : 0 : M2Options_OptimizeSets = false;
2239 : : }
2240 : 7785 : }
2241 : :
2242 : :
2243 : : /*
2244 : : OverrideLocation - possibly override the location value, depending upon
2245 : : whether the -flocation= option was used.
2246 : : */
2247 : :
2248 : 964182230 : extern "C" location_t M2Options_OverrideLocation (location_t location)
2249 : : {
2250 : 964182230 : if (M2Options_ForcedLocation)
2251 : : {
2252 : 0 : return ForcedLocationValue;
2253 : : }
2254 : : else
2255 : : {
2256 : : return location;
2257 : : }
2258 : : /* static analysis guarentees a RETURN statement will be used before here. */
2259 : : __builtin_unreachable ();
2260 : : }
2261 : :
2262 : :
2263 : : /*
2264 : : SetForcedLocation - sets the location for the lifetime of this compile to, location.
2265 : : This is primarily an internal debugging switch.
2266 : : */
2267 : :
2268 : 0 : extern "C" void M2Options_SetForcedLocation (location_t location)
2269 : : {
2270 : 0 : M2Options_ForcedLocation = true;
2271 : 0 : ForcedLocationValue = location;
2272 : 0 : }
2273 : :
2274 : :
2275 : : /*
2276 : : SetUnusedVariableChecking - assigns the UnusedVariableChecking to value.
2277 : : */
2278 : :
2279 : 354 : extern "C" void M2Options_SetUnusedVariableChecking (bool value)
2280 : : {
2281 : 354 : M2Options_UnusedVariableChecking = value;
2282 : 354 : }
2283 : :
2284 : :
2285 : : /*
2286 : : SetUnusedParameterChecking - assigns the UnusedParameterChecking to value.
2287 : : */
2288 : :
2289 : 0 : extern "C" void M2Options_SetUnusedParameterChecking (bool value)
2290 : : {
2291 : 0 : M2Options_UnusedParameterChecking = value;
2292 : 0 : }
2293 : :
2294 : :
2295 : : /*
2296 : : SetStrictTypeChecking - assigns the StrictTypeChecking flag to value.
2297 : : */
2298 : :
2299 : 0 : extern "C" void M2Options_SetStrictTypeChecking (bool value)
2300 : : {
2301 : 0 : M2Options_StrictTypeChecking = value;
2302 : 0 : }
2303 : :
2304 : :
2305 : : /*
2306 : : SetStrictTypeAssignment - assigns the StrictTypeAssignment flag to value.
2307 : : */
2308 : :
2309 : 0 : extern "C" void M2Options_SetStrictTypeAssignment (bool value)
2310 : : {
2311 : 0 : M2Options_StrictTypeAssignment = value;
2312 : 0 : }
2313 : :
2314 : :
2315 : : /*
2316 : : SetStrictTypeReason - assigns the StrictTypeReason flag to value.
2317 : : */
2318 : :
2319 : 0 : extern "C" void M2Options_SetStrictTypeReason (bool value)
2320 : : {
2321 : 0 : M2Options_StrictTypeReason = value;
2322 : 0 : }
2323 : :
2324 : :
2325 : : /*
2326 : : setdefextension - set the source file definition module extension to arg.
2327 : : This should include the . and by default it is set to .def.
2328 : : */
2329 : :
2330 : 6 : extern "C" void M2Options_setdefextension (void * arg)
2331 : : {
2332 : 6 : DynamicStrings_String s;
2333 : :
2334 : 6 : s = DynamicStrings_InitStringCharStar (arg);
2335 : 6 : M2Search_SetDefExtension (s);
2336 : 6 : s = DynamicStrings_KillString (s);
2337 : 6 : }
2338 : :
2339 : :
2340 : : /*
2341 : : setmodextension - set the source file module extension to arg.
2342 : : This should include the . and by default it is set to .mod.
2343 : : */
2344 : :
2345 : 6 : extern "C" void M2Options_setmodextension (void * arg)
2346 : : {
2347 : 6 : DynamicStrings_String s;
2348 : :
2349 : 6 : s = DynamicStrings_InitStringCharStar (arg);
2350 : 6 : M2Search_SetModExtension (s);
2351 : 6 : s = DynamicStrings_KillString (s);
2352 : 6 : }
2353 : :
2354 : :
2355 : : /*
2356 : : SetStatistics - turn on/off generate of compile time statistics.
2357 : : */
2358 : :
2359 : 0 : extern "C" void M2Options_SetStatistics (bool on)
2360 : : {
2361 : 0 : M2Options_Statistics = on;
2362 : 0 : }
2363 : :
2364 : :
2365 : : /*
2366 : : SetVerbose - set the Verbose flag to, value. It returns TRUE.
2367 : : */
2368 : :
2369 : 0 : extern "C" bool M2Options_SetVerbose (bool value)
2370 : : {
2371 : 0 : M2Options_Verbose = value;
2372 : 0 : return true;
2373 : : /* static analysis guarentees a RETURN statement will be used before here. */
2374 : : __builtin_unreachable ();
2375 : : }
2376 : :
2377 : :
2378 : : /*
2379 : : CppArg - sets the option and arg in the cpp command line.
2380 : : */
2381 : :
2382 : 8800 : extern "C" void M2Options_CppArg (void * opt, void * arg, bool joined)
2383 : : {
2384 : 8800 : DynamicStrings_String s;
2385 : :
2386 : 8800 : s = DynamicStrings_InitStringCharStar (opt);
2387 : 8800 : if ((DynamicStrings_EqualArray (s, (const char *) "-fcpp-begin", 11)) || (DynamicStrings_EqualArray (s, (const char *) "-fcpp-end", 9)))
2388 : : {} /* empty. */
2389 : : else
2390 : : {
2391 : : /* do nothing */
2392 : 8800 : if (! (DynamicStrings_EqualArray (CppArgs, (const char *) "", 0)))
2393 : : {
2394 : 8272 : CppArgs = DynamicStrings_ConCatChar (CppArgs, ' ');
2395 : : }
2396 : 8800 : CppArgs = DynamicStrings_ConCat (CppArgs, DynamicStrings_Mark (s));
2397 : 8800 : if (arg != NULL)
2398 : : {
2399 : 3696 : s = DynamicStrings_InitStringCharStar (arg);
2400 : 3696 : if (! joined)
2401 : : {
2402 : 1056 : CppArgs = DynamicStrings_ConCatChar (CppArgs, ' ');
2403 : : }
2404 : 3696 : CppArgs = DynamicStrings_ConCat (CppArgs, s);
2405 : : }
2406 : : }
2407 : 8800 : }
2408 : :
2409 : :
2410 : : /*
2411 : : CppCommandLine - returns the Cpp command line and all arguments.
2412 : : NIL is returned if the -fcpp is absent.
2413 : : */
2414 : :
2415 : 2868 : extern "C" DynamicStrings_String M2Options_CppCommandLine (void)
2416 : : {
2417 : 2868 : DynamicStrings_String s;
2418 : :
2419 : 2868 : if (M2Options_CPreProcessor)
2420 : : {
2421 : 2868 : s = DynamicStrings_InitStringCharStar (m2configure_FullPathCPP ());
2422 : 2868 : s = DynamicStrings_ConCat (DynamicStrings_ConCatChar (s, ' '), CppArgs);
2423 : 2868 : if (CC1Quiet)
2424 : : {
2425 : 2868 : s = DynamicStrings_ConCat (DynamicStrings_ConCatChar (s, ' '), DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "-quiet", 6)));
2426 : : }
2427 : 2868 : return s;
2428 : : }
2429 : : else
2430 : : {
2431 : : return static_cast<DynamicStrings_String> (NULL);
2432 : : }
2433 : : /* static analysis guarentees a RETURN statement will be used before here. */
2434 : : __builtin_unreachable ();
2435 : : }
2436 : :
2437 : :
2438 : : /*
2439 : : CppRemember - remember a string, s, as a cpp related argument.
2440 : : The string, s, is not garbage collected.
2441 : : */
2442 : :
2443 : 0 : extern "C" void M2Options_CppRemember (DynamicStrings_String s)
2444 : : {
2445 : 0 : if ((CppArgs == NULL) || (DynamicStrings_EqualArray (CppArgs, (const char *) "", 0)))
2446 : : {
2447 : 0 : CppArgs = DynamicStrings_Dup (s);
2448 : : }
2449 : : else
2450 : : {
2451 : 0 : CppArgs = DynamicStrings_ConCatChar (CppArgs, ' ');
2452 : 0 : CppArgs = DynamicStrings_ConCat (CppArgs, s);
2453 : : }
2454 : 0 : }
2455 : :
2456 : :
2457 : : /*
2458 : : GetISO - return TRUE if -fiso was present on the command line.
2459 : : */
2460 : :
2461 : 2458 : extern "C" bool M2Options_GetISO (void)
2462 : : {
2463 : 2458 : return M2Options_Iso;
2464 : : /* static analysis guarentees a RETURN statement will be used before here. */
2465 : : __builtin_unreachable ();
2466 : : }
2467 : :
2468 : :
2469 : : /*
2470 : : GetPIM - return TRUE if -fpim was present on the command line.
2471 : : */
2472 : :
2473 : 364254 : extern "C" bool M2Options_GetPIM (void)
2474 : : {
2475 : 364254 : return M2Options_Pim;
2476 : : /* static analysis guarentees a RETURN statement will be used before here. */
2477 : : __builtin_unreachable ();
2478 : : }
2479 : :
2480 : :
2481 : : /*
2482 : : GetPIM2 - return TRUE if -fpim2 was present on the command line.
2483 : : */
2484 : :
2485 : 0 : extern "C" bool M2Options_GetPIM2 (void)
2486 : : {
2487 : 0 : return M2Options_Pim2;
2488 : : /* static analysis guarentees a RETURN statement will be used before here. */
2489 : : __builtin_unreachable ();
2490 : : }
2491 : :
2492 : :
2493 : : /*
2494 : : GetPIM3 - return TRUE if -fpim3 was present on the command line.
2495 : : */
2496 : :
2497 : 0 : extern "C" bool M2Options_GetPIM3 (void)
2498 : : {
2499 : 0 : return M2Options_Pim3;
2500 : : /* static analysis guarentees a RETURN statement will be used before here. */
2501 : : __builtin_unreachable ();
2502 : : }
2503 : :
2504 : :
2505 : : /*
2506 : : GetPIM4 - return TRUE if -fpim4 was present on the command line.
2507 : : */
2508 : :
2509 : 7974 : extern "C" bool M2Options_GetPIM4 (void)
2510 : : {
2511 : 7974 : return M2Options_Pim4;
2512 : : /* static analysis guarentees a RETURN statement will be used before here. */
2513 : : __builtin_unreachable ();
2514 : : }
2515 : :
2516 : :
2517 : : /*
2518 : : GetPositiveModFloor - return TRUE if -fpositive-mod-floor was present
2519 : : on the command line.
2520 : : */
2521 : :
2522 : 136 : extern "C" bool M2Options_GetPositiveModFloor (void)
2523 : : {
2524 : 136 : return M2Options_PositiveModFloorDiv;
2525 : : /* static analysis guarentees a RETURN statement will be used before here. */
2526 : : __builtin_unreachable ();
2527 : : }
2528 : :
2529 : :
2530 : : /*
2531 : : GetFloatValueCheck - return TRUE if -ffloatvalue was present on the
2532 : : command line.
2533 : : */
2534 : :
2535 : 1670 : extern "C" bool M2Options_GetFloatValueCheck (void)
2536 : : {
2537 : 1670 : return M2Options_FloatValueChecking;
2538 : : /* static analysis guarentees a RETURN statement will be used before here. */
2539 : : __builtin_unreachable ();
2540 : : }
2541 : :
2542 : :
2543 : : /*
2544 : : SetFloatValueCheck - set depending upon the -ffloatvalue.
2545 : : */
2546 : :
2547 : 0 : extern "C" void M2Options_SetFloatValueCheck (bool value)
2548 : : {
2549 : 0 : M2Options_FloatValueChecking = value;
2550 : 0 : }
2551 : :
2552 : :
2553 : : /*
2554 : : GetWholeValueCheck - return TRUE if -fwholevalue was present on the
2555 : : command line.
2556 : : */
2557 : :
2558 : 51226 : extern "C" bool M2Options_GetWholeValueCheck (void)
2559 : : {
2560 : 51226 : return M2Options_WholeValueChecking;
2561 : : /* static analysis guarentees a RETURN statement will be used before here. */
2562 : : __builtin_unreachable ();
2563 : : }
2564 : :
2565 : :
2566 : : /*
2567 : : SetWholeValueCheck - set depending upon the -fwholevalue.
2568 : : */
2569 : :
2570 : 0 : extern "C" void M2Options_SetWholeValueCheck (bool value)
2571 : : {
2572 : 0 : M2Options_WholeValueChecking = value;
2573 : 0 : }
2574 : :
2575 : :
2576 : : /*
2577 : : SetWall - set all warnings to, value.
2578 : : */
2579 : :
2580 : 608 : extern "C" void M2Options_SetWall (bool value)
2581 : : {
2582 : 608 : M2Options_UnusedVariableChecking = value;
2583 : 608 : M2Options_UnusedParameterChecking = value;
2584 : 608 : M2Options_UninitVariableChecking = value;
2585 : 608 : M2Options_PedanticCast = value;
2586 : 608 : M2Options_PedanticParamNames = value;
2587 : 608 : M2Options_StyleChecking = value;
2588 : 608 : M2Options_CaseEnumChecking = value;
2589 : 608 : }
2590 : :
2591 : :
2592 : : /*
2593 : : SetSaveTemps - turn on/off -save-temps.
2594 : : */
2595 : :
2596 : 0 : extern "C" void M2Options_SetSaveTemps (bool value)
2597 : : {
2598 : 0 : M2Options_SaveTemps = value;
2599 : 0 : }
2600 : :
2601 : :
2602 : : /*
2603 : : SetSaveTempsDir - turn on/off -save-temps and specify the directory.
2604 : : */
2605 : :
2606 : 0 : extern "C" void M2Options_SetSaveTempsDir (void * arg)
2607 : : {
2608 : 0 : SaveTempsDir = DynamicStrings_InitStringCharStar (arg);
2609 : 0 : M2Options_SaveTemps = true;
2610 : 0 : }
2611 : :
2612 : :
2613 : : /*
2614 : : GetSaveTempsDir - return SaveTempsDir or NIL if -save-temps was not used.
2615 : : */
2616 : :
2617 : 248352 : extern "C" DynamicStrings_String M2Options_GetSaveTempsDir (void)
2618 : : {
2619 : 248352 : return SaveTempsDir;
2620 : : /* static analysis guarentees a RETURN statement will be used before here. */
2621 : : __builtin_unreachable ();
2622 : : }
2623 : :
2624 : :
2625 : : /*
2626 : : SetDumpDir - Set the dump dir.
2627 : : */
2628 : :
2629 : 12703 : extern "C" void M2Options_SetDumpDir (void * arg)
2630 : : {
2631 : 12703 : DumpDir = DynamicStrings_InitStringCharStar (arg);
2632 : 12703 : }
2633 : :
2634 : :
2635 : : /*
2636 : : GetDumpDir - return DumpDir or NIL.
2637 : : */
2638 : :
2639 : 248352 : extern "C" DynamicStrings_String M2Options_GetDumpDir (void)
2640 : : {
2641 : 248352 : return DumpDir;
2642 : : /* static analysis guarentees a RETURN statement will be used before here. */
2643 : : __builtin_unreachable ();
2644 : : }
2645 : :
2646 : :
2647 : : /*
2648 : : SetGenModuleList - set the GenModuleList flag to true and pass
2649 : : set GenModuleListFilename to filename.
2650 : : */
2651 : :
2652 : 2684 : extern "C" void M2Options_SetGenModuleList (bool value, void * filename)
2653 : : {
2654 : 2684 : GenModuleListFilename = DynamicStrings_KillString (GenModuleListFilename);
2655 : 2684 : if (filename != NULL)
2656 : : {
2657 : 2684 : GenModuleListFilename = DynamicStrings_InitStringCharStar (filename);
2658 : : }
2659 : 2684 : M2Options_GenModuleList = value;
2660 : 2684 : }
2661 : :
2662 : :
2663 : : /*
2664 : : GetGenModuleFilename - returns the filename set by SetGenModuleList.
2665 : : */
2666 : :
2667 : 5356 : extern "C" DynamicStrings_String M2Options_GetGenModuleFilename (void)
2668 : : {
2669 : 5356 : return GenModuleListFilename;
2670 : : /* static analysis guarentees a RETURN statement will be used before here. */
2671 : : __builtin_unreachable ();
2672 : : }
2673 : :
2674 : :
2675 : : /*
2676 : : SetShared - sets the SharedFlag to value.
2677 : : */
2678 : :
2679 : 0 : extern "C" void M2Options_SetShared (bool value)
2680 : : {
2681 : 0 : M2Options_SharedFlag = value;
2682 : 0 : }
2683 : :
2684 : :
2685 : : /*
2686 : : SetUninitVariableChecking - sets the UninitVariableChecking and
2687 : : UninitVariableConditionalChecking flags to value
2688 : : depending upon arg string. The arg string
2689 : : can be: "all", "known,cond", "cond,known", "known"
2690 : : or "cond".
2691 : : */
2692 : :
2693 : 625 : extern "C" int M2Options_SetUninitVariableChecking (bool value, void * arg)
2694 : : {
2695 : 625 : DynamicStrings_String s;
2696 : :
2697 : 625 : if (Debugging)
2698 : : {
2699 : : /* avoid gcc warning by using compound statement even if not strictly necessary. */
2700 : : if (value)
2701 : : {
2702 : : libc_printf ((const char *) "SetUninitVariableChecking (TRUE, %s)\\n", 38, arg);
2703 : : }
2704 : : else
2705 : : {
2706 : : libc_printf ((const char *) "SetUninitVariableChecking (FALSE, %s)\\n", 39, arg);
2707 : : }
2708 : : }
2709 : 625 : s = DynamicStrings_InitStringCharStar (arg);
2710 : 625 : if (((DynamicStrings_EqualArray (s, (const char *) "all", 3)) || (DynamicStrings_EqualArray (s, (const char *) "known,cond", 10))) || (DynamicStrings_EqualArray (s, (const char *) "cond,known", 10)))
2711 : : {
2712 : 427 : M2Options_UninitVariableChecking = value;
2713 : 427 : M2Options_UninitVariableConditionalChecking = value;
2714 : 427 : s = DynamicStrings_KillString (s);
2715 : 427 : return 1;
2716 : : }
2717 : 198 : else if (DynamicStrings_EqualArray (s, (const char *) "known", 5))
2718 : : {
2719 : : /* avoid dangling else. */
2720 : 198 : M2Options_UninitVariableChecking = value;
2721 : 198 : s = DynamicStrings_KillString (s);
2722 : 198 : return 1;
2723 : : }
2724 : 0 : else if (DynamicStrings_EqualArray (s, (const char *) "cond", 4))
2725 : : {
2726 : : /* avoid dangling else. */
2727 : 0 : M2Options_UninitVariableConditionalChecking = value;
2728 : 0 : s = DynamicStrings_KillString (s);
2729 : 0 : return 1;
2730 : : }
2731 : : else
2732 : : {
2733 : : /* avoid dangling else. */
2734 : 0 : s = DynamicStrings_KillString (s);
2735 : 0 : return 0;
2736 : : }
2737 : : /* static analysis guarentees a RETURN statement will be used before here. */
2738 : : __builtin_unreachable ();
2739 : : }
2740 : :
2741 : :
2742 : : /*
2743 : : SetCaseEnumChecking - sets the CaseEnumChecking to value.
2744 : : */
2745 : :
2746 : 696 : extern "C" void M2Options_SetCaseEnumChecking (bool value)
2747 : : {
2748 : 696 : M2Options_CaseEnumChecking = value;
2749 : 696 : }
2750 : :
2751 : :
2752 : : /*
2753 : : SetDebugBuiltins - sets the DebugBuiltins to value.
2754 : : */
2755 : :
2756 : 0 : extern "C" void M2Options_SetDebugBuiltins (bool value)
2757 : : {
2758 : 0 : M2Options_DebugBuiltins = value;
2759 : 0 : }
2760 : :
2761 : :
2762 : : /*
2763 : : SetIBMLongDouble - enable/disable LONGREAL to map onto the
2764 : : IBM long double 128 bit data type.
2765 : : (Only available on the ppc).
2766 : : */
2767 : :
2768 : 0 : extern "C" void M2Options_SetIBMLongDouble (bool value)
2769 : : {
2770 : 0 : IBMLongDouble = value;
2771 : 0 : if (value)
2772 : : {
2773 : 0 : IEEELongDouble = false;
2774 : : }
2775 : 0 : }
2776 : :
2777 : :
2778 : : /*
2779 : : GetIBMLongDouble - return the value of IBMLongDouble.
2780 : : */
2781 : :
2782 : 0 : extern "C" bool M2Options_GetIBMLongDouble (void)
2783 : : {
2784 : 0 : return IBMLongDouble;
2785 : : /* static analysis guarentees a RETURN statement will be used before here. */
2786 : : __builtin_unreachable ();
2787 : : }
2788 : :
2789 : :
2790 : : /*
2791 : : SetIEEELongDouble - enable/disable LONGREAL to map onto the
2792 : : IEEE long double 128 bit data type.
2793 : : (Only available on the ppc).
2794 : : */
2795 : :
2796 : 0 : extern "C" void M2Options_SetIEEELongDouble (bool value)
2797 : : {
2798 : 0 : IEEELongDouble = value;
2799 : 0 : if (value)
2800 : : {
2801 : 0 : IBMLongDouble = false;
2802 : : }
2803 : 0 : }
2804 : :
2805 : :
2806 : : /*
2807 : : GetIEEELongDouble - return the value of IEEELongDouble.
2808 : : */
2809 : :
2810 : 15506 : extern "C" bool M2Options_GetIEEELongDouble (void)
2811 : : {
2812 : 15506 : return IEEELongDouble;
2813 : : /* static analysis guarentees a RETURN statement will be used before here. */
2814 : : __builtin_unreachable ();
2815 : : }
2816 : :
2817 : :
2818 : : /*
2819 : : GetDumpDeclFilename - returns the DumpDeclFilename.
2820 : : */
2821 : :
2822 : 0 : extern "C" DynamicStrings_String M2Options_GetDumpDeclFilename (void)
2823 : : {
2824 : 0 : return DumpDeclFilename;
2825 : : /* static analysis guarentees a RETURN statement will be used before here. */
2826 : : __builtin_unreachable ();
2827 : : }
2828 : :
2829 : :
2830 : : /*
2831 : : SetDumpDeclFilename -
2832 : : */
2833 : :
2834 : 0 : extern "C" void M2Options_SetDumpDeclFilename (bool value, void * filename)
2835 : : {
2836 : 0 : DumpDecl = value;
2837 : 0 : DumpDeclFilename = DynamicStrings_KillString (DumpDeclFilename);
2838 : 0 : if (filename != NULL)
2839 : : {
2840 : 0 : DumpDeclFilename = DynamicStrings_InitStringCharStar (filename);
2841 : : }
2842 : 0 : }
2843 : :
2844 : :
2845 : : /*
2846 : : GetDumpQuadFilename - returns the DumpQuadFilename.
2847 : : */
2848 : :
2849 : 0 : extern "C" DynamicStrings_String M2Options_GetDumpQuadFilename (void)
2850 : : {
2851 : 0 : return DumpQuadFilename;
2852 : : /* static analysis guarentees a RETURN statement will be used before here. */
2853 : : __builtin_unreachable ();
2854 : : }
2855 : :
2856 : :
2857 : : /*
2858 : : SetDumpQuadFilename -
2859 : : */
2860 : :
2861 : 0 : extern "C" void M2Options_SetDumpQuadFilename (bool value, void * filename)
2862 : : {
2863 : 0 : DumpQuad = value;
2864 : 0 : DumpQuadFilename = DynamicStrings_KillString (DumpQuadFilename);
2865 : 0 : if (filename != NULL)
2866 : : {
2867 : 0 : DumpQuadFilename = DynamicStrings_InitStringCharStar (filename);
2868 : : }
2869 : 0 : }
2870 : :
2871 : :
2872 : : /*
2873 : : GetDumpGimpleFilename - returns the DumpGimpleFilename.
2874 : : */
2875 : :
2876 : 0 : extern "C" DynamicStrings_String M2Options_GetDumpGimpleFilename (void)
2877 : : {
2878 : 0 : return DumpGimpleFilename;
2879 : : /* static analysis guarentees a RETURN statement will be used before here. */
2880 : : __builtin_unreachable ();
2881 : : }
2882 : :
2883 : :
2884 : : /*
2885 : : SetDumpGimpleFilename - set DumpGimpleFilename to filename.
2886 : : */
2887 : :
2888 : 0 : extern "C" void M2Options_SetDumpGimpleFilename (bool value, void * filename)
2889 : : {
2890 : 0 : DumpGimple = value;
2891 : 0 : DumpGimpleFilename = DynamicStrings_KillString (DumpGimpleFilename);
2892 : 0 : if (value && (filename != NULL))
2893 : : {
2894 : 0 : DumpGimpleFilename = DynamicStrings_InitStringCharStar (filename);
2895 : : }
2896 : 0 : }
2897 : :
2898 : :
2899 : : /*
2900 : : SetM2DumpFilter - sets the filter to a comma separated list of procedures
2901 : : and modules. Not to be confused with SetM2Dump below
2902 : : which enables the class of data structures to be dumped.
2903 : : */
2904 : :
2905 : 0 : extern "C" void M2Options_SetM2DumpFilter (bool value, void * filter)
2906 : : {
2907 : 0 : M2DumpFilter = DynamicStrings_KillString (M2DumpFilter);
2908 : 0 : if (value && (filter != NULL))
2909 : : {
2910 : 0 : M2DumpFilter = DynamicStrings_InitStringCharStar (filter);
2911 : : }
2912 : 0 : }
2913 : :
2914 : :
2915 : : /*
2916 : : GetM2DumpFilter - returns the dump filter.
2917 : : */
2918 : :
2919 : 0 : extern "C" void * M2Options_GetM2DumpFilter (void)
2920 : : {
2921 : 0 : if (M2DumpFilter == NULL)
2922 : : {
2923 : : return NULL;
2924 : : }
2925 : : else
2926 : : {
2927 : 0 : return DynamicStrings_string (M2DumpFilter);
2928 : : }
2929 : : /* static analysis guarentees a RETURN statement will be used before here. */
2930 : : __builtin_unreachable ();
2931 : : }
2932 : :
2933 : :
2934 : : /*
2935 : : SetM2Dump - sets the dump via a comma separated list: quad,decl,gimple,all.
2936 : : It returns TRUE if the comma separated list is valid.
2937 : : */
2938 : :
2939 : 0 : extern "C" bool M2Options_SetM2Dump (bool value, void * filter)
2940 : : {
2941 : 0 : bool result;
2942 : 0 : DynamicStrings_String dump;
2943 : 0 : int start;
2944 : 0 : int i;
2945 : :
2946 : 0 : if (filter == NULL)
2947 : : {
2948 : : return false;
2949 : : }
2950 : 0 : if (M2Dump != NULL)
2951 : : {
2952 : 0 : M2Dump = DynamicStrings_KillString (M2Dump);
2953 : : }
2954 : 0 : M2Dump = DynamicStrings_InitStringCharStar (filter);
2955 : 0 : start = 0;
2956 : 0 : do {
2957 : 0 : i = DynamicStrings_Index (M2Dump, ',', static_cast<unsigned int> (start));
2958 : 0 : if (i == -1)
2959 : : {
2960 : 0 : dump = DynamicStrings_Slice (M2Dump, start, 0);
2961 : : }
2962 : : else
2963 : : {
2964 : 0 : dump = DynamicStrings_Slice (M2Dump, start, i);
2965 : : }
2966 : 0 : result = MatchDump (dump, value);
2967 : 0 : dump = DynamicStrings_KillString (dump);
2968 : 0 : if (! result)
2969 : : {
2970 : : return false;
2971 : : }
2972 : 0 : start = i+1;
2973 : 0 : } while (! (i == -1));
2974 : : return true;
2975 : : /* static analysis guarentees a RETURN statement will be used before here. */
2976 : : __builtin_unreachable ();
2977 : : }
2978 : :
2979 : :
2980 : : /*
2981 : : GetDumpGimple - return TRUE if the dump gimple flag is set from SetM2Dump.
2982 : : */
2983 : :
2984 : 231987 : extern "C" bool M2Options_GetDumpGimple (void)
2985 : : {
2986 : 231987 : return DumpGimple;
2987 : : /* static analysis guarentees a RETURN statement will be used before here. */
2988 : : __builtin_unreachable ();
2989 : : }
2990 : :
2991 : :
2992 : : /*
2993 : : GetDumpQuad - return TRUE if the dump quad flag is set from SetM2Dump.
2994 : : */
2995 : :
2996 : 72287 : extern "C" bool M2Options_GetDumpQuad (void)
2997 : : {
2998 : 72287 : return DumpQuad;
2999 : : /* static analysis guarentees a RETURN statement will be used before here. */
3000 : : __builtin_unreachable ();
3001 : : }
3002 : :
3003 : :
3004 : : /*
3005 : : GetDumpDecl - return TRUE if the dump decl flag is set from SetM2Dump.
3006 : : */
3007 : :
3008 : 28970 : extern "C" bool M2Options_GetDumpDecl (void)
3009 : : {
3010 : 28970 : return DumpDecl;
3011 : : /* static analysis guarentees a RETURN statement will be used before here. */
3012 : : __builtin_unreachable ();
3013 : : }
3014 : :
3015 : :
3016 : : /*
3017 : : GetDebugTraceQuad - return DebugTraceQuad.
3018 : : */
3019 : :
3020 : 181260340 : extern "C" bool M2Options_GetDebugTraceQuad (void)
3021 : : {
3022 : 181260340 : return DebugTraceQuad;
3023 : : /* static analysis guarentees a RETURN statement will be used before here. */
3024 : : __builtin_unreachable ();
3025 : : }
3026 : :
3027 : :
3028 : : /*
3029 : : GetDebugTraceTree - return DebugTraceTree.
3030 : : */
3031 : :
3032 : 0 : extern "C" bool M2Options_GetDebugTraceTree (void)
3033 : : {
3034 : 0 : return DebugTraceTree;
3035 : : /* static analysis guarentees a RETURN statement will be used before here. */
3036 : : __builtin_unreachable ();
3037 : : }
3038 : :
3039 : :
3040 : : /*
3041 : : GetDebugTraceToken - return DebugTraceToken.
3042 : : */
3043 : :
3044 : 960227713 : extern "C" bool M2Options_GetDebugTraceToken (void)
3045 : : {
3046 : 960227713 : return DebugTraceToken;
3047 : : /* static analysis guarentees a RETURN statement will be used before here. */
3048 : : __builtin_unreachable ();
3049 : : }
3050 : :
3051 : :
3052 : : /*
3053 : : GetDebugTraceLine - return DebugTraceLine.
3054 : : */
3055 : :
3056 : 66214665 : extern "C" bool M2Options_GetDebugTraceLine (void)
3057 : : {
3058 : 66214665 : return DebugTraceLine;
3059 : : /* static analysis guarentees a RETURN statement will be used before here. */
3060 : : __builtin_unreachable ();
3061 : : }
3062 : :
3063 : :
3064 : : /*
3065 : : GetDebugFunctionLineNumbers - return DebugFunctionLineNumbers.
3066 : : */
3067 : :
3068 : 14227 : extern "C" bool M2Options_GetDebugFunctionLineNumbers (void)
3069 : : {
3070 : 14227 : return DebugFunctionLineNumbers;
3071 : : /* static analysis guarentees a RETURN statement will be used before here. */
3072 : : __builtin_unreachable ();
3073 : : }
3074 : :
3075 : :
3076 : : /*
3077 : : GetEnableForward - return EnableForward.
3078 : : */
3079 : :
3080 : 60 : extern "C" bool M2Options_GetEnableForward (void)
3081 : : {
3082 : 60 : return EnableForward;
3083 : : /* static analysis guarentees a RETURN statement will be used before here. */
3084 : : __builtin_unreachable ();
3085 : : }
3086 : :
3087 : :
3088 : : /*
3089 : : SetEnableForward - set EnableForward to value.
3090 : : */
3091 : :
3092 : 0 : extern "C" void M2Options_SetEnableForward (bool value)
3093 : : {
3094 : 0 : EnableForward = value;
3095 : 0 : }
3096 : :
3097 : :
3098 : : /*
3099 : : SetFileOffsetBits - create SYSTEM.COFF_T as a signed integer of size bits.
3100 : : */
3101 : :
3102 : 0 : extern "C" bool M2Options_SetFileOffsetBits (bool value, unsigned int bits)
3103 : : {
3104 : 0 : if (value)
3105 : : {
3106 : 0 : OffTBits = bits;
3107 : : }
3108 : 0 : return true;
3109 : : /* static analysis guarentees a RETURN statement will be used before here. */
3110 : : __builtin_unreachable ();
3111 : : }
3112 : :
3113 : :
3114 : : /*
3115 : : GetFileOffsetBits - return the number of bits used to create SYSTEM.COFF_T.
3116 : : */
3117 : :
3118 : 15506 : extern "C" unsigned int M2Options_GetFileOffsetBits (void)
3119 : : {
3120 : 15506 : return OffTBits;
3121 : : /* static analysis guarentees a RETURN statement will be used before here. */
3122 : : __builtin_unreachable ();
3123 : : }
3124 : :
3125 : :
3126 : : /*
3127 : : SetMemReport - set MemReport to value.
3128 : : */
3129 : :
3130 : 0 : extern "C" void M2Options_SetMemReport (bool value)
3131 : : {
3132 : 0 : M2Options_MemReport = value;
3133 : 0 : }
3134 : :
3135 : :
3136 : : /*
3137 : : SetTimeReport - set TimeReport to value.
3138 : : */
3139 : :
3140 : 0 : extern "C" void M2Options_SetTimeReport (bool value)
3141 : : {
3142 : 0 : M2Options_TimeReport = value;
3143 : 0 : }
3144 : :
3145 : :
3146 : : /*
3147 : : SetWideset - set the Wideset flag to value.
3148 : : */
3149 : :
3150 : 6 : extern "C" void M2Options_SetWideset (bool value)
3151 : : {
3152 : 6 : WidesetFlag = value;
3153 : 6 : }
3154 : :
3155 : :
3156 : : /*
3157 : : GetWideset - return the Wideset flag value.
3158 : : */
3159 : :
3160 : 17684 : extern "C" bool M2Options_GetWideset (void)
3161 : : {
3162 : 17684 : return WidesetFlag;
3163 : : /* static analysis guarentees a RETURN statement will be used before here. */
3164 : : __builtin_unreachable ();
3165 : : }
3166 : :
3167 : :
3168 : : /*
3169 : : FinaliseOptions - once all options have been parsed we set any inferred
3170 : : values.
3171 : : */
3172 : :
3173 : 15507 : extern "C" void M2Options_FinaliseOptions (void)
3174 : : {
3175 : : /* currently only one value, this could be make an option in the future */
3176 : 15507 : M2Options_VariantValueChecking = M2Options_Iso;
3177 : 15507 : }
3178 : :
3179 : 15507 : extern "C" void _M2_M2Options_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
3180 : : {
3181 : 15507 : M2Options_cflag = false; /* -c. */
3182 : 15507 : RuntimeModuleOverride = DynamicStrings_InitString ((const char *) "m2iso:RTentity,m2iso:Storage,m2iso:SYSTEM,m2iso:M2RTS,m2iso:RTExceptions,m2iso:IOLink", 85); /* -c. */
3183 : 15507 : CppArgs = DynamicStrings_InitString ((const char *) "", 0);
3184 : 15507 : M2Options_Pim = true;
3185 : 15507 : M2Options_Pim2 = false;
3186 : 15507 : M2Options_Pim3 = false;
3187 : 15507 : M2Options_Pim4 = true;
3188 : 15507 : M2Options_PositiveModFloorDiv = false;
3189 : 15507 : M2Options_Iso = false;
3190 : 15507 : SeenSources = false;
3191 : 15507 : M2Options_Statistics = false;
3192 : 15507 : M2Options_StyleChecking = false;
3193 : 15507 : M2Options_CompilerDebugging = false;
3194 : 15507 : M2Options_GenerateDebugging = false;
3195 : 15507 : M2Options_Optimizing = false;
3196 : 15507 : M2Options_Pedantic = false;
3197 : 15507 : M2Options_Verbose = false;
3198 : 15507 : M2Options_Quiet = true;
3199 : 15507 : CC1Quiet = true;
3200 : 15507 : M2Options_Profiling = false;
3201 : 15507 : DumpQuad = false;
3202 : 15507 : M2Options_OptimizeBasicBlock = false;
3203 : 15507 : M2Options_OptimizeUncalledProcedures = false;
3204 : 15507 : M2Options_OptimizeCommonSubExpressions = false;
3205 : 15507 : M2Options_OptimizeSets = false;
3206 : 15507 : M2Options_NilChecking = false;
3207 : 15507 : M2Options_WholeDivChecking = false;
3208 : 15507 : M2Options_WholeValueChecking = false;
3209 : 15507 : M2Options_FloatValueChecking = false;
3210 : 15507 : M2Options_IndexChecking = false;
3211 : 15507 : M2Options_RangeChecking = false;
3212 : 15507 : M2Options_ReturnChecking = false;
3213 : 15507 : M2Options_CaseElseChecking = false;
3214 : 15507 : M2Options_CPreProcessor = false;
3215 : 15507 : M2Options_LineDirectives = true;
3216 : 15507 : M2Options_ExtendedOpaque = false;
3217 : 15507 : M2Options_UnboundedByReference = false;
3218 : 15507 : M2Options_VerboseUnbounded = false;
3219 : 15507 : M2Options_PedanticParamNames = false;
3220 : 15507 : M2Options_PedanticCast = false;
3221 : 15507 : M2Options_Xcode = false;
3222 : 15507 : M2Options_DumpSystemExports = false;
3223 : 15507 : M2Options_GenerateSwig = false;
3224 : 15507 : M2Options_Exceptions = true;
3225 : 15507 : M2Options_DebugBuiltins = false;
3226 : 15507 : M2Options_ForcedLocation = false;
3227 : 15507 : M2Options_WholeProgram = false;
3228 : 15507 : DebugTraceQuad = false;
3229 : 15507 : DebugTraceTree = false;
3230 : 15507 : DebugTraceLine = false;
3231 : 15507 : DebugTraceToken = false;
3232 : 15507 : DebugFunctionLineNumbers = false;
3233 : 15507 : M2Options_GenerateStatementNote = false;
3234 : 15507 : M2Options_LowerCaseKeywords = false;
3235 : 15507 : M2Options_UnusedVariableChecking = false;
3236 : 15507 : M2Options_UnusedParameterChecking = false;
3237 : 15507 : M2Options_StrictTypeChecking = true;
3238 : 15507 : M2Options_StrictTypeAssignment = true;
3239 : 15507 : M2Options_StrictTypeReason = true;
3240 : 15507 : M2Options_AutoInit = false;
3241 : 15507 : M2Options_SaveTemps = false;
3242 : 15507 : M2Options_ScaffoldDynamic = true;
3243 : 15507 : M2Options_ScaffoldStatic = false;
3244 : 15507 : M2Options_ScaffoldMain = false;
3245 : 15507 : UselistFilename = static_cast<DynamicStrings_String> (NULL);
3246 : 15507 : M2Options_GenModuleList = false;
3247 : 15507 : GenModuleListFilename = static_cast<DynamicStrings_String> (NULL);
3248 : 15507 : M2Options_SharedFlag = false;
3249 : 15507 : Barg = static_cast<DynamicStrings_String> (NULL);
3250 : 15507 : MDFlag = false;
3251 : 15507 : MMDFlag = false;
3252 : 15507 : DepTarget = static_cast<DynamicStrings_String> (NULL);
3253 : 15507 : MPFlag = false;
3254 : 15507 : SaveTempsDir = static_cast<DynamicStrings_String> (NULL);
3255 : 15507 : DumpDir = static_cast<DynamicStrings_String> (NULL);
3256 : 15507 : M2Options_UninitVariableChecking = false;
3257 : 15507 : M2Options_UninitVariableConditionalChecking = false;
3258 : 15507 : M2Options_CaseEnumChecking = false;
3259 : 15507 : MFlag = false;
3260 : 15507 : MMFlag = false;
3261 : 15507 : MFarg = static_cast<DynamicStrings_String> (NULL);
3262 : 15507 : MTFlag = static_cast<DynamicStrings_String> (NULL);
3263 : 15507 : MQFlag = static_cast<DynamicStrings_String> (NULL);
3264 : 15507 : InitializeLongDoubleFlags ();
3265 : 15507 : M2Prefix = DynamicStrings_InitString ((const char *) "", 0);
3266 : 15507 : M2PathName = DynamicStrings_InitString ((const char *) "", 0);
3267 : 15507 : DumpQuadFilename = static_cast<DynamicStrings_String> (NULL);
3268 : 15507 : DumpGimpleFilename = static_cast<DynamicStrings_String> (NULL);
3269 : 15507 : DumpDeclFilename = static_cast<DynamicStrings_String> (NULL);
3270 : 15507 : DumpDecl = false;
3271 : 15507 : DumpQuad = false;
3272 : 15507 : DumpGimple = false;
3273 : 15507 : M2Dump = static_cast<DynamicStrings_String> (NULL);
3274 : 15507 : M2DumpFilter = static_cast<DynamicStrings_String> (NULL);
3275 : 15507 : M2Options_TimeReport = false;
3276 : 15507 : M2Options_MemReport = false;
3277 : 15507 : EnableForward = true;
3278 : 15507 : OffTBits = 0; /* Default to CSSIZE_T. */
3279 : 15507 : WidesetFlag = true; /* Default to CSSIZE_T. */
3280 : 15507 : }
3281 : :
3282 : 0 : extern "C" void _M2_M2Options_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
3283 : : {
3284 : 0 : }
|