This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] Avoid a warning; fail gracefully in testsuite/performance
- From: Paolo Carlini <pcarlini at suse dot de>
- To: "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 10 Oct 2004 19:57:53 +0200
- Subject: [v3] Avoid a warning; fail gracefully in testsuite/performance
Hi,
a couple of minor fixes. Tested x86-linux, committed.
Paolo.
/////////////
2004-10-10 Paolo Carlini <pcarlini@suse.de>
* config/locale/gnu/monetary_members.cc (_S_construct_pattern):
Give __ret a default value, thus avoiding spurious warnings.
* testsuite/performance/27_io/filebuf_sgetn_unbuf.cc: Open either
words or linux.words, otherwise exit.
* testsuite/performance/27_io/ifstream_getline.cc: Slighlty tweak.
diff -urN libstdc++-v3-orig/config/locale/gnu/monetary_members.cc libstdc++-v3/config/locale/gnu/monetary_members.cc
--- libstdc++-v3-orig/config/locale/gnu/monetary_members.cc 2004-06-28 11:27:18.000000000 +0200
+++ libstdc++-v3/config/locale/gnu/monetary_members.cc 2004-10-10 18:09:47.000000000 +0200
@@ -199,7 +199,7 @@
}
break;
default:
- ;
+ __ret = pattern();
}
return __ret;
}
diff -urN libstdc++-v3-orig/testsuite/performance/27_io/filebuf_sgetn_unbuf.cc libstdc++-v3/testsuite/performance/27_io/filebuf_sgetn_unbuf.cc
--- libstdc++-v3-orig/testsuite/performance/27_io/filebuf_sgetn_unbuf.cc 2004-09-14 00:21:34.000000000 +0200
+++ libstdc++-v3/testsuite/performance/27_io/filebuf_sgetn_unbuf.cc 2004-10-10 18:41:35.000000000 +0200
@@ -42,10 +42,18 @@
const int chunksize = 100;
char* chunk = new char[chunksize];
- const char* name = "/usr/share/dict/linux.words";
+ const char* name1 = "/usr/share/dict/words";
+ const char* name2 = "/usr/share/dict/linux.words";
+ const char* name = name1;
// C
- FILE* file = fopen(name, "r");
+ FILE* file;
+ if (!(file = fopen(name, "r")))
+ {
+ name = name2;
+ if (!(file = fopen(name, "r")))
+ exit(1);
+ }
setvbuf(file, 0, _IONBF, 0);
start_counters(time, resource);
for (int i = 0; i < iterations; ++i)
diff -urN libstdc++-v3-orig/testsuite/performance/27_io/ifstream_getline.cc libstdc++-v3/testsuite/performance/27_io/ifstream_getline.cc
--- libstdc++-v3-orig/testsuite/performance/27_io/ifstream_getline.cc 2004-01-30 18:04:38.000000000 +0100
+++ libstdc++-v3/testsuite/performance/27_io/ifstream_getline.cc 2004-10-10 18:56:50.000000000 +0200
@@ -46,14 +46,13 @@
in.clear();
in.open(name2);
}
+ if (!in.is_open())
+ exit(1);
char buffer[BUFSIZ];
start_counters(time, resource);
- if (in.is_open())
- {
- while (in.good())
- in.getline(buffer, BUFSIZ);
- }
+ while (in.good())
+ in.getline(buffer, BUFSIZ);
stop_counters(time, resource);
report_performance(__FILE__, "", time, resource);