@@ -311,6 +311,8 @@ class TestPreprocessor : public TestFixture {
311311 TEST_CASE (getConfigs8); // #if A==1 => cfg: A=1
312312 TEST_CASE (getConfigs10); // #5139
313313 TEST_CASE (getConfigs11); // #9832 - include guards
314+ TEST_CASE (getConfigs12); // #14222
315+ TEST_CASE (getConfigs13); // #14222
314316 TEST_CASE (getConfigsError);
315317
316318 TEST_CASE (getConfigsD1);
@@ -357,12 +359,14 @@ class TestPreprocessor : public TestFixture {
357359 }
358360
359361 template <size_t size>
360- std::string getConfigsStr (const char (&code)[size], const char *arg = nullptr) {
362+ std::string getConfigsStr (const char (&code)[size], const char *arg = nullptr, const char *library = nullptr ) {
361363 Settings settings;
362364 if (arg && std::strncmp (arg," -D" ,2 )==0 )
363365 settings.userDefines = arg + 2 ;
364366 if (arg && std::strncmp (arg," -U" ,2 )==0 )
365367 settings.userUndefs .insert (arg+2 );
368+ if (library)
369+ ASSERT (settings.library .load (" " , library, false ).errorcode == Library::ErrorCode::OK);
366370 std::vector<std::string> files;
367371 // TODO: this adds an empty filename
368372 simplecpp::TokenList tokens (code,files);
@@ -2264,6 +2268,20 @@ class TestPreprocessor : public TestFixture {
22642268 ASSERT_EQUALS (" \n " , getConfigsStr (filedata));
22652269 }
22662270
2271+ void getConfigs12 () { // #14222
2272+ const char filedata[] = " #ifdef INT8_MAX\n "
2273+ " INT8_MAX\n "
2274+ " #endif\n " ;
2275+ ASSERT_EQUALS (" \n " , getConfigsStr (filedata, nullptr , " std.cfg" ));
2276+ }
2277+
2278+ void getConfigs13 () { // #14222
2279+ const char filedata[] = " #ifdef __builtin_bswap16\n "
2280+ " __builtin_bswap16(x);\n "
2281+ " #endif\n " ;
2282+ ASSERT_EQUALS (" \n " , getConfigsStr (filedata, nullptr , " gnu.cfg" ));
2283+ }
2284+
22672285 void getConfigsError () {
22682286 const char filedata1[] = " #ifndef X\n "
22692287 " #error \" !X\"\n "
0 commit comments