aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-09-06 01:25:07 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2007-09-06 01:25:07 +0200
commit62bedd31edd62e473fceb5c75b838e4c4f5079fe (patch)
tree1d6176051116d224efb9036dd9ba002ea90773a4 /gcc/cp
parentb1e3f20e51b93889c8fb8dbb4205170d33dfa9ec (diff)
downloadgcc-62bedd31edd62e473fceb5c75b838e4c4f5079fe.zip
gcc-62bedd31edd62e473fceb5c75b838e4c4f5079fe.tar.gz
gcc-62bedd31edd62e473fceb5c75b838e4c4f5079fe.tar.bz2
decl.c (duplicate_decls): Set TREE_NOTHROW on __builtin_XX decl if a prototype for XX is provided with...
* decl.c (duplicate_decls): Set TREE_NOTHROW on __builtin_XX decl if a prototype for XX is provided with throw(). * g++.dg/eh/builtin1.C: New test. * g++.dg/eh/builtin2.C: New test. * g++.dg/eh/builtin3.C: New test. From-SVN: r128159
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c11
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bd9d1e7..07663ed 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2007-09-06 Jakub Jelinek <jakub@redhat.com>
+
+ * decl.c (duplicate_decls): Set TREE_NOTHROW on __builtin_XX
+ decl if a prototype for XX is provided with throw().
+
2007-09-05 Paolo Carlini <pcarlini@suse.de>
PR c++/30302
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 5971bb8..311925a 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1280,6 +1280,17 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = type;
}
+ /* If a function is explicitly declared "throw ()", propagate that to
+ the corresponding builtin. */
+ if (DECL_BUILT_IN_CLASS (olddecl) == BUILT_IN_NORMAL
+ && DECL_ANTICIPATED (olddecl)
+ && TREE_NOTHROW (newdecl)
+ && !TREE_NOTHROW (olddecl)
+ && built_in_decls [DECL_FUNCTION_CODE (olddecl)] != NULL_TREE
+ && built_in_decls [DECL_FUNCTION_CODE (olddecl)] != olddecl
+ && types_match)
+ TREE_NOTHROW (built_in_decls [DECL_FUNCTION_CODE (olddecl)]) = 1;
+
/* Whether or not the builtin can throw exceptions has no
bearing on this declarator. */
TREE_NOTHROW (olddecl) = 0;