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

Method strictAnsi

test/testpreprocessor.cpp:2160–2175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2158 }
2159
2160 void strictAnsi() {
2161 const char code[] = "#ifdef __STRICT_ANSI__\n123\n#endif";
2162 Settings settings;
2163
2164 settings.standards.setStd("gnu99");
2165 ASSERT_EQUALS("", getcodeforcfg(settings, *this, code, "", "test.c"));
2166
2167 settings.standards.setStd("c99");
2168 ASSERT_EQUALS("\n123", getcodeforcfg(settings, *this, code, "", "test.c"));
2169
2170 settings.standards.setStd("gnu++11");
2171 ASSERT_EQUALS("", getcodeforcfg(settings, *this, code, "", "test.cpp"));
2172
2173 settings.standards.setStd("c++11");
2174 ASSERT_EQUALS("\n123", getcodeforcfg(settings, *this, code, "", "test.cpp"));
2175 }
2176
2177 void invalidElIf() {
2178 // #2942 - segfault

Callers

nothing calls this directly

Calls 1

setStdMethod · 0.45

Tested by

no test coverage detected