aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2011-10-12 18:40:58 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2011-10-12 18:40:58 +0000
commit578f023490bab56ea603aa4374ecbf31b38c24b5 (patch)
tree86535a35e8420259fa52ecd17bb9798257bc4968 /gcc/cp
parent0a6fa37645370f2bbbee102afd270464259c4124 (diff)
downloadgcc-578f023490bab56ea603aa4374ecbf31b38c24b5.zip
gcc-578f023490bab56ea603aa4374ecbf31b38c24b5.tar.gz
gcc-578f023490bab56ea603aa4374ecbf31b38c24b5.tar.bz2
re PR c++/50594 (Option -fwhole-program discards replaced new operator for std::string)
2011-10-12 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50594 * decl.c (cxx_init_decl_processing): Add __attribute__((externally_visible)) to operator new and operator delete library fn. 2011-10-12 Paolo Carlini <paolo.carlini@oracle.com> PR c++/50594 * libsupc++/new (operator new, operator delete): Decorate with __attribute__((__externally_visible__)). * include/bits/c++config: Add _GLIBCXX_THROW. * libsupc++/del_op.cc: Adjust. * libsupc++/del_opv.cc: Likewise. * libsupc++/del_opnt.cc: Likewise. * libsupc++/del_opvnt.cc: Likewise. * libsupc++/new_op.cc: Likewise. * libsupc++/new_opv.cc: Likewise. * libsupc++/new_opnt.cc: Likewise. * libsupc++/new_opvnt.cc: Likewise. * testsuite/18_support/50594.cc: New. * testsuite/ext/profile/mutex_extensions_neg.cc: Adjust dg-error line number. From-SVN: r179863
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c13
2 files changed, 15 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ca8566f..e7c5b49 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2011-10-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/50594
+ * decl.c (cxx_init_decl_processing): Add
+ __attribute__((externally_visible)) to operator new and
+ operator delete library fn.
+
2011-10-11 Michael Meissner <meissner@linux.vnet.ibm.com>
* decl.c (duplicate_decls): Delete old interface with two parallel
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c8f3255..8b5033f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3654,7 +3654,7 @@ cxx_init_decl_processing (void)
current_lang_name = lang_name_cplusplus;
{
- tree newattrs;
+ tree newattrs, extvisattr;
tree newtype, deltype;
tree ptr_ftype_sizetype;
tree new_eh_spec;
@@ -3684,12 +3684,15 @@ cxx_init_decl_processing (void)
/* Ensure attribs.c is initialized. */
init_attributes ();
- newattrs
- = build_tree_list (get_identifier ("alloc_size"),
- build_tree_list (NULL_TREE, integer_one_node));
+ extvisattr = build_tree_list (get_identifier ("externally_visible"),
+ NULL_TREE);
+ newattrs = tree_cons (get_identifier ("alloc_size"),
+ build_tree_list (NULL_TREE, integer_one_node),
+ extvisattr);
newtype = cp_build_type_attribute_variant (ptr_ftype_sizetype, newattrs);
newtype = build_exception_variant (newtype, new_eh_spec);
- deltype = build_exception_variant (void_ftype_ptr, empty_except_spec);
+ deltype = cp_build_type_attribute_variant (void_ftype_ptr, extvisattr);
+ deltype = build_exception_variant (deltype, empty_except_spec);
push_cp_library_fn (NEW_EXPR, newtype);
push_cp_library_fn (VEC_NEW_EXPR, newtype);
global_delete_fndecl = push_cp_library_fn (DELETE_EXPR, deltype);