summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Koenig <jck@gmx.org>2019-07-12 22:16:28 (GMT)
committerJoerg Koenig <jck@gmx.org>2019-07-12 22:16:28 (GMT)
commit1e761bb0e127dd082236b6ba453790bbefed4128 (patch)
treec3e3afb8a9b4d71471be0b3b0211fca92a0d58ba
parent4c683ccd24cb916199d855941c30b5edb016d9ec (diff)
downloadgcc-compiler-suite-1e761bb0e127dd082236b6ba453790bbefed4128.zip
gcc-compiler-suite-1e761bb0e127dd082236b6ba453790bbefed4128.tar.gz
gcc-compiler-suite-1e761bb0e127dd082236b6ba453790bbefed4128.tar.bz2
Adde patch for deprecated-copy false positivesrefs/changes/24/8224/1
Resolves: :jira:<issue> See also: :jira:<issue> Change-Id: I1915027fdfe0786bb024597b9815d3348ef414ec
-rw-r--r--Makefile5
-rw-r--r--PATCHES/0020-gcc-9-deprecated-copy_false_positives.patch166
2 files changed, 170 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 3c41155..468e479 100644
--- a/Makefile
+++ b/Makefile
@@ -159,7 +159,10 @@ prepare:
patch -p1 < $(PATCHES_DIR)/0004-Windows-Use-not-in-progpath-and-leave-case-as-is.patch && \
patch -p1 < $(PATCHES_DIR)/0006-Windows-New-feature-to-allow-overriding.patch && \
patch -p1 < $(PATCHES_DIR)/0008-Prettify-linking-no-undefined.patch && \
- patch -p1 < $(PATCHES_DIR)/0010-Fix-using-large-PCH.patch
+ patch -p1 < $(PATCHES_DIR)/0010-Fix-using-large-PCH.patch
+ # Patch from https://patchwork.ozlabs.org/patch/1009009/
+ cd $(UNPACK_DIR)/gcc-$(VERSION_GCC) && \
+ patch -p1 < $(PATCHES_DIR)/0020-gcc-9-deprecated-copy_false_positives.patch
tar -zxf $(SOURCE_DIR)/gdb-$(VERSION_GDB).tar.gz -C $(UNPACK_DIR)/
cd $(UNPACK_DIR)/gdb-$(VERSION_GDB) && \
patch -p1 < $(PATCHES_DIR)/0004-Windows-Use-not-in-progpath-and-leave-case-as-is.patch
diff --git a/PATCHES/0020-gcc-9-deprecated-copy_false_positives.patch b/PATCHES/0020-gcc-9-deprecated-copy_false_positives.patch
new file mode 100644
index 0000000..a597200
--- /dev/null
+++ b/PATCHES/0020-gcc-9-deprecated-copy_false_positives.patch
@@ -0,0 +1,166 @@
+commit c37377416dcbf21c6b9f6c7b83fd8f9587b0a517
+Author: Jason Merrill <jason@redhat.com>
+Date: Wed Nov 21 18:04:02 2018 -0500
+
+ PR c++/88136 - -Wdeprecated-copy false positives
+
+ Deprecating the copy operations because the class has a user-provided
+ destructor turns out to have too many false positives; this patch adjusts
+ -Wdeprecated-copy to only deprecate if the other copy operation is
+ user-provided. To get the earlier behavior, people can explicitly request
+ it with -Wdeprecated-copy-dtor.
+
+ gcc/c-family/
+ * c.opt (Wdeprecated-copy-dtor): New.
+ (Wdeprecated-copy): Move to -Wextra.
+ gcc/cp/
+ * class.c (classtype_has_depr_implicit_copy): Rename from
+ classtype_has_user_copy_or_dtor.
+ * method.c (lazily_declare_fn): Adjust.
+ * decl2.c (cp_warn_deprecated_use): Refer to -Wdeprecated-copy-dtor
+ if deprecation is due to a destructor.
+
+diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
+index 3b6912ea1cc..98c1a748329 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -228,7 +228,8 @@ in the following sections.
+ -fvisibility-ms-compat @gol
+ -fext-numeric-literals @gol
+ -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
+--Wdelete-non-virtual-dtor -Wdeprecated-copy -Wliteral-suffix @gol
++-Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
++-Wliteral-suffix @gol
+ -Wmultiple-inheritance -Wno-init-list-lifetime @gol
+ -Wnamespaces -Wnarrowing @gol
+ -Wpessimizing-move -Wredundant-move @gol
+@@ -3000,8 +3001,10 @@ by @option{-Wall}.
+ @opindex Wno-deprecated-copy
+ Warn that the implicit declaration of a copy constructor or copy
+ assignment operator is deprecated if the class has a user-provided
+-copy constructor, copy assignment operator, or destructor, in C++11
+-and up. This warning is enabled by @option{-Wall}.
++copy constructor or copy assignment operator, in C++11 and up. This
++warning is enabled by @option{-Wextra}. With
++@option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
++user-provided destructor.
+
+ @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
+ @opindex Winit-list-lifetime
+@@ -4407,6 +4410,7 @@ name is still supported, but the newer name is more descriptive.)
+
+ @gccoptlist{-Wclobbered @gol
+ -Wcast-function-type @gol
++-Wdeprecated-copy @r{(C++ only)} @gol
+ -Wempty-body @gol
+ -Wignored-qualifiers @gol
+ -Wimplicit-fallthrough=3 @gol
+diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
+index 6f88a1013d6..07ff1c84f96 100644
+--- a/gcc/c-family/c.opt
++++ b/gcc/c-family/c.opt
+@@ -481,7 +481,12 @@ C C++ ObjC ObjC++ CPP(cpp_warn_deprecated) CppReason(CPP_W_DEPRECATED) Var(warn_
+ Warn if a deprecated compiler feature, class, method, or field is used.
+
+ Wdeprecated-copy
+-C++ ObjC++ Var(warn_deprecated_copy) Warning LangEnabledBy(C++ ObjC++, Wall)
++C++ ObjC++ Var(warn_deprecated_copy) Warning LangEnabledBy(C++ ObjC++, Wextra)
++Mark implicitly-declared copy operations as deprecated if the class has a
++user-provided copy operation.
++
++Wdeprecated-copy-dtor
++C++ ObjC++ Var(warn_deprecated_copy, 2) Warning
+ Mark implicitly-declared copy operations as deprecated if the class has a
+ user-provided copy operation or destructor.
+
+diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
+index 111a123bb34..886abeaa3f9 100644
+--- a/gcc/cp/cp-tree.h
++++ b/gcc/cp/cp-tree.h
+@@ -6272,7 +6272,7 @@ extern bool type_has_constexpr_default_constructor (tree);
+ extern bool type_has_virtual_destructor (tree);
+ extern bool classtype_has_move_assign_or_move_ctor_p (tree, bool user_declared);
+ extern bool classtype_has_non_deleted_move_ctor (tree);
+-extern tree classtype_has_user_copy_or_dtor (tree);
++extern tree classtype_has_depr_implicit_copy (tree);
+ extern bool type_build_ctor_call (tree);
+ extern bool type_build_dtor_call (tree);
+ extern void explain_non_literal_class (tree);
+diff --git a/gcc/cp/class.c b/gcc/cp/class.c
+index 57261511a90..9c175f85cf6 100644
+--- a/gcc/cp/class.c
++++ b/gcc/cp/class.c
+@@ -5233,7 +5233,7 @@ classtype_has_non_deleted_move_ctor (tree t)
+ operator, or destructor, returns that function. Otherwise, null. */
+
+ tree
+-classtype_has_user_copy_or_dtor (tree t)
++classtype_has_depr_implicit_copy (tree t)
+ {
+ if (!CLASSTYPE_LAZY_COPY_CTOR (t))
+ for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter)
+diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
+index 79abdaebe86..44e6ef379ed 100644
+--- a/gcc/cp/decl2.c
++++ b/gcc/cp/decl2.c
+@@ -5275,18 +5275,23 @@ cp_warn_deprecated_use (tree decl, tsubst_flags_t complain)
+ && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
+ && copy_fn_p (decl))
+ {
+- auto_diagnostic_group d;
+- /* Don't warn about system library classes (c++/86342). */
+- if (!DECL_IN_SYSTEM_HEADER (decl))
+- warned = warning (OPT_Wdeprecated_copy,
+- "implicitly-declared %qD is deprecated", decl);
+- if (warned)
++ if (warn_deprecated_copy
++ /* Don't warn about system library classes (c++/86342). */
++ && (!DECL_IN_SYSTEM_HEADER (decl)
++ || global_dc->dc_warn_system_headers))
+ {
++ auto_diagnostic_group d;
+ tree ctx = DECL_CONTEXT (decl);
+- tree other = classtype_has_user_copy_or_dtor (ctx);
+- inform (DECL_SOURCE_LOCATION (other),
+- "because %qT has user-provided %qD",
+- ctx, other);
++ tree other = classtype_has_depr_implicit_copy (ctx);
++ int opt = (DECL_DESTRUCTOR_P (other)
++ ? OPT_Wdeprecated_copy_dtor
++ : OPT_Wdeprecated_copy);
++ warned = warning (opt, "implicitly-declared %qD is deprecated",
++ decl);
++ if (warned)
++ inform (DECL_SOURCE_LOCATION (other),
++ "because %qT has user-provided %qD",
++ ctx, other);
+ }
+ }
+ else
+diff --git a/gcc/cp/method.c b/gcc/cp/method.c
+index 936dad42122..fd023e20053 100644
+--- a/gcc/cp/method.c
++++ b/gcc/cp/method.c
+@@ -2380,7 +2380,7 @@ lazily_declare_fn (special_function_kind sfk, tree type)
+ {
+ if (classtype_has_move_assign_or_move_ctor_p (type, true))
+ DECL_DELETED_FN (fn) = true;
+- else if (classtype_has_user_copy_or_dtor (type))
++ else if (classtype_has_depr_implicit_copy (type))
+ /* The implicit definition of a copy constructor as defaulted is
+ deprecated if the class has a user-declared copy assignment operator
+ or a user-declared destructor. The implicit definition of a copy
+diff --git a/gcc/testsuite/g++.dg/cpp0x/depr-copy1.C b/gcc/testsuite/g++.dg/cpp0x/depr-copy1.C
+index d33c6dc667d..bbb81303925 100644
+--- a/gcc/testsuite/g++.dg/cpp0x/depr-copy1.C
++++ b/gcc/testsuite/g++.dg/cpp0x/depr-copy1.C
+@@ -6,7 +6,7 @@
+ of this International Standard, these implicit definitions could become
+ deleted (11.4). */
+
+-// { dg-additional-options -Wdeprecated-copy }
++// { dg-additional-options -Wdeprecated-copy-dtor }
+
+ struct X
+ {
+