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