MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / set

Method set

lib/platform.cpp:37–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36
37bool Platform::set(Type t)
38{
39 switch (t) {
40 case Type::Unspecified: // unknown type sizes (sizes etc are set but are not known)
41 case Type::Native: // same as system this code was compile on
42 type = t;
43 windows = false;
44 sizeof_bool = sizeof(bool);
45 sizeof_short = sizeof(short);
46 sizeof_int = sizeof(int);
47 sizeof_long = sizeof(long);
48 sizeof_long_long = sizeof(long long);
49 sizeof_float = sizeof(float);
50 sizeof_double = sizeof(double);
51 sizeof_long_double = sizeof(long double);
52 sizeof_wchar_t = sizeof(wchar_t);
53 sizeof_size_t = sizeof(std::size_t);
54 sizeof_pointer = sizeof(void *);
55 if (type == Type::Unspecified) {
56 defaultSign = '\0';
57 } else {
58 defaultSign = std::numeric_limits<char>::is_signed ? 's' : 'u';
59 }
60 char_bit = 8;
61 calculateBitMembers();
62 return true;
63 case Type::Win32W:
64 case Type::Win32A:
65 type = t;
66 windows = true;
67 sizeof_bool = 1; // 4 in Visual C++ 4.2
68 sizeof_short = 2;
69 sizeof_int = 4;
70 sizeof_long = 4;
71 sizeof_long_long = 8;
72 sizeof_float = 4;
73 sizeof_double = 8;
74 sizeof_long_double = 8;
75 sizeof_wchar_t = 2;
76 sizeof_size_t = 4;
77 sizeof_pointer = 4;
78 defaultSign = 's';
79 char_bit = 8;
80 calculateBitMembers();
81 return true;
82 case Type::Win64:
83 type = t;
84 windows = true;
85 sizeof_bool = 1;
86 sizeof_short = 2;
87 sizeof_int = 4;
88 sizeof_long = 4;
89 sizeof_long_long = 8;
90 sizeof_float = 4;
91 sizeof_double = 8;
92 sizeof_long_double = 8;
93 sizeof_wchar_t = 2;
94 sizeof_size_t = 8;

Callers 3

checkMethod · 0.45
parseFromArgsMethod · 0.45
getCppcheckSettingsMethod · 0.45

Calls 3

calculateBitMembersFunction · 0.85
setFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected