From 2c3e097e166474b86d5f1020b300a2a1681f5500 Mon Sep 17 00:00:00 2001 From: mmitchel Date: Mon, 3 Oct 2005 17:21:40 +0000 Subject: [PATCH] PR c++/17775 * repo.c: Include flags.h. (finish_repo): Add -frandom-seed to the arguments. PR c++/17775 * g++.dg/template/repo4.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104898 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/repo.c | 12 +++++++++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/repo4.C | 16 ++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/repo4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0680b67..6ccc3f9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-10-03 Mark Mitchell + + PR c++/17775 + * repo.c: Include flags.h. + (finish_repo): Add -frandom-seed to the arguments. + 2005-10-02 Mark Mitchell PR c++/22621 diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c index b3d327d..eee3b87 100644 --- a/gcc/cp/repo.c +++ b/gcc/cp/repo.c @@ -36,6 +36,7 @@ Boston, MA 02110-1301, USA. */ #include "obstack.h" #include "toplev.h" #include "diagnostic.h" +#include "flags.h" static char *extract_string (char **); static const char *get_base_filename (const char *); @@ -239,7 +240,16 @@ finish_repo (void) fprintf (repo_file, "D %s\n", dir); args = getenv ("COLLECT_GCC_OPTIONS"); if (args) - fprintf (repo_file, "A %s\n", args); + { + fprintf (repo_file, "A %s", args); + /* If -frandom-seed is not among the ARGS, then add the value + that we chose. That will ensure that the names of types from + anonymous namespaces will get the same mangling when this + file is recompiled. */ + if (!strstr (args, "'-frandom-seed=")) + fprintf (repo_file, " '-frandom-seed=%s'", flag_random_seed); + fprintf (repo_file, "\n"); + } for (t = pending_repo; t; t = TREE_CHAIN (t)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ea8a2a7..ecb578e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-10-03 Mark Mitchell + + PR c++/17775 + * g++.dg/template/repo4.C: New test. + 2005-10-03 Francois-Xavier Coudert PR libfortran/19308 diff --git a/gcc/testsuite/g++.dg/template/repo4.C b/gcc/testsuite/g++.dg/template/repo4.C new file mode 100644 index 0000000..bd07f9580 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/repo4.C @@ -0,0 +1,16 @@ +// PR c++/17775 +// { dg-options "-frepo" } +// { dg-final { cleanup-repo-files } } + +namespace { + struct Foo {}; +} + +template +void foo(Tp) {} + +int +main() +{ + foo(Foo()); +} -- 2.7.4