@@ -2915,14 +2915,16 @@ class TestIO : public TestFixture {
29152915 " [test.cpp:3]: (warning) %Lf in format string (no. 5) requires 'long double' but the argument type is 'signed int'.\n "
29162916 " [test.cpp:3]: (warning) %p in format string (no. 6) requires an address but the argument type is 'signed int'.\n " , errout_str ());
29172917
2918+ // We should revisit the logic behind portability checks here.
29182919 check (" struct Fred { int32_t i; } f;\n "
29192920 " struct Fred & bar() { };\n "
2920- " void foo() { printf(\" %d %ld %u %lu %f %Lf\" , bar().i, bar().i, bar().i, bar().i, bar().i, bar().i); }" );
2921- ASSERT_EQUALS (" [test.cpp:3]: (warning) %ld in format string (no. 2) requires 'long' but the argument type is 'signed int'.\n "
2922- " [test.cpp:3]: (warning) %u in format string (no. 3) requires 'unsigned int' but the argument type is 'signed int'.\n "
2923- " [test.cpp:3]: (warning) %lu in format string (no. 4) requires 'unsigned long' but the argument type is 'signed int'.\n "
2924- " [test.cpp:3]: (warning) %f in format string (no. 5) requires 'double' but the argument type is 'signed int'.\n "
2925- " [test.cpp:3]: (warning) %Lf in format string (no. 6) requires 'long double' but the argument type is 'signed int'.\n " ,
2921+ " void foo() { printf(\" %d %ld %u %lu %f %Lf\" , bar().i, bar().i, bar().i, bar().i, bar().i, bar().i); }" ,
2922+ dinit (CheckOptions, $.portability = true ));
2923+ ASSERT_EQUALS (" [test.cpp:3]: (portability) %ld in format string (no. 2) requires 'long' but the argument type is 'int32_t {aka signed int}'.\n "
2924+ " [test.cpp:3]: (portability) %u in format string (no. 3) requires 'unsigned int' but the argument type is 'int32_t {aka signed int}'.\n "
2925+ " [test.cpp:3]: (portability) %lu in format string (no. 4) requires 'unsigned long' but the argument type is 'int32_t {aka signed int}'.\n "
2926+ " [test.cpp:3]: (portability) %f in format string (no. 5) requires 'double' but the argument type is 'int32_t {aka signed int}'.\n "
2927+ " [test.cpp:3]: (portability) %Lf in format string (no. 6) requires 'long double' but the argument type is 'int32_t {aka signed int}'.\n " ,
29262928 errout_str ());
29272929
29282930 // #4984
0 commit comments