CBMC: /home/runner/work/cbmc/cbmc/src/util/config.cpp Source File

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
25 configt config;
26
28{
29 set_LP32();
30}
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
151{
152 set_ILP32();
153 endianness=endiannesst::IS_LITTLE_ENDIAN;
154 char_is_unsigned=false;
155 NULL_is_zero=true;
156
157 switch(mode)
158 {
159 case flavourt::GCC:
160 case flavourt::CLANG:
161 defines.push_back("i386");
162 defines.push_back("__i386");
163 defines.push_back("__i386__");
164 if(mode == flavourt::CLANG)
165 defines.push_back("__LITTLE_ENDIAN__");
166 break;
167
168 case flavourt::VISUAL_STUDIO:
169 defines.push_back("_M_IX86");
170 break;
171
172 case flavourt::CODEWARRIOR:
173 case flavourt::ARM:
174 case flavourt::ANSI:
175 break;
176
177 case flavourt::NONE:
179 }
180}
181
183{
184 set_LP64();
185 endianness=endiannesst::IS_LITTLE_ENDIAN;
186 long_double_width=16*8;
187 char_is_unsigned=false;
188 NULL_is_zero=true;
189
190 switch(mode)
191 {
192 case flavourt::GCC:
193 case flavourt::CLANG:
194 defines.push_back("__LP64__");
195 defines.push_back("__x86_64");
196 defines.push_back("__x86_64__");
197 defines.push_back("_LP64");
198 defines.push_back("__amd64__");
199 defines.push_back("__amd64");
200
201 if(os == ost::OS_MACOS)
202 defines.push_back("__LITTLE_ENDIAN__");
203 break;
204
205 case flavourt::VISUAL_STUDIO:
206 defines.push_back("_M_X64");
207 defines.push_back("_M_AMD64");
208 break;
209
210 case flavourt::CODEWARRIOR:
211 case flavourt::ARM:
212 case flavourt::ANSI:
213 break;
214
215 case flavourt::NONE:
217 }
218}
219
221{
222 if(subarch=="powerpc")
223 set_ILP32();
224 else // ppc64 or ppc64le
225 set_LP64();
226
227 if(subarch=="ppc64le")
228 endianness=endiannesst::IS_LITTLE_ENDIAN;
229 else
230 endianness=endiannesst::IS_BIG_ENDIAN;
231
232 long_double_width=16*8;
233 char_is_unsigned=true;
234 NULL_is_zero=true;
235
236 switch(mode)
237 {
238 case flavourt::GCC:
239 case flavourt::CLANG:
240 defines.push_back("__powerpc");
241 defines.push_back("__powerpc__");
242 defines.push_back("__POWERPC__");
243 defines.push_back("__ppc__");
244
245 if(os == ost::OS_MACOS)
246 defines.push_back("__BIG_ENDIAN__");
247
248 if(subarch!="powerpc")
249 {
250 defines.push_back("__powerpc64");
251 defines.push_back("__powerpc64__");
252 defines.push_back("__PPC64__");
253 defines.push_back("__ppc64__");
254 if(subarch=="ppc64le")
255 {
256 defines.push_back("_CALL_ELF=2");
257 defines.push_back("__LITTLE_ENDIAN__");
258 }
259 else
260 {
261 defines.push_back("_CALL_ELF=1");
262 defines.push_back("__BIG_ENDIAN__");
263 }
264 }
265 break;
266
267 case flavourt::VISUAL_STUDIO:
268 defines.push_back("_M_PPC");
269 break;
270
271 case flavourt::CODEWARRIOR:
272 case flavourt::ARM:
273 case flavourt::ANSI:
274 break;
275
276 case flavourt::NONE:
278 }
279}
280
282{
283 if(subarch=="arm64")
284 {
285 set_LP64();
286 long_double_width=16*8;
287 }
288 else
289 {
290 set_ILP32();
291 long_double_width=8*8;
292 }
293
294 endianness=endiannesst::IS_LITTLE_ENDIAN;
295 char_is_unsigned=true;
296 NULL_is_zero=true;
297
298 switch(mode)
299 {
300 case flavourt::GCC:
301 case flavourt::CLANG:
302 if(subarch=="arm64")
303 defines.push_back("__aarch64__");
304 else
305 defines.push_back("__arm__");
306 if(subarch=="armhf")
307 defines.push_back("__ARM_PCS_VFP");
308 break;
309
310 case flavourt::VISUAL_STUDIO:
311 if(subarch == "arm64")
312 defines.push_back("_M_ARM64");
313 else
314 defines.push_back("_M_ARM");
315 break;
316
317 case flavourt::CODEWARRIOR:
318 case flavourt::ARM:
319 case flavourt::ANSI:
320 break;
321
322 case flavourt::NONE:
324 }
325}
326
328{
329 set_LP64();
330 endianness=endiannesst::IS_LITTLE_ENDIAN;
331 long_double_width=16*8;
332 char_is_unsigned=false;
333 NULL_is_zero=true;
334
335 switch(mode)
336 {
337 case flavourt::GCC:
338 defines.push_back("__alpha__");
339 break;
340
341 case flavourt::VISUAL_STUDIO:
342 defines.push_back("_M_ALPHA");
343 break;
344
345 case flavourt::CLANG:
346 case flavourt::CODEWARRIOR:
347 case flavourt::ARM:
348 case flavourt::ANSI:
349 break;
350
351 case flavourt::NONE:
353 }
354}
355
357{
358 if(subarch=="mipsel" ||
359 subarch=="mips" ||
360 subarch=="mipsn32el" ||
361 subarch=="mipsn32")
362 {
363 set_ILP32();
364 long_double_width=8*8;
365 }
366 else
367 {
368 set_LP64();
369 long_double_width=16*8;
370 }
371
372 if(subarch=="mipsel" ||
373 subarch=="mipsn32el" ||
374 subarch=="mips64el")
375 endianness=endiannesst::IS_LITTLE_ENDIAN;
376 else
377 endianness=endiannesst::IS_BIG_ENDIAN;
378
379 char_is_unsigned=false;
380 NULL_is_zero=true;
381
382 switch(mode)
383 {
384 case flavourt::GCC:
385 defines.push_back("__mips__");
386 defines.push_back("mips");
387 defines.push_back(
388 "_MIPS_SZPTR="+std::to_string(config.ansi_c.pointer_width));
389 break;
390
391 case flavourt::VISUAL_STUDIO:
392 UNREACHABLE; // not supported by Visual Studio
393 break;
394
395 case flavourt::CLANG:
396 case flavourt::CODEWARRIOR:
397 case flavourt::ARM:
398 case flavourt::ANSI:
399 break;
400
401 case flavourt::NONE:
403 }
404}
405
407{
408 set_LP64();
409 endianness = endiannesst::IS_LITTLE_ENDIAN;
410 long_double_width = 16 * 8;
411 char_is_unsigned = true;
412 NULL_is_zero = true;
413
414 switch(mode)
415 {
416 case flavourt::GCC:
417 defines.push_back("__riscv");
418 break;
419
420 case flavourt::VISUAL_STUDIO:
421 case flavourt::CLANG:
422 case flavourt::CODEWARRIOR:
423 case flavourt::ARM:
424 case flavourt::ANSI:
425 break;
426
427 case flavourt::NONE:
429 }
430}
431
433{
434 set_ILP32();
435 endianness=endiannesst::IS_BIG_ENDIAN;
436 long_double_width=16*8;
437 char_is_unsigned=true;
438 NULL_is_zero=true;
439
440 switch(mode)
441 {
442 case flavourt::GCC:
443 defines.push_back("__s390__");
444 break;
445
446 case flavourt::VISUAL_STUDIO:
447 UNREACHABLE; // not supported by Visual Studio
448 break;
449
450 case flavourt::CLANG:
451 case flavourt::CODEWARRIOR:
452 case flavourt::ARM:
453 case flavourt::ANSI:
454 break;
455
456 case flavourt::NONE:
458 }
459}
460
462{
463 set_LP64();
464 endianness=endiannesst::IS_BIG_ENDIAN;
465 char_is_unsigned=true;
466 NULL_is_zero=true;
467
468 switch(mode)
469 {
470 case flavourt::GCC:
471 defines.push_back("__s390x__");
472 break;
473
474 case flavourt::VISUAL_STUDIO:
475 UNREACHABLE; // not supported by Visual Studio
476 break;
477
478 case flavourt::CLANG:
479 case flavourt::CODEWARRIOR:
480 case flavourt::ARM:
481 case flavourt::ANSI:
482 break;
483
484 case flavourt::NONE:
486 }
487}
488
490{
491 if(subarch=="sparc64")
492 {
493 set_LP64();
494 long_double_width=16*8;
495 }
496 else
497 {
498 set_ILP32();
499 long_double_width=16*8;
500 }
501
502 endianness=endiannesst::IS_BIG_ENDIAN;
503 char_is_unsigned=false;
504 NULL_is_zero=true;
505
506 switch(mode)
507 {
508 case flavourt::GCC:
509 defines.push_back("__sparc__");
510 if(subarch=="sparc64")
511 defines.push_back("__arch64__");
512 break;
513
514 case flavourt::VISUAL_STUDIO:
515 UNREACHABLE; // not supported by Visual Studio
516 break;
517
518 case flavourt::CLANG:
519 case flavourt::CODEWARRIOR:
520 case flavourt::ARM:
521 case flavourt::ANSI:
522 break;
523
524 case flavourt::NONE:
526 }
527}
528
530{
531 set_LP64();
532 long_double_width=16*8;
533 endianness=endiannesst::IS_LITTLE_ENDIAN;
534 char_is_unsigned=false;
535 NULL_is_zero=true;
536
537 switch(mode)
538 {
539 case flavourt::GCC:
540 defines.push_back("__ia64__");
541 defines.push_back("_IA64");
542 defines.push_back("__IA64__");
543 break;
544
545 case flavourt::VISUAL_STUDIO:
546 defines.push_back("_M_IA64");
547 break;
548
549 case flavourt::CLANG:
550 case flavourt::CODEWARRIOR:
551 case flavourt::ARM:
552 case flavourt::ANSI:
553 break;
554
555 case flavourt::NONE:
557 }
558}
559
561{
562 // This is a variant of x86_64 that has
563 // 32-bit long int and 32-bit pointers.
564 set_ILP32();
565 long_double_width=16*8; // different from i386
566 endianness=endiannesst::IS_LITTLE_ENDIAN;
567 char_is_unsigned=false;
568 NULL_is_zero=true;
569
570 switch(mode)
571 {
572 case flavourt::GCC:
573 defines.push_back("__ILP32__");
574 defines.push_back("__x86_64");
575 defines.push_back("__x86_64__");
576 defines.push_back("__amd64__");
577 defines.push_back("__amd64");
578 break;
579
580 case flavourt::VISUAL_STUDIO:
581 UNREACHABLE; // not supported by Visual Studio
582 break;
583
584 case flavourt::CLANG:
585 case flavourt::CODEWARRIOR:
586 case flavourt::ARM:
587 case flavourt::ANSI:
588 break;
589
590 case flavourt::NONE:
592 }
593}
594
597{
598 // The Renesas V850 is a 32-bit microprocessor used in
599 // many automotive applications. This spec is written from the
600 // architecture manual rather than having access to a running
601 // system. Thus some assumptions have been made.
602
603 set_ILP32();
604
605 // Technically, the V850's don't have floating-point at all.
606 // However, the RH850, aimed at automotive has both 32-bit and
607 // 64-bit IEEE-754 float.
608 double_width=8*8;
609 long_double_width=8*8;
610 endianness=endiannesst::IS_LITTLE_ENDIAN;
611
612 // Without information about the compiler and RTOS, these are guesses
613 char_is_unsigned=false;
614 NULL_is_zero=true;
615
616 // No preprocessor definitions due to lack of information
617}
618
620{
621 set_ILP32();
622 long_double_width=8*8; // different from i386
623 endianness=endiannesst::IS_BIG_ENDIAN;
624 char_is_unsigned=false;
625 NULL_is_zero=true;
626
627 switch(mode)
628 {
629 case flavourt::GCC:
630 defines.push_back("__hppa__");
631 break;
632
633 case flavourt::VISUAL_STUDIO:
634 UNREACHABLE; // not supported by Visual Studio
635 break;
636
637 case flavourt::CLANG:
638 case flavourt::CODEWARRIOR:
639 case flavourt::ARM:
640 case flavourt::ANSI:
641 break;
642
643 case flavourt::NONE:
645 }
646}
647
649{
650 set_ILP32();
651 long_double_width=8*8; // different from i386
652 endianness=endiannesst::IS_LITTLE_ENDIAN;
653 char_is_unsigned=false;
654 NULL_is_zero=true;
655
656 switch(mode)
657 {
658 case flavourt::GCC:
659 defines.push_back("__sh__");
660 defines.push_back("__SH4__");
661 break;
662
663 case flavourt::VISUAL_STUDIO:
664 UNREACHABLE; // not supported by Visual Studio
665 break;
666
667 case flavourt::CLANG:
668 case flavourt::CODEWARRIOR:
669 case flavourt::ARM:
670 case flavourt::ANSI:
671 break;
672
673 case flavourt::NONE:
675 }
676}
677
679{
680 set_LP64();
681 endianness = endiannesst::IS_LITTLE_ENDIAN;
682 long_double_width = 16 * 8;
683 char_is_unsigned = false;
684 NULL_is_zero = true;
685
686 switch(mode)
687 {
688 case flavourt::GCC:
689 defines.push_back("__loongarch__");
690 break;
691
692 case flavourt::VISUAL_STUDIO:
693 UNREACHABLE; // not supported by Visual Studio
694 break;
695
696 case flavourt::CODEWARRIOR:
697 case flavourt::CLANG:
698 case flavourt::ARM:
699 case flavourt::ANSI:
700 break;
701
702 case flavourt::NONE:
704 }
705}
706
708{
709 set_ILP32();
710 endianness = endiannesst::IS_LITTLE_ENDIAN;
711 long_double_width = 16 * 8;
712 char_is_unsigned = false;
713 NULL_is_zero = true;
714
715 switch(mode)
716 {
717 case flavourt::CLANG:
718 defines.push_back("__EMSCRIPTEN__");
719 break;
720
721 case flavourt::VISUAL_STUDIO:
722 UNREACHABLE; // not supported by Visual Studio
723 break;
724
725 case flavourt::GCC:
726 case flavourt::CODEWARRIOR:
727 case flavourt::ARM:
728 case flavourt::ANSI:
729 break;
730
731 case flavourt::NONE:
733 }
734}
735
737{
738#if defined(__APPLE__)
739 // By default, clang on the Mac builds C code in GNU C11
740 return c_standardt::C11;
741#elif defined(__FreeBSD__) || defined(__OpenBSD__)
742 // By default, clang on FreeBSD builds C code in GNU C99
743 // By default, clang on OpenBSD builds C code in C99
744 return c_standardt::C99;
745#else
746 // By default, gcc 5.4 or higher use gnu11; older versions use gnu89
747 return c_standardt::C11;
748#endif
749}
750
752{
753 // g++ 6.3 uses gnu++14
754 // g++ 5.4 uses gnu++98
755 // clang 6.0 uses c++14
756 #if defined _WIN32
757 return cpp_standardt::CPP14;
758 #else
759 return cpp_standardt::CPP98;
760 #endif
761}
762
763 void configt::set_arch(const irep_idt &arch)
764{
765 ansi_c.arch=arch;
766
767 if(arch=="none")
768 {
769 // the architecture for people who can't commit
772 ansi_c.NULL_is_zero=false;
773
774 if(sizeof(long int)==8)
775 ansi_c.set_64();
776 else
777 ansi_c.set_32();
778 }
779 else if(arch=="alpha")
780 ansi_c.set_arch_spec_alpha();
781 else if(arch=="arm64" ||
782 arch=="armel" ||
783 arch=="armhf" ||
784 arch=="arm")
785 ansi_c.set_arch_spec_arm(arch);
786 else if(arch=="mips64el" ||
787 arch=="mipsn32el" ||
788 arch=="mipsel" ||
789 arch=="mips64" ||
790 arch=="mipsn32" ||
791 arch=="mips")
792 ansi_c.set_arch_spec_mips(arch);
793 else if(arch=="powerpc" ||
794 arch=="ppc64" ||
795 arch=="ppc64le")
796 ansi_c.set_arch_spec_power(arch);
797 else if(arch == "riscv64")
798 ansi_c.set_arch_spec_riscv64();
799 else if(arch=="sparc" ||
800 arch=="sparc64")
801 ansi_c.set_arch_spec_sparc(arch);
802 else if(arch=="ia64")
803 ansi_c.set_arch_spec_ia64();
804 else if(arch=="s390x")
805 ansi_c.set_arch_spec_s390x();
806 else if(arch=="s390")
807 ansi_c.set_arch_spec_s390();
808 else if(arch=="x32")
809 ansi_c.set_arch_spec_x32();
810 else if(arch=="v850")
811 ansi_c.set_arch_spec_v850();
812 else if(arch=="hppa")
813 ansi_c.set_arch_spec_hppa();
814 else if(arch=="sh4")
815 ansi_c.set_arch_spec_sh4();
816 else if(arch=="x86_64")
817 ansi_c.set_arch_spec_x86_64();
818 else if(arch=="i386")
819 ansi_c.set_arch_spec_i386();
820 else if(arch == "loongarch64")
821 ansi_c.set_arch_spec_loongarch64();
822 else if(arch == "emscripten")
823 ansi_c.set_arch_spec_emscripten();
824 else
825 {
826 // We run on something new and unknown.
827 // We verify for i386 instead.
828 ansi_c.set_arch_spec_i386();
829 ansi_c.arch="i386";
830 }
831}
832
841 const std::string &argument,
842 const std::size_t pointer_width)
843{
844 const auto throw_for_reason = [&](const std::string &reason) {
846 "Value of \"" + argument + "\" given for object-bits is " + reason +
847 ". object-bits must be positive and less than the pointer width (" +
848 std::to_string(pointer_width) + ") ",
849 "--object_bits");
850 };
851 const auto object_bits = string2optional<unsigned int>(argument);
852 if(!object_bits)
853 throw_for_reason("not a valid unsigned integer");
854 if(*object_bits == 0 || *object_bits >= pointer_width)
855 throw_for_reason("out of range");
856
858 bv_encoding.object_bits = *object_bits;
859 bv_encoding.is_object_bits_default = false;
860 return bv_encoding;
861}
862
863 bool configt::set(const cmdlinet &cmdline)
864{
865 // defaults -- we match the architecture we have ourselves
866
867 cpp.cpp_standard=cppt::default_cpp_standard();
868
869 ansi_c.single_precision_constant=false;
870 ansi_c.allow_anonymous_struct_embedding = false;
871 ansi_c.for_has_scope=true; // C99 or later
872 ansi_c.ts_18661_3_Floatn_types=false;
873 ansi_c.__float128_is_keyword = false;
874 ansi_c.float16_type = false;
875 ansi_c.bf16_type = false;
876 ansi_c.fp16_type = false;
880 ansi_c.arch="none";
882 // NOLINTNEXTLINE(readability/casting)
883 ansi_c.NULL_is_zero=reinterpret_cast<size_t>(nullptr)==0;
884
885 // Default is ROUND_TO_EVEN, justified by C99:
886 // 1 At program startup the floating-point environment is initialized as
887 // prescribed by IEC 60559:
888 // - All floating-point exception status flags are cleared.
889 // - The rounding direction mode is rounding to nearest.
891
892 if(cmdline.isset("function"))
893 main=cmdline.get_value("function");
894
895 if(cmdline.isset('D'))
896 ansi_c.defines=cmdline.get_values('D');
897
898 if(cmdline.isset('I'))
899 ansi_c.include_paths=cmdline.get_values('I');
900
901 if(cmdline.isset("classpath"))
902 {
903 // Specifying -classpath or -cp overrides any setting of the
904 // CLASSPATH environment variable.
905 set_classpath(cmdline.get_value("classpath"));
906 }
907 else if(cmdline.isset("cp"))
908 {
909 // Specifying -classpath or -cp overrides any setting of the
910 // CLASSPATH environment variable.
911 set_classpath(cmdline.get_value("cp"));
912 }
913 else
914 {
915 // environment variable set?
916 const char *CLASSPATH=getenv("CLASSPATH");
917 if(CLASSPATH!=nullptr)
919 else
920 set_classpath("."); // default
921 }
922
923 if(cmdline.isset("main-class"))
924 java.main_class=cmdline.get_value("main-class");
925
926 if(cmdline.isset("include"))
927 ansi_c.include_files=cmdline.get_values("include");
928
929 // the default architecture is the one we run on
931 irep_idt arch=this_arch;
932
933 // let's pick an OS now
934 // the default is the one we run on
936 irep_idt os=this_os;
937
938 if(cmdline.isset("i386-linux"))
939 {
940 os="linux";
941 arch="i386";
942 }
943 else if(cmdline.isset("i386-win32") ||
944 cmdline.isset("win32"))
945 {
946 os="windows";
947 arch="i386";
948 }
949 else if(cmdline.isset("winx64"))
950 {
951 os="windows";
952 arch="x86_64";
953 }
954 else if(cmdline.isset("i386-macos"))
955 {
956 os="macos";
957 arch="i386";
958 }
959 else if(cmdline.isset("ppc-macos"))
960 {
961 arch="powerpc";
962 os="macos";
963 }
964
965 if(cmdline.isset("arch"))
966 {
967 arch=cmdline.get_value("arch");
968 }
969
970 if(cmdline.isset("os"))
971 {
972 os=cmdline.get_value("os");
973 }
974
975 if(os=="windows")
976 {
977 // Cygwin uses GCC throughout, use i386-linux
978 // MinGW needs --win32 --gcc
981
982 if(cmdline.isset("gcc"))
983 {
984 // There are gcc versions that target Windows (MinGW for example),
985 // and we support that.
988
989 // enable Cygwin
990 #ifdef _WIN32
991 ansi_c.defines.push_back("__CYGWIN__");
992 #endif
993
994 // MinGW has extra defines
995 ansi_c.defines.push_back("__int64=long long");
996 }
997 else
998 {
999 // On Windows, our default is Visual Studio.
1000 // On FreeBSD, it's clang.
1001 // On anything else, it's GCC as the preprocessor,
1002 // but we recognize the Visual Studio language,
1003 // which is somewhat inconsistent.
1004 #ifdef _WIN32
1007#elif defined(__FreeBSD__) || defined(__OpenBSD__)
1010#else
1013#endif
1014
1015 cpp.cpp_standard = cppt::cpp_standardt::CPP14;
1016 }
1017 }
1018 else if(os=="macos")
1019 {
1024 // configure_gcc sets these with additional version-of-clang level of
1025 // detail, but the below are reasonable defaults for modern clang
1026 // installations
1027 ansi_c.__float128_is_keyword = true;
1028 ansi_c.float16_type = true;
1029 ansi_c.bf16_type = true;
1030 ansi_c.fp16_type = true;
1031 }
1032 else if(os == "linux" || os == "solaris" || os == "netbsd" || os == "hurd")
1033 {
1038 }
1039 else if(os == "freebsd" || os == "openbsd")
1040 {
1045 // configure_gcc sets these with additional version-of-clang level of
1046 // detail, but the below are reasonable defaults for modern clang
1047 // installations
1048 ansi_c.__float128_is_keyword = true;
1049 ansi_c.float16_type = true;
1050 ansi_c.bf16_type = true;
1051 ansi_c.fp16_type = true;
1052 }
1053 else
1054 {
1055 // give up, but use reasonable defaults
1060 }
1061
1062 if(ansi_c.preprocessor == ansi_ct::preprocessort::GCC)
1063 ansi_c.gcc__float128_type = true;
1064
1065 set_arch(arch);
1066
1067 if(os=="windows")
1068 {
1069 // note that sizeof(void *)==8, but sizeof(long)==4!
1070 if(arch=="x86_64")
1071 ansi_c.set_LLP64();
1072
1073 // On Windows, wchar_t is unsigned 16 bit, regardless
1074 // of the compiler used.
1075 ansi_c.wchar_t_width=2*8;
1076 ansi_c.wchar_t_is_unsigned=true;
1077
1078 // long double is the same as double in Visual Studio,
1079 // but it's 16 bytes with GCC with the 64-bit target.
1080 if(arch == "x86_64" && cmdline.isset("gcc"))
1081 ansi_c.long_double_width=16*8;
1082 else
1083 ansi_c.long_double_width=8*8;
1084 }
1085 else if(os == "macos" && arch == "arm64")
1086 {
1087 // https://developer.apple.com/documentation/xcode/
1088 // writing_arm64_code_for_apple_platforms#//apple_ref/doc/uid/TP40013702-SW1
1089 ansi_c.char_is_unsigned = false;
1090 ansi_c.long_double_width = 8 * 8;
1091 }
1092
1093 // Let's check some of the type widths in case we run
1094 // the same architecture and OS that we are verifying for.
1095 if(arch==this_arch && os==this_os)
1096 {
1097 INVARIANT(
1098 ansi_c.int_width == sizeof(int) * CHAR_BIT,
1099 "int width shall be equal to the system int width");
1100 INVARIANT(
1101 ansi_c.long_int_width == sizeof(long) * CHAR_BIT,
1102 "long int width shall be equal to the system long int width");
1103 INVARIANT(
1104 ansi_c.bool_width == sizeof(bool) * CHAR_BIT,
1105 "bool width shall be equal to the system bool width");
1106 INVARIANT(
1107 ansi_c.char_width == sizeof(char) * CHAR_BIT,
1108 "char width shall be equal to the system char width");
1109 INVARIANT(
1110 ansi_c.short_int_width == sizeof(short) * CHAR_BIT,
1111 "short int width shall be equal to the system short int width");
1112 INVARIANT(
1113 ansi_c.long_long_int_width == sizeof(long long) * CHAR_BIT,
1114 "long long int width shall be equal to the system long long int width");
1115 INVARIANT(
1116 ansi_c.pointer_width == sizeof(void *) * CHAR_BIT,
1117 "pointer width shall be equal to the system pointer width");
1118 INVARIANT(
1119 ansi_c.single_width == sizeof(float) * CHAR_BIT,
1120 "float width shall be equal to the system float width");
1121 INVARIANT(
1122 ansi_c.double_width == sizeof(double) * CHAR_BIT,
1123 "double width shall be equal to the system double width");
1124 INVARIANT(
1125 ansi_c.char_is_unsigned ==
1126 (static_cast<char>((1 << CHAR_BIT) - 1) == (1 << CHAR_BIT) - 1),
1127 "char_is_unsigned flag shall indicate system char unsignedness");
1128
1129#ifndef _WIN32
1130 // On Windows, long double width varies by compiler
1131 INVARIANT(
1132 ansi_c.long_double_width == sizeof(long double) * CHAR_BIT,
1133 "long double width shall be equal to the system long double width");
1134#endif
1135 }
1136
1137 // the following allows overriding the defaults
1138
1139 if(cmdline.isset("16"))
1140 ansi_c.set_16();
1141
1142 if(cmdline.isset("32"))
1143 ansi_c.set_32();
1144
1145 if(cmdline.isset("64"))
1146 ansi_c.set_64();
1147
1148 if(cmdline.isset("LP64"))
1149 ansi_c.set_LP64(); // int=32, long=64, pointer=64
1150
1151 if(cmdline.isset("ILP64"))
1152 ansi_c.set_ILP64(); // int=64, long=64, pointer=64
1153
1154 if(cmdline.isset("LLP64"))
1155 ansi_c.set_LLP64(); // int=32, long=32, pointer=64
1156
1157 if(cmdline.isset("ILP32"))
1158 ansi_c.set_ILP32(); // int=32, long=32, pointer=32
1159
1160 if(cmdline.isset("LP32"))
1161 ansi_c.set_LP32(); // int=16, long=32, pointer=32
1162
1163 if(cmdline.isset("string-abstraction"))
1164 ansi_c.string_abstraction=true;
1165 else
1166 ansi_c.string_abstraction=false;
1167
1168 if(cmdline.isset("dfcc-debug-lib"))
1169 ansi_c.dfcc_debug_lib = true;
1170 else
1171 ansi_c.dfcc_debug_lib = false;
1172
1173 if(cmdline.isset("dfcc-simple-invalid-pointer-model"))
1174 ansi_c.simple_invalid_pointer_model = true;
1175 else
1176 ansi_c.simple_invalid_pointer_model = false;
1177
1178 if(cmdline.isset("no-library"))
1180
1181 if(cmdline.isset("little-endian"))
1183
1184 if(cmdline.isset("big-endian"))
1186
1187 if(cmdline.isset("little-endian") &&
1188 cmdline.isset("big-endian"))
1189 return true;
1190
1191 if(cmdline.isset("unsigned-char"))
1192 ansi_c.char_is_unsigned=true;
1193
1194 if(cmdline.isset("round-to-even") ||
1195 cmdline.isset("round-to-nearest"))
1196 ansi_c.rounding_mode=ieee_floatt::ROUND_TO_EVEN;
1197
1198 if(cmdline.isset("round-to-plus-inf"))
1200
1201 if(cmdline.isset("round-to-minus-inf"))
1203
1204 if(cmdline.isset("round-to-zero"))
1205 ansi_c.rounding_mode=ieee_floatt::ROUND_TO_ZERO;
1206
1207 if(cmdline.isset("object-bits"))
1208 {
1210 cmdline.get_value("object-bits"), ansi_c.pointer_width);
1211 }
1212
1213 if(cmdline.isset("malloc-fail-assert") && cmdline.isset("malloc-fail-null"))
1214 {
1216 "at most one malloc failure mode is acceptable", "--malloc-fail-null"};
1217 }
1218 if(cmdline.isset("malloc-fail-null"))
1219 ansi_c.malloc_failure_mode = ansi_c.malloc_failure_mode_return_null;
1220 if(cmdline.isset("malloc-fail-assert"))
1221 ansi_c.malloc_failure_mode = ansi_c.malloc_failure_mode_assert_then_assume;
1222
1223 if(cmdline.isset("malloc-may-fail"))
1224 {
1225 ansi_c.malloc_may_fail = true;
1226 }
1227 if(cmdline.isset("no-malloc-may-fail"))
1228 {
1229 ansi_c.malloc_may_fail = false;
1230 ansi_c.malloc_failure_mode = ansi_ct::malloc_failure_mode_none;
1231 }
1232
1233 if(cmdline.isset("c89"))
1234 ansi_c.set_c89();
1235
1236 if(cmdline.isset("c99"))
1237 ansi_c.set_c99();
1238
1239 if(cmdline.isset("c11"))
1240 ansi_c.set_c11();
1241
1242 if(cmdline.isset("c17"))
1243 ansi_c.set_c17();
1244
1245 if(cmdline.isset("c23"))
1246 ansi_c.set_c23();
1247
1248 if(cmdline.isset("cpp98"))
1249 cpp.set_cpp98();
1250
1251 if(cmdline.isset("cpp03"))
1252 cpp.set_cpp03();
1253
1254 if(cmdline.isset("cpp11"))
1255 cpp.set_cpp11();
1256
1257 // set the upper bound for argc
1258 if(os == "windows")
1259 {
1260 // On Windows, CreateProcess accepts no more than 32767 characters, so make
1261 // that a hard limit.
1262 ansi_c.max_argc = mp_integer{32767};
1263 }
1264 else
1265 {
1266 // For other systems assume argc is no larger than the what would make argv
1267 // the largest representable array (when using signed integers to represent
1268 // array sizes):
1269 // 2^(pointer_width - 1) / (pointer_width / char_width) is the maximum
1270 // number of argv elements sysconf(ARG_MAX) is likely much lower than this,
1271 // but we don't know that value for the verification target platform.
1272 const auto pointer_bits_2log =
1273 address_bits(ansi_c.pointer_width / ansi_c.char_width);
1274 if(ansi_c.pointer_width - pointer_bits_2log - 1 <= ansi_c.int_width)
1275 {
1276 ansi_c.max_argc =
1277 power(2, config.ansi_c.int_width - pointer_bits_2log - 1);
1278 }
1279 // otherwise we leave argc unconstrained
1280 }
1281
1282 return false;
1283}
1284
1286{
1287 // clang-format off
1288 switch(os)
1289 {
1290 case ost::OS_LINUX: return "linux";
1291 case ost::OS_MACOS: return "macos";
1292 case ost::OS_WIN: return "win";
1293 case ost::NO_OS: return "none";
1294 }
1295 // clang-format on
1296
1298}
1299
1301{
1302 if(os=="linux")
1303 return ost::OS_LINUX;
1304 else if(os=="macos")
1305 return ost::OS_MACOS;
1306 else if(os=="win")
1307 return ost::OS_WIN;
1308 else
1309 return ost::NO_OS;
1310}
1311
1313 const namespacet &ns,
1314 const std::string &what)
1315{
1316 const irep_idt id=CPROVER_PREFIX "architecture_"+what;
1317 const symbolt *symbol;
1318
1319 const bool not_found = ns.lookup(id, symbol);
1320 INVARIANT(!not_found, id2string(id) + " must be in namespace");
1321
1322 const exprt &tmp=symbol->value;
1323
1324 INVARIANT(
1325 tmp.id() == ID_address_of &&
1326 to_address_of_expr(tmp).object().id() == ID_index &&
1327 to_index_expr(to_address_of_expr(tmp).object()).array().id() ==
1329 "symbol table configuration entry '" + id2string(id) +
1330 "' must be a string constant");
1331
1332 return to_index_expr(to_address_of_expr(tmp).object()).array().get(ID_value);
1333}
1334
1335 static unsigned unsigned_from_ns(
1336 const namespacet &ns,
1337 const std::string &what)
1338{
1339 const irep_idt id=CPROVER_PREFIX "architecture_"+what;
1340 const symbolt *symbol;
1341
1342 const bool not_found = ns.lookup(id, symbol);
1343 INVARIANT(!not_found, id2string(id) + " must be in namespace");
1344
1345 exprt tmp=symbol->value;
1346 simplify(tmp, ns);
1347
1348 INVARIANT(
1349 tmp.is_constant(),
1350 "symbol table configuration entry '" + id2string(id) +
1351 "' must be a constant");
1352
1354
1355 const bool error = to_integer(to_constant_expr(tmp), int_value);
1356 INVARIANT(
1357 !error,
1358 "symbol table configuration entry '" + id2string(id) +
1359 "' must be convertible to mp_integer");
1360
1362}
1363
1365{
1366 // maybe not compiled from C/C++
1367 if(symbol_table.symbols.find(CPROVER_PREFIX "architecture_" "int_width")==
1368 symbol_table.symbols.end())
1369 return;
1370
1371 namespacet ns(symbol_table);
1372
1373 // clear defines
1374 ansi_c.defines.clear();
1375
1376 // first set architecture to get some defaults
1377 if(symbol_table.symbols.find(CPROVER_PREFIX "architecture_" "arch")==
1378 symbol_table.symbols.end())
1380 else
1381 set_arch(string_from_ns(ns, "arch"));
1382
1383 ansi_c.int_width=unsigned_from_ns(ns, "int_width");
1384 ansi_c.long_int_width=unsigned_from_ns(ns, "long_int_width");
1385 ansi_c.bool_width=1*8;
1386 ansi_c.char_width=unsigned_from_ns(ns, "char_width");
1387 ansi_c.short_int_width=unsigned_from_ns(ns, "short_int_width");
1388 ansi_c.long_long_int_width=unsigned_from_ns(ns, "long_long_int_width");
1389 ansi_c.pointer_width=unsigned_from_ns(ns, "pointer_width");
1390 ansi_c.single_width=unsigned_from_ns(ns, "single_width");
1391 ansi_c.double_width=unsigned_from_ns(ns, "double_width");
1392 ansi_c.long_double_width=unsigned_from_ns(ns, "long_double_width");
1393 ansi_c.wchar_t_width=unsigned_from_ns(ns, "wchar_t_width");
1394
1395 ansi_c.char_is_unsigned=unsigned_from_ns(ns, "char_is_unsigned")!=0;
1396 ansi_c.wchar_t_is_unsigned=unsigned_from_ns(ns, "wchar_t_is_unsigned")!=0;
1397 // for_has_scope, single_precision_constant, rounding_mode,
1398 // ts_18661_3_Floatn_types, __float128_is_keyword, float16_type, bf16_type,
1399 // fp16_type are not architectural features, and thus not stored in namespace
1400
1401 ansi_c.alignment=unsigned_from_ns(ns, "alignment");
1402
1403 ansi_c.memory_operand_size=unsigned_from_ns(ns, "memory_operand_size");
1404
1405 ansi_c.endianness=(ansi_ct::endiannesst)unsigned_from_ns(ns, "endianness");
1406
1407 if(symbol_table.symbols.find(CPROVER_PREFIX "architecture_" "os")==
1408 symbol_table.symbols.end())
1410 else
1412
1413 ansi_c.NULL_is_zero = unsigned_from_ns(ns, "NULL_is_zero") != 0;
1414
1415 // mode, preprocessor (and all preprocessor command line options),
1416 // lib, string_abstraction not stored in namespace
1417
1419}
1420
1424 const symbol_table_baset &symbol_table)
1425{
1426 // has been overridden by command line option,
1427 // thus do not apply language defaults
1428 if(!bv_encoding.is_object_bits_default)
1429 return;
1430
1431 // set object_bits according to entry point language
1432 if(const auto maybe_symbol=symbol_table.lookup(CPROVER_PREFIX "_start"))
1433 {
1435
1436 if(entry_point_symbol.mode==ID_java)
1437 bv_encoding.object_bits=java.default_object_bits;
1438 else if(entry_point_symbol.mode==ID_C)
1439 bv_encoding.object_bits=ansi_c.default_object_bits;
1440 else if(entry_point_symbol.mode==ID_cpp)
1441 bv_encoding.object_bits=cpp.default_object_bits;
1443 0<bv_encoding.object_bits && bv_encoding.object_bits<ansi_c.pointer_width,
1444 "object_bits should fit into pointer width");
1445 }
1446}
1447
1449{
1450 return "Running with "+std::to_string(bv_encoding.object_bits)+
1451 " object bits, "+
1452 std::to_string(ansi_c.pointer_width-bv_encoding.object_bits)+
1453 " offset bits ("+
1454 (bv_encoding.is_object_bits_default ? "default" : "user-specified")+
1455 ")";
1456}
1457
1458// clang-format off
1460{
1462
1463 // following http://wiki.debian.org/ArchitectureSpecificsMemo
1464
1465 #ifdef __alpha__
1466 this_arch = "alpha";
1467 #elif defined(__armel__)
1468 this_arch = "armel";
1469 #elif defined(__aarch64__)
1470 this_arch = "arm64";
1471 #elif defined(__arm__)
1472 #ifdef __ARM_PCS_VFP
1473 this_arch = "armhf"; // variant of arm with hard float
1474 #else
1475 this_arch = "arm";
1476 #endif
1477 #elif defined(_MIPSEL)
1478 #if _MIPS_SIM==_ABIO32
1479 this_arch = "mipsel";
1480 #elif _MIPS_SIM==_ABIN32
1481 this_arch = "mipsn32el";
1482 #else
1483 this_arch = "mips64el";
1484 #endif
1485 #elif defined(__mips__)
1486 #if _MIPS_SIM==_ABIO32
1487 this_arch = "mips";
1488 #elif _MIPS_SIM==_ABIN32
1489 this_arch = "mipsn32";
1490 #else
1491 this_arch = "mips64";
1492 #endif
1493 #elif defined(__powerpc__)
1494 #if defined(__ppc64__) || defined(__PPC64__) || \
1495 defined(__powerpc64__) || defined(__POWERPC64__)
1496 #ifdef __LITTLE_ENDIAN__
1497 this_arch = "ppc64le";
1498 #else
1499 this_arch = "ppc64";
1500 #endif
1501 #else
1502 this_arch = "powerpc";
1503 #endif
1504 #elif defined(__riscv)
1505 this_arch = "riscv64";
1506 #elif defined(__sparc__)
1507 #ifdef __arch64__
1508 this_arch = "sparc64";
1509 #else
1510 this_arch = "sparc";
1511 #endif
1512 #elif defined(__ia64__)
1513 this_arch = "ia64";
1514 #elif defined(__s390x__)
1515 this_arch = "s390x";
1516 #elif defined(__s390__)
1517 this_arch = "s390";
1518 #elif defined(__x86_64__)
1519 #ifdef __ILP32__
1520 this_arch = "x32"; // variant of x86_64 with 32-bit pointers
1521 #else
1522 this_arch = "x86_64";
1523 #endif
1524 #elif defined(__i386__)
1525 this_arch = "i386";
1526 #elif defined(_WIN64)
1527 this_arch = "x86_64";
1528 #elif defined(_WIN32)
1529 this_arch = "i386";
1530 #elif defined(__hppa__)
1531 this_arch = "hppa";
1532 #elif defined(__sh__)
1533 this_arch = "sh4";
1534 #elif defined(__loongarch__)
1535 this_arch = "loongarch64";
1536 #elif defined(__EMSCRIPTEN__)
1537 this_arch = "emscripten";
1538 #else
1539 // something new and unknown!
1540 this_arch = "unknown";
1541 #endif
1542
1543 return this_arch;
1544}
1545// clang-format on
1546
1547 void configt::set_classpath(const std::string &cp)
1548{
1549// These are separated by colons on Unix, and semicolons on
1550// Windows.
1551#ifdef _WIN32
1552 const char cp_separator = ';';
1553#else
1554 const char cp_separator = ':';
1555#endif
1556
1557 std::vector<std::string> class_path =
1559 java.classpath.insert(
1560 java.classpath.end(), class_path.begin(), class_path.end());
1561}
1562
1564{
1566
1567 #ifdef _WIN32
1568 this_os="windows";
1569 #elif __APPLE__
1570 this_os="macos";
1571 #elif __FreeBSD__
1572 this_os="freebsd";
1573#elif __OpenBSD__
1574 this_os = "openbsd";
1575#elif __NetBSD__
1576 this_os = "netbsd";
1577#elif __linux__
1578 this_os="linux";
1579#elif __SVR4
1580 this_os="solaris";
1581#elif __gnu_hurd__
1582 this_os = "hurd";
1583#elif __EMSCRIPTEN__
1584 this_os = "emscripten";
1585#else
1586 this_os="unknown";
1587#endif
1588
1589 return this_os;
1590}
1591
1605{
1606 PRECONDITION(ansi_c.pointer_width >= 1);
1607 PRECONDITION(bv_encoding.object_bits < ansi_c.pointer_width);
1608 PRECONDITION(bv_encoding.object_bits >= 1);
1609 const auto offset_bits = ansi_c.pointer_width - bv_encoding.object_bits;
1610 // We require the offset to be able to express upto allocation_size - 1,
1611 // but also down to -allocation_size, therefore the size is allowable
1612 // is number of bits, less the signed bit.
1613 const auto bits_for_positive_offset = offset_bits - 1;
1615}
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.
Definition arith_tools.cpp:21
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:1423
void set_arch(const irep_idt &)
Definition config.cpp:763
struct configt::bv_encodingt bv_encoding
bool set(const cmdlinet &cmdline)
Definition config.cpp:863
std::string object_bits_info()
Definition config.cpp:1448
void set_classpath(const std::string &cp)
Definition config.cpp:1547
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:1604
void set_from_symbol_table(const symbol_table_baset &)
Definition config.cpp:1364
static irep_idt this_architecture()
Definition config.cpp:1459
std::optional< std::string > main
Definition config.h:391
struct configt::javat java
struct configt::cppt cpp
static irep_idt this_operating_system()
Definition config.cpp:1563
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
@ ROUND_TO_ZERO
Definition ieee_float.h:382
@ ROUND_TO_PLUS_INF
Definition ieee_float.h:381
@ ROUND_TO_EVEN
Definition ieee_float.h:379
@ ROUND_TO_MINUS_INF
Definition ieee_float.h:380
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().
Definition namespace.cpp:134
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:840
static unsigned unsigned_from_ns(const namespacet &ns, const std::string &what)
Definition config.cpp:1335
configt config
Definition config.cpp:25
static irep_idt string_from_ns(const namespacet &ns, const std::string &what)
Definition config.cpp:1312
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.
Definition pointer_expr.h:577
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:560
void set_32()
Definition config.cpp:32
void set_arch_spec_riscv64()
Definition config.cpp:406
void set_16()
Definition config.cpp:27
void set_arch_spec_sh4()
Definition config.cpp:648
void set_arch_spec_loongarch64()
Definition config.cpp:678
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:596
void set_arch_spec_hppa()
Definition config.cpp:619
static std::string os_to_string(ost)
Definition config.cpp:1285
void set_ILP64()
int=64, long=64, pointer=64
Definition config.cpp:71
void set_64()
Definition config.cpp:37
void set_arch_spec_sparc(const irep_idt &subarch)
Definition config.cpp:489
static ost string_to_os(const std::string &)
Definition config.cpp:1300
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:281
@ malloc_failure_mode_none
Definition config.h:318
static c_standardt default_c_standard()
Definition config.cpp:736
void set_arch_spec_alpha()
Definition config.cpp:327
void set_arch_spec_power(const irep_idt &subarch)
Definition config.cpp:220
void set_arch_spec_s390()
Definition config.cpp:432
void set_LP64()
int=32, long=64, pointer=64
Definition config.cpp:47
void set_arch_spec_x86_64()
Definition config.cpp:182
void set_LP32()
int=16, long=32, pointer=32
Definition config.cpp:131
void set_arch_spec_s390x()
Definition config.cpp:461
void set_arch_spec_mips(const irep_idt &subarch)
Definition config.cpp:356
void set_arch_spec_i386()
Definition config.cpp:150
void set_arch_spec_ia64()
Definition config.cpp:529
void set_arch_spec_emscripten()
Definition config.cpp:707
static cpp_standardt default_cpp_standard()
Definition config.cpp:751
Author: Diffblue Ltd.

AltStyle によって変換されたページ (->オリジナル) /