This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] pr15551.C fix
- From: David Edelsohn <dje at watson dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 23 Apr 2006 12:26:39 -0400
- Subject: [C++ PATCH] pr15551.C fix
When I run the G++ testsuite, g++.dg/opt/pr15551.C fails because
"unlink is not in scope". The testcase does not appear to be including
any header file that will place unlink in the global or std namespaces.
I do not see any precedent for deleting a file within a G++
testcase. Most C++ references suggest using cstdio header and
std::remove. One could include unistd.h, but I am not sure if that is a
reasonable assumption for all G++ targets that might want to run the G++
testsuite.
This patch modifies the existing testcase to include cstdio header
and changes unlink to remove. With these changes, the testcase now passes
for me.
Okay for mainline?
* g++.dg/opt/pr15551.C: Include cstdio.
(main): Use remove instead of unlink.
Index: pr15551.C
===================================================================
*** pr15551.C (revision 113190)
--- pr15551.C (working copy)
***************
*** 7,12 ****
--- 7,13 ----
#include <cstring>
#include <fstream>
+ #include <cstdio>
using namespace std;
ostream* logfile;
*************** int main () {
*** 19,25 ****
strcpy(expList, "foo");
delete logfile;
! unlink ("bar");
return 0;
}
--- 20,26 ----
strcpy(expList, "foo");
delete logfile;
! remove ("bar");
return 0;
}