CBMC
Loading...
Searching...
No Matches
config.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9#include "config.h"
10
11#include "arith_tools.h"
12#include "cmdline.h"
13#include "cprover_prefix.h"
14#include "exception_utils.h"
15#include "namespace.h"
16#include "pointer_expr.h"
17#include "simplify_expr.h"
18#include "string2int.h"
19#include "string_utils.h"
20#include "symbol_table_base.h"
21
22#include <climits>
23#include <cstdlib>
24
26
31
33{
34 set_ILP32();
35}
36
38{
39 #ifdef _WIN32
40 set_LLP64();
41 #else
42 set_LP64();
43 #endif
44}
45
48{
49 bool_width=1*8;
50 int_width=4*8;
51 long_int_width=8*8;
52 char_width=1*8;
53 short_int_width=2*8;
54 long_long_int_width=8*8;
55 pointer_width=8*8;
56 single_width=4*8;
57 double_width=8*8;
58 long_double_width=16*8;
59 char_is_unsigned=false;
60 wchar_t_is_unsigned=false;
61 wchar_t_width=4*8;
62 alignment=1;
63 memory_operand_size=int_width/8;
64}
65
67// TODO: find the alignment restrictions (per type) of the different
68// architectures (currently: sizeof=alignedof)
69// TODO: implement the __attribute__((__aligned__(val)))
70
72{
73 bool_width=1*8;
74 int_width=8*8;
75 long_int_width=8*8;
76 char_width=1*8;
77 short_int_width=2*8;
78 long_long_int_width=8*8;
79 pointer_width=8*8;
80 single_width=4*8;
81 double_width=8*8;
82 long_double_width=8*8;
83 char_is_unsigned=false;
84 wchar_t_is_unsigned=false;
85 wchar_t_width=4*8;
86 alignment=1;
87 memory_operand_size=int_width/8;
88}
89
92{
93 bool_width=1*8;
94 int_width=4*8;
95 long_int_width=4*8;
96 char_width=1*8;
97 short_int_width=2*8;
98 long_long_int_width=8*8;
99 pointer_width=8*8;
100 single_width=4*8;
101 double_width=8*8;
102 long_double_width=8*8;
103 char_is_unsigned=false;
104 wchar_t_is_unsigned=false;
105 wchar_t_width=4*8;
106 alignment=1;
107 memory_operand_size=int_width/8;
108}
109
112{
113 bool_width=1*8;
114 int_width=4*8;
115 long_int_width=4*8;
116 char_width=1*8;
117 short_int_width=2*8;
118 long_long_int_width=8*8;
119 pointer_width=4*8;
120 single_width=4*8;
121 double_width=8*8;
122 long_double_width=12*8; // really 96 bits on GCC
123 char_is_unsigned=false;
124 wchar_t_is_unsigned=false;
125 wchar_t_width=4*8;
126 alignment=1;
127 memory_operand_size=int_width/8;
128}
129
132{
133 bool_width=1*8;
134 int_width=2*8;
135 long_int_width=4*8;
136 char_width=1*8;
137 short_int_width=2*8;
138 long_long_int_width=8*8;
139 pointer_width=4*8;
140 single_width=4*8;
141 double_width=8*8;
142 long_double_width=8*8;
143 char_is_unsigned=false;
144 wchar_t_is_unsigned=false;
145 wchar_t_width=4*8;
146 alignment=1;
147 memory_operand_size=int_width/8;
148}
149
158{
159 if(
160 mode == flavourt::VISUAL_STUDIO ||
161 (arch_is_x86_family && mode == flavourt::GCC))
162 {
163 argument_evaluation_order = argument_evaluation_ordert::RIGHT_TO_LEFT;
164 }
165 else
166 argument_evaluation_order = argument_evaluation_ordert::LEFT_TO_RIGHT;
167}
168
170{
171 arch_is_x86_family = true;
172 set_argument_evaluation_order();
173 set_ILP32();
174 endianness=endiannesst::IS_LITTLE_ENDIAN;
175 char_is_unsigned=false;
176 NULL_is_zero=true;
177
178 switch(mode)
179 {
180 case flavourt::GCC:
181 case flavourt::CLANG:
182 defines.push_back("i386");
183 defines.push_back("__i386");
184 defines.push_back("__i386__");
185 if(mode == flavourt::CLANG)
186 defines.push_back("__LITTLE_ENDIAN__");
187 break;
188
189 case flavourt::VISUAL_STUDIO:
190 defines.push_back("_M_IX86");
191 break;
192
193 case flavourt::CODEWARRIOR:
194 case flavourt::ARM:
195 case flavourt::ANSI:
196 break;
197
198 case flavourt::NONE:
200 }
201}
202
204{
205 arch_is_x86_family = true;
206 set_argument_evaluation_order();
207 set_LP64();
208 endianness=endiannesst::IS_LITTLE_ENDIAN;
209 long_double_width=16*8;
210 char_is_unsigned=false;
211 NULL_is_zero=true;
212
213 switch(mode)
214 {
215 case flavourt::GCC:
216 case flavourt::CLANG:
217 defines.push_back("__LP64__");
218 defines.push_back("__x86_64");
219 defines.push_back("__x86_64__");
220 defines.push_back("_LP64");
221 defines.push_back("__amd64__");
222 defines.push_back("__amd64");
223
224 if(os == ost::OS_MACOS)
225 defines.push_back("__LITTLE_ENDIAN__");
226 break;
227
228 case flavourt::VISUAL_STUDIO:
229 defines.push_back("_M_X64");
230 defines.push_back("_M_AMD64");
231 break;
232
233 case flavourt::CODEWARRIOR:
234 case flavourt::ARM:
235 case flavourt::ANSI:
236 break;
237
238 case flavourt::NONE:
240 }
241}
242
244{
245 arch_is_x86_family = false;
246 set_argument_evaluation_order();
247 if(subarch=="powerpc")
248 set_ILP32();
249 else // ppc64 or ppc64le
250 set_LP64();
251
252 if(subarch=="ppc64le")
253 endianness=endiannesst::IS_LITTLE_ENDIAN;
254 else
255 endianness=endiannesst::IS_BIG_ENDIAN;
256
257 long_double_width=16*8;
258 char_is_unsigned=true;
259 NULL_is_zero=true;
260
261 switch(mode)
262 {
263 case flavourt::GCC:
264 case flavourt::CLANG:
265 defines.push_back("__powerpc");
266 defines.push_back("__powerpc__");
267 defines.push_back("__POWERPC__");
268 defines.push_back("__ppc__");
269
270 if(os == ost::OS_MACOS)
271 defines.push_back("__BIG_ENDIAN__");
272
273 if(subarch!="powerpc")
274 {
275 defines.push_back("__powerpc64");
276 defines.push_back("__powerpc64__");
277 defines.push_back("__PPC64__");
278 defines.push_back("__ppc64__");
279 if(subarch=="ppc64le")
280 {
281 defines.push_back("_CALL_ELF=2");
282 defines.push_back("__LITTLE_ENDIAN__");
283 }
284 else
285 {
286 defines.push_back("_CALL_ELF=1");
287 defines.push_back("__BIG_ENDIAN__");
288 }
289 }
290 break;
291
292 case flavourt::VISUAL_STUDIO:
293 defines.push_back("_M_PPC");
294 break;
295
296 case flavourt::CODEWARRIOR:
297 case flavourt::ARM:
298 case flavourt::ANSI:
299 break;
300
301 case flavourt::NONE:
303 }
304}
305
307{
308 arch_is_x86_family = false;
309 set_argument_evaluation_order();
310 if(subarch=="arm64")
311 {
312 set_LP64();
313 long_double_width=16*8;
314 }
315 else
316 {
317 set_ILP32();
318 long_double_width=8*8;
319 }
320
321 endianness=endiannesst::IS_LITTLE_ENDIAN;
322 char_is_unsigned=true;
323 NULL_is_zero=true;
324
325 switch(mode)
326 {
327 case flavourt::GCC:
328 case flavourt::CLANG:
329 if(subarch=="arm64")
330 defines.push_back("__aarch64__");
331 else
332 defines.push_back("__arm__");
333 if(subarch=="armhf")
334 defines.push_back("__ARM_PCS_VFP");
335 break;
336
337 case flavourt::VISUAL_STUDIO:
338 if(subarch == "arm64")
339 defines.push_back("_M_ARM64");
340 else
341 defines.push_back("_M_ARM");
342 break;
343
344 case flavourt::CODEWARRIOR:
345 case flavourt::ARM:
346 case flavourt::ANSI:
347 break;
348
349 case flavourt::NONE:
351 }
352}
353
355{
356 arch_is_x86_family = false;
357 set_argument_evaluation_order();
358 set_LP64();
359 endianness=endiannesst::IS_LITTLE_ENDIAN;
360 long_double_width=16*8;
361 char_is_unsigned=false;
362 NULL_is_zero=true;
363
364 switch(mode)
365 {
366 case flavourt::GCC:
367 defines.push_back("__alpha__");
368 break;
369
370 case flavourt::VISUAL_STUDIO:
371 defines.push_back("_M_ALPHA");
372 break;
373
374 case flavourt::CLANG:
375 case flavourt::CODEWARRIOR:
376 case flavourt::ARM:
377 case flavourt::ANSI:
378 break;
379
380 case flavourt::NONE:
382 }
383}
384
386{
387 arch_is_x86_family = false;
388 set_argument_evaluation_order();
389 if(subarch=="mipsel" ||
390 subarch=="mips" ||
391 subarch=="mipsn32el" ||
392 subarch=="mipsn32")
393 {
394 set_ILP32();
395 long_double_width=8*8;
396 }
397 else
398 {
399 set_LP64();
400 long_double_width=16*8;
401 }
402
403 if(subarch=="mipsel" ||
404 subarch=="mipsn32el" ||
405 subarch=="mips64el")
406 endianness=endiannesst::IS_LITTLE_ENDIAN;
407 else
408 endianness=endiannesst::IS_BIG_ENDIAN;
409
410 char_is_unsigned=false;
411 NULL_is_zero=true;
412
413 switch(mode)
414 {
415 case flavourt::GCC:
416 defines.push_back("__mips__");
417 defines.push_back("mips");
418 defines.push_back(
419 "_MIPS_SZPTR="+std::to_string(config.ansi_c.pointer_width));
420 break;
421
422 case flavourt::VISUAL_STUDIO:
423 UNREACHABLE; // not supported by Visual Studio
424 break;
425
426 case flavourt::CLANG:
427 case flavourt::CODEWARRIOR:
428 case flavourt::ARM:
429 case flavourt::ANSI:
430 break;
431
432 case flavourt::NONE:
434 }
435}
436
438{
439 arch_is_x86_family = false;
440 set_argument_evaluation_order();
441 set_LP64();
442 endianness = endiannesst::IS_LITTLE_ENDIAN;
443 long_double_width = 16 * 8;
444 char_is_unsigned = true;
445 NULL_is_zero = true;
446
447 switch(mode)
448 {
449 case flavourt::GCC:
450 defines.push_back("__riscv");
451 break;
452
453 case flavourt::VISUAL_STUDIO:
454 case flavourt::CLANG:
455 case flavourt::CODEWARRIOR:
456 case flavourt::ARM:
457 case flavourt::ANSI:
458 break;
459
460 case flavourt::NONE:
462 }
463}
464
466{
467 arch_is_x86_family = false;
468 set_argument_evaluation_order();
469 set_ILP32();
470 endianness=endiannesst::IS_BIG_ENDIAN;
471 long_double_width=16*8;
472 char_is_unsigned=true;
473 NULL_is_zero=true;
474
475 switch(mode)
476 {
477 case flavourt::GCC:
478 defines.push_back("__s390__");
479 break;
480
481 case flavourt::VISUAL_STUDIO:
482 UNREACHABLE; // not supported by Visual Studio
483 break;
484
485 case flavourt::CLANG:
486 case flavourt::CODEWARRIOR:
487 case flavourt::ARM:
488 case flavourt::ANSI:
489 break;
490
491 case flavourt::NONE:
493 }
494}
495
497{
498 arch_is_x86_family = false;
499 set_argument_evaluation_order();
500 set_LP64();
501 endianness=endiannesst::IS_BIG_ENDIAN;
502 char_is_unsigned=true;
503 NULL_is_zero=true;
504
505 switch(mode)
506 {
507 case flavourt::GCC:
508 defines.push_back("__s390x__");
509 break;
510
511 case flavourt::VISUAL_STUDIO:
512 UNREACHABLE; // not supported by Visual Studio
513 break;
514
515 case flavourt::CLANG:
516 case flavourt::CODEWARRIOR:
517 case flavourt::ARM:
518 case flavourt::ANSI:
519 break;
520
521 case flavourt::NONE:
523 }
524}
525
527{
528 arch_is_x86_family = false;
529 set_argument_evaluation_order();
530 if(subarch=="sparc64")
531 {
532 set_LP64();
533 long_double_width=16*8;
534 }
535 else
536 {
537 set_ILP32();
538 long_double_width=16*8;
539 }
540
541 endianness=endiannesst::IS_BIG_ENDIAN;
542 char_is_unsigned=false;
543 NULL_is_zero=true;
544
545 switch(mode)
546 {
547 case flavourt::GCC:
548 defines.push_back("__sparc__");
549 if(subarch=="sparc64")
550 defines.push_back("__arch64__");
551 break;
552
553 case flavourt::VISUAL_STUDIO:
554 UNREACHABLE; // not supported by Visual Studio
555 break;
556
557 case flavourt::CLANG:
558 case flavourt::CODEWARRIOR:
559 case flavourt::ARM:
560 case flavourt::ANSI:
561 break;
562
563 case flavourt::NONE:
565 }
566}
567
569{
570 arch_is_x86_family = false;
571 set_argument_evaluation_order();
572 set_LP64();
573 long_double_width=16*8;
574 endianness=endiannesst::IS_LITTLE_ENDIAN;
575 char_is_unsigned=false;
576 NULL_is_zero=true;
577
578 switch(mode)
579 {
580 case flavourt::GCC:
581 defines.push_back("__ia64__");
582 defines.push_back("_IA64");
583 defines.push_back("__IA64__");
584 break;
585
586 case flavourt::VISUAL_STUDIO:
587 defines.push_back("_M_IA64");
588 break;
589
590 case flavourt::CLANG:
591 case flavourt::CODEWARRIOR:
592 case flavourt::ARM:
593 case flavourt::ANSI:
594 break;
595
596 case flavourt::NONE:
598 }
599}
600
602{
603 arch_is_x86_family = true;
604 set_argument_evaluation_order();
605 // This is a variant of x86_64 that has
606 // 32-bit long int and 32-bit pointers.
607 set_ILP32();
608 long_double_width=16*8; // different from i386
609 endianness=endiannesst::IS_LITTLE_ENDIAN;
610 char_is_unsigned=false;
611 NULL_is_zero=true;
612
613 switch(mode)
614 {
615 case flavourt::GCC:
616 defines.push_back("__ILP32__");
617 defines.push_back("__x86_64");
618 defines.push_back("__x86_64__");
619 defines.push_back("__amd64__");
620 defines.push_back("__amd64");
621 break;
622
623 case flavourt::VISUAL_STUDIO:
624 UNREACHABLE; // not supported by Visual Studio
625 break;
626
627 case flavourt::CLANG:
628 case flavourt::CODEWARRIOR:
629 case flavourt::ARM:
630 case flavourt::ANSI:
631 break;
632
633 case flavourt::NONE:
635 }
636}
637
640{
641 arch_is_x86_family = false;
642 set_argument_evaluation_order();
643 // The Renesas V850 is a 32-bit microprocessor used in
644 // many automotive applications. This spec is written from the
645 // architecture manual rather than having access to a running
646 // system. Thus some assumptions have been made.
647
648 set_ILP32();
649
650 // Technically, the V850's don't have floating-point at all.
651 // However, the RH850, aimed at automotive has both 32-bit and
652 // 64-bit IEEE-754 float.
653 double_width=8*8;
654 long_double_width=8*8;
655 endianness=endiannesst::IS_LITTLE_ENDIAN;
656
657 // Without information about the compiler and RTOS, these are guesses
658 char_is_unsigned=false;
659 NULL_is_zero=true;
660
661 // No preprocessor definitions due to lack of information
662}
663
665{
666 arch_is_x86_family = false;
667 set_argument_evaluation_order();
668 set_ILP32();
669 long_double_width=8*8; // different from i386
670 endianness=endiannesst::IS_BIG_ENDIAN;
671 char_is_unsigned=false;
672 NULL_is_zero=true;
673
674 switch(mode)
675 {
676 case flavourt::GCC:
677 defines.push_back("__hppa__");
678 break;
679
680 case flavourt::VISUAL_STUDIO:
681 UNREACHABLE; // not supported by Visual Studio
682 break;
683
684 case flavourt::CLANG:
685 case flavourt::CODEWARRIOR:
686 case flavourt::ARM:
687 case flavourt::ANSI:
688 break;
689
690 case flavourt::NONE:
692 }
693}
694
696{
697 arch_is_x86_family = false;
698 set_argument_evaluation_order();
699 set_ILP32();
700 long_double_width=8*8; // different from i386
701 endianness=endiannesst::IS_LITTLE_ENDIAN;
702 char_is_unsigned=false;
703 NULL_is_zero=true;
704
705 switch(mode)
706 {
707 case flavourt::GCC:
708 defines.push_back("__sh__");
709 defines.push_back("__SH4__");
710 break;
711
712 case flavourt::VISUAL_STUDIO:
713 UNREACHABLE; // not supported by Visual Studio
714 break;
715
716 case flavourt::CLANG:
717 case flavourt::CODEWARRIOR:
718 case flavourt::ARM:
719 case flavourt::ANSI:
720 break;
721
722 case flavourt::NONE:
724 }
725}
726
728{
729 arch_is_x86_family = false;
730 set_argument_evaluation_order();
731 set_LP64();
732 endianness = endiannesst::IS_LITTLE_ENDIAN;
733 long_double_width = 16 * 8;
734 char_is_unsigned = false;
735 NULL_is_zero = true;
736
737 switch(mode)
738 {
739 case flavourt::GCC:
740 defines.push_back("__loongarch__");
741 break;
742
743 case flavourt::VISUAL_STUDIO:
744 UNREACHABLE; // not supported by Visual Studio
745 break;
746
747 case flavourt::CODEWARRIOR:
748 case flavourt::CLANG:
749 case flavourt::ARM:
750 case flavourt::ANSI:
751 break;
752
753 case flavourt::NONE:
755 }
756}
757
759{
760 arch_is_x86_family = false;
761 set_argument_evaluation_order();
762 set_ILP32();
763 endianness = endiannesst::IS_LITTLE_ENDIAN;
764 long_double_width = 16 * 8;
765 char_is_unsigned = false;
766 NULL_is_zero = true;
767
768 switch(mode)
769 {
770 case flavourt::CLANG:
771 defines.push_back("__EMSCRIPTEN__");
772 break;
773
774 case flavourt::VISUAL_STUDIO:
775 UNREACHABLE; // not supported by Visual Studio
776 break;
777
778 case flavourt::GCC:
779 case flavourt::CODEWARRIOR:
780 case flavourt::ARM:
781 case flavourt::ANSI:
782 break;
783
784 case flavourt::NONE:
786 }
787}
788
790{
791#if defined(__APPLE__)
792 // By default, clang on the Mac builds C code in GNU C11
793 return c_standardt::C11;
794#elif defined(__FreeBSD__) || defined(__OpenBSD__)
795 // By default, clang on FreeBSD builds C code in GNU C99
796 // By default, clang on OpenBSD builds C code in C99
797 return c_standardt::C99;
798#else
799 // By default, gcc 5.4 or higher use gnu11; older versions use gnu89
800 return c_standardt::C11;
801#endif
802}
803
805{
806 // g++ 6.3 uses gnu++14
807 // g++ 5.4 uses gnu++98
808 // clang 6.0 uses c++14
809 #if defined _WIN32
810 return cpp_standardt::CPP14;
811 #else
812 return cpp_standardt::CPP98;
813 #endif
814}
815
817{
818 ansi_c.arch=arch;
819
820 if(arch=="none")
821 {
822 // the architecture for people who can't commit
825 ansi_c.NULL_is_zero=false;
826 ansi_c.arch_is_x86_family = false;
827 ansi_c.set_argument_evaluation_order();
828
829 if(sizeof(long int)==8)
830 ansi_c.set_64();
831 else
832 ansi_c.set_32();
833 }
834 else if(arch=="alpha")
835 ansi_c.set_arch_spec_alpha();
836 else if(arch=="arm64" ||
837 arch=="armel" ||
838 arch=="armhf" ||
839 arch=="arm")
840 ansi_c.set_arch_spec_arm(arch);
841 else if(arch=="mips64el" ||
842 arch=="mipsn32el" ||
843 arch=="mipsel" ||
844 arch=="mips64" ||
845 arch=="mipsn32" ||
846 arch=="mips")
847 ansi_c.set_arch_spec_mips(arch);
848 else if(arch=="powerpc" ||
849 arch=="ppc64" ||
850 arch=="ppc64le")
851 ansi_c.set_arch_spec_power(arch);
852 else if(arch == "riscv64")
853 ansi_c.set_arch_spec_riscv64();
854 else if(arch=="sparc" ||
855 arch=="sparc64")
856 ansi_c.set_arch_spec_sparc(arch);
857 else if(arch=="ia64")
858 ansi_c.set_arch_spec_ia64();
859 else if(arch=="s390x")
860 ansi_c.set_arch_spec_s390x();
861 else if(arch=="s390")
862 ansi_c.set_arch_spec_s390();
863 else if(arch=="x32")
864 ansi_c.set_arch_spec_x32();
865 else if(arch=="v850")
866 ansi_c.set_arch_spec_v850();
867 else if(arch=="hppa")
868 ansi_c.set_arch_spec_hppa();
869 else if(arch=="sh4")
870 ansi_c.set_arch_spec_sh4();
871 else if(arch=="x86_64")
872 ansi_c.set_arch_spec_x86_64();
873 else if(arch=="i386")
874 ansi_c.set_arch_spec_i386();
875 else if(arch == "loongarch64")
876 ansi_c.set_arch_spec_loongarch64();
877 else if(arch == "emscripten")
878 ansi_c.set_arch_spec_emscripten();
879 else
880 {
881 // We run on something new and unknown.
882 // We verify for i386 instead.
883 ansi_c.set_arch_spec_i386();
884 ansi_c.arch="i386";
885 }
886}
887
896 const std::string &argument,
897 const std::size_t pointer_width)
898{
899 const auto throw_for_reason = [&](const std::string &reason) {
901 "Value of \"" + argument + "\" given for object-bits is " + reason +
902 ". object-bits must be positive and less than the pointer width (" +
903 std::to_string(pointer_width) + ") ",
904 "--object_bits");
905 };
906 const auto object_bits = string2optional<unsigned int>(argument);
907 if(!object_bits)
908 throw_for_reason("not a valid unsigned integer");
909 if(*object_bits == 0 || *object_bits >= pointer_width)
910 throw_for_reason("out of range");
911
913 bv_encoding.object_bits = *object_bits;
914 bv_encoding.is_object_bits_default = false;
915 return bv_encoding;
916}
917
918bool configt::set(const cmdlinet &cmdline)
919{
920 // defaults -- we match the architecture we have ourselves
921
922 cpp.cpp_standard=cppt::default_cpp_standard();
923
924 ansi_c.single_precision_constant=false;
925 ansi_c.allow_anonymous_struct_embedding = false;
926 ansi_c.for_has_scope=true; // C99 or later
927 ansi_c.ts_18661_3_Floatn_types=false;
928 ansi_c.__float128_is_keyword = false;
929 ansi_c.float16_type = false;
930 ansi_c.bf16_type = false;
931 ansi_c.fp16_type = false;
935 ansi_c.arch="none";
937 // NOLINTNEXTLINE(readability/casting)
938 ansi_c.NULL_is_zero=reinterpret_cast<size_t>(nullptr)==0;
939
940 // Default is ROUND_TO_EVEN, justified by C99:
941 // 1 At program startup the floating-point environment is initialized as
942 // prescribed by IEC 60559:
943 // - All floating-point exception status flags are cleared.
944 // - The rounding direction mode is rounding to nearest.
946
947 if(cmdline.isset("function"))
948 main=cmdline.get_value("function");
949
950 if(cmdline.isset('D'))
951 ansi_c.defines=cmdline.get_values('D');
952
953 if(cmdline.isset('I'))
954 ansi_c.include_paths=cmdline.get_values('I');
955
956 if(cmdline.isset("classpath"))
957 {
958 // Specifying -classpath or -cp overrides any setting of the
959 // CLASSPATH environment variable.
960 set_classpath(cmdline.get_value("classpath"));
961 }
962 else if(cmdline.isset("cp"))
963 {
964 // Specifying -classpath or -cp overrides any setting of the
965 // CLASSPATH environment variable.
966 set_classpath(cmdline.get_value("cp"));
967 }
968 else
969 {
970 // environment variable set?
971 const char *CLASSPATH=getenv("CLASSPATH");
972 if(CLASSPATH!=nullptr)
974 else
975 set_classpath("."); // default
976 }
977
978 if(cmdline.isset("main-class"))
979 java.main_class=cmdline.get_value("main-class");
980
981 if(cmdline.isset("include"))
982 ansi_c.include_files=cmdline.get_values("include");
983
984 // the default architecture is the one we run on
986 irep_idt arch=this_arch;
987
988 // let's pick an OS now
989 // the default is the one we run on
991 irep_idt os=this_os;
992
993 if(cmdline.isset("i386-linux"))
994 {
995 os="linux";
996 arch="i386";
997 }
998 else if(cmdline.isset("i386-win32") ||
999 cmdline.isset("win32"))
1000 {
1001 os="windows";
1002 arch="i386";
1003 }
1004 else if(cmdline.isset("winx64"))
1005 {
1006 os="windows";
1007 arch="x86_64";
1008 }
1009 else if(cmdline.isset("i386-macos"))
1010 {
1011 os="macos";
1012 arch="i386";
1013 }
1014 else if(cmdline.isset("ppc-macos"))
1015 {
1016 arch="powerpc";
1017 os="macos";
1018 }
1019
1020 if(cmdline.isset("arch"))
1021 {
1022 arch=cmdline.get_value("arch");
1023 }
1024
1025 if(cmdline.isset("os"))
1026 {
1027 os=cmdline.get_value("os");
1028 }
1029
1030 if(os=="windows")
1031 {
1032 // Cygwin uses GCC throughout, use i386-linux
1033 // MinGW needs --win32 --gcc
1036
1037 if(cmdline.isset("gcc"))
1038 {
1039 // There are gcc versions that target Windows (MinGW for example),
1040 // and we support that.
1043
1044 // enable Cygwin
1045 #ifdef _WIN32
1046 ansi_c.defines.push_back("__CYGWIN__");
1047 #endif
1048
1049 // MinGW has extra defines
1050 ansi_c.defines.push_back("__int64=long long");
1051 }
1052 else
1053 {
1054 // On Windows, our default is Visual Studio.
1055 // On FreeBSD, it's clang.
1056 // On anything else, it's GCC as the preprocessor,
1057 // but we recognize the Visual Studio language,
1058 // which is somewhat inconsistent.
1059 #ifdef _WIN32
1062#elif defined(__FreeBSD__) || defined(__OpenBSD__)
1065#else
1068#endif
1069
1070 cpp.cpp_standard = cppt::cpp_standardt::CPP14;
1071 }
1072 }
1073 else if(os=="macos")
1074 {
1079 // configure_gcc sets these with additional version-of-clang level of
1080 // detail, but the below are reasonable defaults for modern clang
1081 // installations
1082 ansi_c.__float128_is_keyword = true;
1083 ansi_c.float16_type = true;
1084 ansi_c.bf16_type = true;
1085 ansi_c.fp16_type = true;
1086 }
1087 else if(os == "linux" || os == "solaris" || os == "netbsd" || os == "hurd")
1088 {
1093 }
1094 else if(os == "freebsd" || os == "openbsd")
1095 {
1100 // configure_gcc sets these with additional version-of-clang level of
1101 // detail, but the below are reasonable defaults for modern clang
1102 // installations
1103 ansi_c.__float128_is_keyword = true;
1104 ansi_c.float16_type = true;
1105 ansi_c.bf16_type = true;
1106 ansi_c.fp16_type = true;
1107 }
1108 else
1109 {
1110 // give up, but use reasonable defaults
1115 }
1116
1117 if(ansi_c.preprocessor == ansi_ct::preprocessort::GCC)
1118 ansi_c.gcc__float128_type = true;
1119
1120 set_arch(arch);
1121
1122 if(os=="windows")
1123 {
1124 // note that sizeof(void *)==8, but sizeof(long)==4!
1125 if(arch=="x86_64")
1126 ansi_c.set_LLP64();
1127
1128 // On Windows, wchar_t is unsigned 16 bit, regardless
1129 // of the compiler used.
1130 ansi_c.wchar_t_width=2*8;
1131 ansi_c.wchar_t_is_unsigned=true;
1132
1133 // long double is the same as double in Visual Studio,
1134 // but it's 16 bytes with GCC with the 64-bit target.
1135 if(arch == "x86_64" && cmdline.isset("gcc"))
1136 ansi_c.long_double_width=16*8;
1137 else
1138 ansi_c.long_double_width=8*8;
1139 }
1140 else if(os == "macos" && arch == "arm64")
1141 {
1142 // https://developer.apple.com/documentation/xcode/
1143 // writing_arm64_code_for_apple_platforms#//apple_ref/doc/uid/TP40013702-SW1
1144 ansi_c.char_is_unsigned = false;
1145 ansi_c.long_double_width = 8 * 8;
1146 }
1147
1148 // Let's check some of the type widths in case we run
1149 // the same architecture and OS that we are verifying for.
1150 if(arch==this_arch && os==this_os)
1151 {
1152 INVARIANT(
1153 ansi_c.int_width == sizeof(int) * CHAR_BIT,
1154 "int width shall be equal to the system int width");
1155 INVARIANT(
1156 ansi_c.long_int_width == sizeof(long) * CHAR_BIT,
1157 "long int width shall be equal to the system long int width");
1158 INVARIANT(
1159 ansi_c.bool_width == sizeof(bool) * CHAR_BIT,
1160 "bool width shall be equal to the system bool width");
1161 INVARIANT(
1162 ansi_c.char_width == sizeof(char) * CHAR_BIT,
1163 "char width shall be equal to the system char width");
1164 INVARIANT(
1165 ansi_c.short_int_width == sizeof(short) * CHAR_BIT,
1166 "short int width shall be equal to the system short int width");
1167 INVARIANT(
1168 ansi_c.long_long_int_width == sizeof(long long) * CHAR_BIT,
1169 "long long int width shall be equal to the system long long int width");
1170 INVARIANT(
1171 ansi_c.pointer_width == sizeof(void *) * CHAR_BIT,
1172 "pointer width shall be equal to the system pointer width");
1173 INVARIANT(
1174 ansi_c.single_width == sizeof(float) * CHAR_BIT,
1175 "float width shall be equal to the system float width");
1176 INVARIANT(
1177 ansi_c.double_width == sizeof(double) * CHAR_BIT,
1178 "double width shall be equal to the system double width");
1179 INVARIANT(
1180 ansi_c.char_is_unsigned ==
1181 (static_cast<char>((1 << CHAR_BIT) - 1) == (1 << CHAR_BIT) - 1),
1182 "char_is_unsigned flag shall indicate system char unsignedness");
1183
1184#ifndef _WIN32
1185 // On Windows, long double width varies by compiler
1186 INVARIANT(
1187 ansi_c.long_double_width == sizeof(long double) * CHAR_BIT,
1188 "long double width shall be equal to the system long double width");
1189#endif
1190 }
1191
1192 // the following allows overriding the defaults
1193
1194 if(cmdline.isset("16"))
1195 ansi_c.set_16();
1196
1197 if(cmdline.isset("32"))
1198 ansi_c.set_32();
1199
1200 if(cmdline.isset("64"))
1201 ansi_c.set_64();
1202
1203 if(cmdline.isset("LP64"))
1204 ansi_c.set_LP64(); // int=32, long=64, pointer=64
1205
1206 if(cmdline.isset("ILP64"))
1207 ansi_c.set_ILP64(); // int=64, long=64, pointer=64
1208
1209 if(cmdline.isset("LLP64"))
1210 ansi_c.set_LLP64(); // int=32, long=32, pointer=64
1211
1212 if(cmdline.isset("ILP32"))
1213 ansi_c.set_ILP32(); // int=32, long=32, pointer=32
1214
1215 if(cmdline.isset("LP32"))
1216 ansi_c.set_LP32(); // int=16, long=32, pointer=32
1217
1218 if(cmdline.isset("string-abstraction"))
1219 ansi_c.string_abstraction=true;
1220 else
1221 ansi_c.string_abstraction=false;
1222
1223 if(cmdline.isset("dfcc-debug-lib"))
1224 ansi_c.dfcc_debug_lib = true;
1225 else
1226 ansi_c.dfcc_debug_lib = false;
1227
1228 if(cmdline.isset("dfcc-simple-invalid-pointer-model"))
1229 ansi_c.simple_invalid_pointer_model = true;
1230 else
1231 ansi_c.simple_invalid_pointer_model = false;
1232
1233 if(cmdline.isset("no-library"))
1235
1236 if(cmdline.isset("little-endian"))
1238
1239 if(cmdline.isset("big-endian"))
1241
1242 if(cmdline.isset("little-endian") &&
1243 cmdline.isset("big-endian"))
1244 return true;
1245
1246 if(cmdline.isset("unsigned-char"))
1247 ansi_c.char_is_unsigned=true;
1248
1249 if(cmdline.isset("round-to-even") ||
1250 cmdline.isset("round-to-nearest"))
1251 ansi_c.rounding_mode=ieee_floatt::ROUND_TO_EVEN;
1252
1253 if(cmdline.isset("round-to-plus-inf"))
1255
1256 if(cmdline.isset("round-to-minus-inf"))
1258
1259 if(cmdline.isset("round-to-zero"))
1260 ansi_c.rounding_mode=ieee_floatt::ROUND_TO_ZERO;
1261
1262 if(cmdline.isset("object-bits"))
1263 {
1265 cmdline.get_value("object-bits"), ansi_c.pointer_width);
1266 }
1267
1268 if(cmdline.isset("malloc-fail-assert") && cmdline.isset("malloc-fail-null"))
1269 {
1271 "at most one malloc failure mode is acceptable", "--malloc-fail-null"};
1272 }
1273 if(cmdline.isset("malloc-fail-null"))
1274 ansi_c.malloc_failure_mode = ansi_c.malloc_failure_mode_return_null;
1275 if(cmdline.isset("malloc-fail-assert"))
1276 ansi_c.malloc_failure_mode = ansi_c.malloc_failure_mode_assert_then_assume;
1277
1278 if(cmdline.isset("malloc-may-fail"))
1279 {
1280 ansi_c.malloc_may_fail = true;
1281 }
1282 if(cmdline.isset("no-malloc-may-fail"))
1283 {
1284 ansi_c.malloc_may_fail = false;
1285 ansi_c.malloc_failure_mode = ansi_ct::malloc_failure_mode_none;
1286 }
1287
1288 if(cmdline.isset("c89"))
1289 ansi_c.set_c89();
1290
1291 if(cmdline.isset("c99"))
1292 ansi_c.set_c99();
1293
1294 if(cmdline.isset("c11"))
1295 ansi_c.set_c11();
1296
1297 if(cmdline.isset("c17"))
1298 ansi_c.set_c17();
1299
1300 if(cmdline.isset("c23"))
1301 ansi_c.set_c23();
1302
1303 if(cmdline.isset("cpp98"))
1304 cpp.set_cpp98();
1305
1306 if(cmdline.isset("cpp03"))
1307 cpp.set_cpp03();
1308
1309 if(cmdline.isset("cpp11"))
1310 cpp.set_cpp11();
1311
1312 // set the upper bound for argc
1313 if(os == "windows")
1314 {
1315 // On Windows, CreateProcess accepts no more than 32767 characters, so make
1316 // that a hard limit.
1317 ansi_c.max_argc = mp_integer{32767};
1318 }
1319 else
1320 {
1321 // For other systems assume argc is no larger than the what would make argv
1322 // the largest representable array (when using signed integers to represent
1323 // array sizes):
1324 // 2^(pointer_width - 1) / (pointer_width / char_width) is the maximum
1325 // number of argv elements sysconf(ARG_MAX) is likely much lower than this,
1326 // but we don't know that value for the verification target platform.
1327 const auto pointer_bits_2log =
1328 address_bits(ansi_c.pointer_width / ansi_c.char_width);
1329 if(ansi_c.pointer_width - pointer_bits_2log - 1 <= ansi_c.int_width)
1330 {
1331 ansi_c.max_argc =
1332 power(2, config.ansi_c.int_width - pointer_bits_2log - 1);
1333 }
1334 // otherwise we leave argc unconstrained
1335 }
1336
1337 return false;
1338}
1339
1341{
1342 // clang-format off
1343 switch(os)
1344 {
1345 case ost::OS_LINUX: return "linux";
1346 case ost::OS_MACOS: return "macos";
1347 case ost::OS_WIN: return "win";
1348 case ost::NO_OS: return "none";
1349 }
1350 // clang-format on
1351
1353}
1354
1356{
1357 if(os=="linux")
1358 return ost::OS_LINUX;
1359 else if(os=="macos")
1360 return ost::OS_MACOS;
1361 else if(os=="win")
1362 return ost::OS_WIN;
1363 else
1364 return ost::NO_OS;
1365}
1366
1368 const namespacet &ns,
1369 const std::string &what)
1370{
1371 const irep_idt id=CPROVER_PREFIX "architecture_"+what;
1372 const symbolt *symbol;
1373
1374 const bool not_found = ns.lookup(id, symbol);
1375 INVARIANT(!not_found, id2string(id) + " must be in namespace");
1376
1377 const exprt &tmp=symbol->value;
1378
1379 INVARIANT(
1380 tmp.id() == ID_address_of &&
1381 to_address_of_expr(tmp).object().id() == ID_index &&
1382 to_index_expr(to_address_of_expr(tmp).object()).array().id() ==
1384 "symbol table configuration entry '" + id2string(id) +
1385 "' must be a string constant");
1386
1387 return to_index_expr(to_address_of_expr(tmp).object()).array().get(ID_value);
1388}
1389
1390static unsigned unsigned_from_ns(
1391 const namespacet &ns,
1392 const std::string &what)
1393{
1394 const irep_idt id=CPROVER_PREFIX "architecture_"+what;
1395 const symbolt *symbol;
1396
1397 const bool not_found = ns.lookup(id, symbol);
1398 INVARIANT(!not_found, id2string(id) + " must be in namespace");
1399
1400 exprt tmp=symbol->value;
1401 simplify(tmp, ns);
1402
1403 INVARIANT(
1404 tmp.is_constant(),
1405 "symbol table configuration entry '" + id2string(id) +
1406 "' must be a constant");
1407
1409
1410 const bool error = to_integer(to_constant_expr(tmp), int_value);
1411 INVARIANT(
1412 !error,
1413 "symbol table configuration entry '" + id2string(id) +
1414 "' must be convertible to mp_integer");
1415
1417}
1418
1420{
1421 // maybe not compiled from C/C++
1422 if(symbol_table.symbols.find(CPROVER_PREFIX "architecture_" "int_width")==
1423 symbol_table.symbols.end())
1424 return;
1425
1426 namespacet ns(symbol_table);
1427
1428 // clear defines
1429 ansi_c.defines.clear();
1430
1431 // first set architecture to get some defaults
1432 if(symbol_table.symbols.find(CPROVER_PREFIX "architecture_" "arch")==
1433 symbol_table.symbols.end())
1435 else
1436 set_arch(string_from_ns(ns, "arch"));
1437
1438 ansi_c.int_width=unsigned_from_ns(ns, "int_width");
1439 ansi_c.long_int_width=unsigned_from_ns(ns, "long_int_width");
1440 ansi_c.bool_width=1*8;
1441 ansi_c.char_width=unsigned_from_ns(ns, "char_width");
1442 ansi_c.short_int_width=unsigned_from_ns(ns, "short_int_width");
1443 ansi_c.long_long_int_width=unsigned_from_ns(ns, "long_long_int_width");
1444 ansi_c.pointer_width=unsigned_from_ns(ns, "pointer_width");
1445 ansi_c.single_width=unsigned_from_ns(ns, "single_width");
1446 ansi_c.double_width=unsigned_from_ns(ns, "double_width");
1447 ansi_c.long_double_width=unsigned_from_ns(ns, "long_double_width");
1448 ansi_c.wchar_t_width=unsigned_from_ns(ns, "wchar_t_width");
1449
1450 ansi_c.char_is_unsigned=unsigned_from_ns(ns, "char_is_unsigned")!=0;
1451 ansi_c.wchar_t_is_unsigned=unsigned_from_ns(ns, "wchar_t_is_unsigned")!=0;
1452 // for_has_scope, single_precision_constant, rounding_mode,
1453 // ts_18661_3_Floatn_types, __float128_is_keyword, float16_type, bf16_type,
1454 // fp16_type are not architectural features, and thus not stored in namespace
1455
1456 ansi_c.alignment=unsigned_from_ns(ns, "alignment");
1457
1458 ansi_c.memory_operand_size=unsigned_from_ns(ns, "memory_operand_size");
1459
1460 ansi_c.endianness=(ansi_ct::endiannesst)unsigned_from_ns(ns, "endianness");
1461
1462 if(symbol_table.symbols.find(CPROVER_PREFIX "architecture_" "os")==
1463 symbol_table.symbols.end())
1465 else
1467
1468 ansi_c.NULL_is_zero = unsigned_from_ns(ns, "NULL_is_zero") != 0;
1469
1470 // goto binaries created before this architecture parameter was introduced
1471 // may lack the symbol; keep the default set via set_arch above in that
1472 // case. Note that this fallback depends on the loading tool's compiler
1473 // flavour (`mode` is not stored in goto binaries), so, e.g., an old
1474 // Clang-produced x86-family binary loaded with GCC defaults is modelled
1475 // as right-to-left.
1476 if(
1477 symbol_table.symbols.find(CPROVER_PREFIX "architecture_"
1478 "argument_evaluation_order") !=
1479 symbol_table.symbols.end())
1480 {
1481 ansi_c.argument_evaluation_order =
1483 unsigned_from_ns(ns, "argument_evaluation_order"));
1484 }
1485
1486 // mode, preprocessor (and all preprocessor command line options),
1487 // lib, string_abstraction not stored in namespace
1488
1490}
1491
1495 const symbol_table_baset &symbol_table)
1496{
1497 // has been overridden by command line option,
1498 // thus do not apply language defaults
1499 if(!bv_encoding.is_object_bits_default)
1500 return;
1501
1502 // set object_bits according to entry point language
1503 if(const auto maybe_symbol=symbol_table.lookup(CPROVER_PREFIX "_start"))
1504 {
1506
1507 if(entry_point_symbol.mode==ID_java)
1508 bv_encoding.object_bits=java.default_object_bits;
1509 else if(entry_point_symbol.mode==ID_C)
1510 bv_encoding.object_bits=ansi_c.default_object_bits;
1511 else if(entry_point_symbol.mode==ID_cpp)
1512 bv_encoding.object_bits=cpp.default_object_bits;
1514 0<bv_encoding.object_bits && bv_encoding.object_bits<ansi_c.pointer_width,
1515 "object_bits should fit into pointer width");
1516 }
1517}
1518
1520{
1521 return "Running with "+std::to_string(bv_encoding.object_bits)+
1522 " object bits, "+
1523 std::to_string(ansi_c.pointer_width-bv_encoding.object_bits)+
1524 " offset bits ("+
1525 (bv_encoding.is_object_bits_default ? "default" : "user-specified")+
1526 ")";
1527}
1528
1529// clang-format off
1531{
1533
1534 // following http://wiki.debian.org/ArchitectureSpecificsMemo
1535
1536 #ifdef __alpha__
1537 this_arch = "alpha";
1538 #elif defined(__armel__)
1539 this_arch = "armel";
1540 #elif defined(__aarch64__)
1541 this_arch = "arm64";
1542 #elif defined(__arm__)
1543 #ifdef __ARM_PCS_VFP
1544 this_arch = "armhf"; // variant of arm with hard float
1545 #else
1546 this_arch = "arm";
1547 #endif
1548 #elif defined(_MIPSEL)
1549 #if _MIPS_SIM==_ABIO32
1550 this_arch = "mipsel";
1551 #elif _MIPS_SIM==_ABIN32
1552 this_arch = "mipsn32el";
1553 #else
1554 this_arch = "mips64el";
1555 #endif
1556 #elif defined(__mips__)
1557 #if _MIPS_SIM==_ABIO32
1558 this_arch = "mips";
1559 #elif _MIPS_SIM==_ABIN32
1560 this_arch = "mipsn32";
1561 #else
1562 this_arch = "mips64";
1563 #endif
1564 #elif defined(__powerpc__)
1565 #if defined(__ppc64__) || defined(__PPC64__) || \
1566 defined(__powerpc64__) || defined(__POWERPC64__)
1567 #ifdef __LITTLE_ENDIAN__
1568 this_arch = "ppc64le";
1569 #else
1570 this_arch = "ppc64";
1571 #endif
1572 #else
1573 this_arch = "powerpc";
1574 #endif
1575 #elif defined(__riscv)
1576 this_arch = "riscv64";
1577 #elif defined(__sparc__)
1578 #ifdef __arch64__
1579 this_arch = "sparc64";
1580 #else
1581 this_arch = "sparc";
1582 #endif
1583 #elif defined(__ia64__)
1584 this_arch = "ia64";
1585 #elif defined(__s390x__)
1586 this_arch = "s390x";
1587 #elif defined(__s390__)
1588 this_arch = "s390";
1589 #elif defined(__x86_64__)
1590 #ifdef __ILP32__
1591 this_arch = "x32"; // variant of x86_64 with 32-bit pointers
1592 #else
1593 this_arch = "x86_64";
1594 #endif
1595 #elif defined(__i386__)
1596 this_arch = "i386";
1597 #elif defined(_WIN64)
1598 this_arch = "x86_64";
1599 #elif defined(_WIN32)
1600 this_arch = "i386";
1601 #elif defined(__hppa__)
1602 this_arch = "hppa";
1603 #elif defined(__sh__)
1604 this_arch = "sh4";
1605 #elif defined(__loongarch__)
1606 this_arch = "loongarch64";
1607 #elif defined(__EMSCRIPTEN__)
1608 this_arch = "emscripten";
1609 #else
1610 // something new and unknown!
1611 this_arch = "unknown";
1612 #endif
1613
1614 return this_arch;
1615}
1616// clang-format on
1617
1618void configt::set_classpath(const std::string &cp)
1619{
1620// These are separated by colons on Unix, and semicolons on
1621// Windows.
1622#ifdef _WIN32
1623 const char cp_separator = ';';
1624#else
1625 const char cp_separator = ':';
1626#endif
1627
1628 std::vector<std::string> class_path =
1630 java.classpath.insert(
1631 java.classpath.end(), class_path.begin(), class_path.end());
1632}
1633
1635{
1637
1638 #ifdef _WIN32
1639 this_os="windows";
1640 #elif __APPLE__
1641 this_os="macos";
1642 #elif __FreeBSD__
1643 this_os="freebsd";
1644#elif __OpenBSD__
1645 this_os = "openbsd";
1646#elif __NetBSD__
1647 this_os = "netbsd";
1648#elif __linux__
1649 this_os="linux";
1650#elif __SVR4
1651 this_os="solaris";
1652#elif __gnu_hurd__
1653 this_os = "hurd";
1654#elif __EMSCRIPTEN__
1655 this_os = "emscripten";
1656#else
1657 this_os="unknown";
1658#endif
1659
1660 return this_os;
1661}
1662
1676{
1677 PRECONDITION(ansi_c.pointer_width >= 1);
1678 PRECONDITION(bv_encoding.object_bits < ansi_c.pointer_width);
1679 PRECONDITION(bv_encoding.object_bits >= 1);
1680 const auto offset_bits = ansi_c.pointer_width - bv_encoding.object_bits;
1681 // We require the offset to be able to express upto allocation_size - 1,
1682 // but also down to -allocation_size, therefore the size is allowable
1683 // is number of bits, less the signed bit.
1684 const auto bits_for_positive_offset = offset_bits - 1;
1686}
std::size_t address_bits(const mp_integer &size)
ceil(log2(size))
bool to_integer(const constant_exprt &expr, mp_integer &int_value)
Convert a constant expression expr to an arbitrary-precision integer.
mp_integer power(const mp_integer &base, const mp_integer &exponent)
A multi-precision implementation of the power operator.
virtual void clear()
Reset the abstract state.
Definition ai.h:269
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:566
std::string get_value(char option) const
Definition cmdline.cpp:48
virtual bool isset(char option) const
Definition cmdline.cpp:30
const std::list< std::string > & get_values(const std::string &option) const
Definition cmdline.cpp:135
Globally accessible architectural configuration.
Definition config.h:144
void set_object_bits_from_symbol_table(const symbol_table_baset &)
Sets the number of bits used for object addresses.
Definition config.cpp:1494
void set_arch(const irep_idt &)
Definition config.cpp:816
struct configt::bv_encodingt bv_encoding
bool set(const cmdlinet &cmdline)
Definition config.cpp:918
std::string object_bits_info()
Definition config.cpp:1519
void set_classpath(const std::string &cp)
Definition config.cpp:1618
mp_integer max_malloc_size() const
The maximum allocation size is determined by the number of bits that are left in the pointer of width...
Definition config.cpp:1675
void set_from_symbol_table(const symbol_table_baset &)
Definition config.cpp:1419
static irep_idt this_architecture()
Definition config.cpp:1530
std::optional< std::string > main
Definition config.h:417
struct configt::javat java
struct configt::cppt cpp
static irep_idt this_operating_system()
Definition config.cpp:1634
struct configt::ansi_ct ansi_c
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
Base class for all expressions.
Definition expr.h:57
Thrown when users pass incorrect command line arguments, for example passing no files to analysis or ...
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
The symbol table base class interface.
const symbolt * lookup(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
Symbol table entry.
Definition symbol.h:28
exprt value
Initial value of symbol.
Definition symbol.h:34
configt::bv_encodingt parse_object_bits_encoding(const std::string &argument, const std::size_t pointer_width)
Parses the object_bits argument from the command line arguments.
Definition config.cpp:895
static unsigned unsigned_from_ns(const namespacet &ns, const std::string &what)
Definition config.cpp:1390
configt config
Definition config.cpp:25
static irep_idt string_from_ns(const namespacet &ns, const std::string &what)
Definition config.cpp:1367
configt config
Definition config.cpp:25
#define CPROVER_PREFIX
const std::string & id2string(const irep_idt &d)
Definition irep.h:44
mp_integer alignment(const typet &type, const namespacet &ns)
Definition padding.cpp:23
API to expression classes for Pointers.
const address_of_exprt & to_address_of_expr(const exprt &expr)
Cast an exprt to an address_of_exprt.
bool simplify(exprt &expr, const namespacet &ns)
BigInt mp_integer
Definition smt_terms.h:17
#define UNREACHABLE
This should be used to mark dead code.
Definition invariant.h:525
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
Definition invariant.h:534
#define PRECONDITION(CONDITION)
Definition invariant.h:463
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
Definition invariant.h:423
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
Definition std_expr.h:1494
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
Definition std_expr.h:3078
char * getenv(const char *name)
Definition stdlib.c:496
void split_string(std::string_view s, char delim, std::vector< std::string > &result, bool strip, bool remove_empty)
void set_arch_spec_x32()
Definition config.cpp:601
void set_arch_spec_riscv64()
Definition config.cpp:437
void set_arch_spec_sh4()
Definition config.cpp:695
void set_arch_spec_loongarch64()
Definition config.cpp:727
void set_ILP32()
int=32, long=32, pointer=32
Definition config.cpp:111
void set_arch_spec_v850()
Sets up the widths of variables for the Renesas V850.
Definition config.cpp:639
void set_arch_spec_hppa()
Definition config.cpp:664
static std::string os_to_string(ost)
Definition config.cpp:1340
void set_ILP64()
int=64, long=64, pointer=64
Definition config.cpp:71
void set_arch_spec_sparc(const irep_idt &subarch)
Definition config.cpp:526
static ost string_to_os(const std::string &)
Definition config.cpp:1355
void set_argument_evaluation_order()
Sets the architectural parameter recording the order in which compilers evaluate the arguments of a f...
Definition config.cpp:157
void set_LLP64()
int=32, long=32, pointer=64
Definition config.cpp:91
void set_arch_spec_arm(const irep_idt &subarch)
Definition config.cpp:306
@ malloc_failure_mode_none
Definition config.h:344
static c_standardt default_c_standard()
Definition config.cpp:789
void set_arch_spec_alpha()
Definition config.cpp:354
void set_arch_spec_power(const irep_idt &subarch)
Definition config.cpp:243
void set_arch_spec_s390()
Definition config.cpp:465
void set_LP64()
int=32, long=64, pointer=64
Definition config.cpp:47
void set_arch_spec_x86_64()
Definition config.cpp:203
void set_LP32()
int=16, long=32, pointer=32
Definition config.cpp:131
void set_arch_spec_s390x()
Definition config.cpp:496
void set_arch_spec_mips(const irep_idt &subarch)
Definition config.cpp:385
void set_arch_spec_i386()
Definition config.cpp:169
void set_arch_spec_ia64()
Definition config.cpp:568
void set_arch_spec_emscripten()
Definition config.cpp:758
static cpp_standardt default_cpp_standard()
Definition config.cpp:804
Author: Diffblue Ltd.