@@ -29,8 +29,11 @@ class TestIO : public TestFixture {
2929 }
3030
3131private:
32+ Settings settings;
3233
3334 void run () {
35+ LOAD_LIB_2 (settings.library , " std.cfg" );
36+
3437 TEST_CASE (coutCerrMisusage);
3538
3639 TEST_CASE (wrongMode_simple);
@@ -49,6 +52,8 @@ class TestIO : public TestFixture {
4952 TEST_CASE (testPrintfArgument);
5053 TEST_CASE (testPosixPrintfScanfParameterPosition); // #4900
5154
55+ LOAD_LIB_2 (settings.library , " windows.cfg" );
56+
5257 TEST_CASE (testMicrosoftPrintfArgument); // ticket #4902
5358 TEST_CASE (testMicrosoftScanfArgument);
5459 TEST_CASE (testMicrosoftCStringFormatArguments); // ticket #4920
@@ -60,16 +65,14 @@ class TestIO : public TestFixture {
6065 // Clear the error buffer..
6166 errout.str (" " );
6267
63- Settings settings;
68+ settings. clearEnabled () ;
6469 settings.addEnabled (" warning" );
6570 settings.addEnabled (" style" );
6671 if (portability)
6772 settings.addEnabled (" portability" );
6873 settings.inconclusive = inconclusive;
6974 settings.platform (platform);
7075
71- settings.library = _lib;
72-
7376 // Tokenize..
7477 Tokenizer tokenizer (&settings, this );
7578 std::istringstream istr (code);
@@ -612,8 +615,6 @@ class TestIO : public TestFixture {
612615
613616
614617 void testScanf1 () {
615- LOAD_LIB (" std.cfg" );
616-
617618 check (" void foo() {\n "
618619 " int a, b;\n "
619620 " FILE *file = fopen(\" test\" , \" r\" );\n "
@@ -632,8 +633,6 @@ class TestIO : public TestFixture {
632633 }
633634
634635 void testScanf2 () {
635- LOAD_LIB (" std.cfg" );
636-
637636 check (" void foo() {\n "
638637 " scanf(\" %5s\" , bar);\n " // Width specifier given
639638 " scanf(\" %5[^~]\" , bar);\n " // Width specifier given
@@ -660,8 +659,6 @@ class TestIO : public TestFixture {
660659 }
661660
662661 void testScanf4 () { // ticket #2553
663- LOAD_LIB (" std.cfg" );
664-
665662 check (" void f()\n "
666663 " {\n "
667664 " char str [8];\n "
@@ -674,8 +671,6 @@ class TestIO : public TestFixture {
674671
675672
676673 void testScanfArgument () {
677- LOAD_LIB (" std.cfg" );
678-
679674 check (" void foo() {\n "
680675 " scanf(\" %1d\" , &foo);\n "
681676 " sscanf(bar, \" %1d\" , &foo);\n "
@@ -2276,7 +2271,6 @@ class TestIO : public TestFixture {
22762271 }
22772272
22782273 void testPrintfArgument () {
2279- LOAD_LIB (" std.cfg" );
22802274 check (" void foo() {\n "
22812275 " printf(\" %u\" );\n "
22822276 " printf(\" %u%s\" , 123);\n "
@@ -3108,8 +3102,6 @@ class TestIO : public TestFixture {
31083102 }
31093103
31103104 void testPosixPrintfScanfParameterPosition () { // #4900 - No support for parameters in format strings
3111- LOAD_LIB (" std.cfg" );
3112-
31133105 check (" void foo() {"
31143106 " int bar;"
31153107 " printf(\" %1$d\" , 1);"
@@ -3134,9 +3126,6 @@ class TestIO : public TestFixture {
31343126
31353127
31363128 void testMicrosoftPrintfArgument () {
3137- LOAD_LIB (" std.cfg" );
3138- LOAD_LIB (" windows.cfg" );
3139-
31403129 check (" void foo() {\n "
31413130 " size_t s;\n "
31423131 " ptrdiff_t p;\n "
@@ -3226,9 +3215,6 @@ class TestIO : public TestFixture {
32263215 }
32273216
32283217 void testMicrosoftScanfArgument () {
3229- LOAD_LIB (" std.cfg" );
3230- LOAD_LIB (" windows.cfg" );
3231-
32323218 check (" void foo() {\n "
32333219 " size_t s;\n "
32343220 " ptrdiff_t p;\n "
@@ -3333,9 +3319,6 @@ class TestIO : public TestFixture {
33333319 }
33343320
33353321 void testMicrosoftSecurePrintfArgument () {
3336- LOAD_LIB (" std.cfg" );
3337- LOAD_LIB (" windows.cfg" );
3338-
33393322 check (" void foo() {\n "
33403323 " int i;\n "
33413324 " unsigned int u;\n "
@@ -3526,8 +3509,6 @@ class TestIO : public TestFixture {
35263509 }
35273510
35283511 void testMicrosoftSecureScanfArgument () {
3529- LOAD_LIB (" windows.cfg" );
3530-
35313512 check (" void foo() {\n "
35323513 " int i;\n "
35333514 " unsigned int u;\n "
0 commit comments