aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2016-03-23 17:51:56 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2016-03-23 17:51:56 +0000
commitfbdb6bafe2be0f4e12b85dcb92641bb55078bf72 (patch)
tree55a022f1d1e1e1278f5c5e34b3e2da9f4195fea0
parentd79ee5242bfcf2479658bf5450369d6856cc4904 (diff)
downloadgcc-fbdb6bafe2be0f4e12b85dcb92641bb55078bf72.zip
gcc-fbdb6bafe2be0f4e12b85dcb92641bb55078bf72.tar.gz
gcc-fbdb6bafe2be0f4e12b85dcb92641bb55078bf72.tar.bz2
re PR c++/69884 (warning: ignoring attributes on template argument)
PR c++/69884 * c.opt (Wignored-attributes): New option. * pt.c (canonicalize_type_argument): Use OPT_Wignored_attributes. * doc/invoke.texi: Document -Wignored-attributes. * g++.dg/warn/Wignored-attributes-1.C: New test. * g++.dg/warn/Wignored-attributes-2.C: New test. From-SVN: r234433
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c.opt4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c3
-rw-r--r--gcc/doc/invoke.texi10
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/warn/Wignored-attributes-1.C6
-rw-r--r--gcc/testsuite/g++.dg/warn/Wignored-attributes-2.C7
9 files changed, 49 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a100ff1..1b102c5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-23 Marek Polacek <polacek@redhat.com>
+
+ PR c++/69884
+ * doc/invoke.texi: Document -Wignored-attributes.
+
2016-03-23 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/69042
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 9944759..c1188d7 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-23 Marek Polacek <polacek@redhat.com>
+
+ PR c++/69884
+ * c.opt (Wignored-attributes): New option.
+
2016-03-22 David Malcolm <dmalcolm@redhat.com>
PR c/69993
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 7c5f6c7..4f86876 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -482,6 +482,10 @@ Wignored-qualifiers
C C++ Var(warn_ignored_qualifiers) Warning EnabledBy(Wextra)
Warn whenever type qualifiers are ignored.
+Wignored-attributes
+C C++ Var(warn_ignored_attributes) Init(1) Warning
+Warn whenever attributes are ignored.
+
Wincompatible-pointer-types
C ObjC Var(warn_incompatible_pointer_types) Init(1) Warning
Warn when there is a conversion between pointers that have incompatible types.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6557f90..d361689 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-23 Marek Polacek <polacek@redhat.com>
+
+ PR c++/69884
+ * pt.c (canonicalize_type_argument): Use OPT_Wignored_attributes.
+
2016-03-22 Ilya Enkovich <enkovich.gnu@gmail.com>
* call.c (build_conditional_expr_1): Always use original
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 45cd1ea..6837438 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6950,7 +6950,8 @@ canonicalize_type_argument (tree arg, tsubst_flags_t complain)
tree canon = strip_typedefs (arg, &removed_attributes);
if (removed_attributes
&& (complain & tf_warning))
- warning (0, "ignoring attributes on template argument %qT", arg);
+ warning (OPT_Wignored_attributes,
+ "ignoring attributes on template argument %qT", arg);
return canon;
}
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 99ac11b..9e54bb7 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -267,7 +267,7 @@ Objective-C and Objective-C++ Dialects}.
-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
-Wformat-security -Wformat-signedness -Wformat-y2k -Wframe-address @gol
-Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
--Wignored-qualifiers -Wincompatible-pointer-types @gol
+-Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
-Winit-self -Winline -Wno-int-conversion @gol
-Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
@@ -3886,6 +3886,14 @@ even without this option.
This warning is also enabled by @option{-Wextra}.
+@item -Wignored-attributes @r{(C and C++ only)}
+@opindex Wignored-attributes
+@opindex Wno-ignored-attributes
+Warn when an attribute is ignored. This is different from the
+@option{-Wattributes} option in that it warns whenever the compiler decides
+to drop an attribute, not that the attribute is either unknown, used in a
+wrong place, etc. This warning is enabled by default.
+
@item -Wmain
@opindex Wmain
@opindex Wno-main
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7ce1d28..93b7312 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-23 Marek Polacek <polacek@redhat.com>
+
+ PR c++/69884
+ * g++.dg/warn/Wignored-attributes-1.C: New test.
+ * g++.dg/warn/Wignored-attributes-2.C: New test.
+
2016-03-23 Tom de Vries <tom@codesourcery.com>
* c-c++-common/goacc/kernels-default.c (foo): Add missing
diff --git a/gcc/testsuite/g++.dg/warn/Wignored-attributes-1.C b/gcc/testsuite/g++.dg/warn/Wignored-attributes-1.C
new file mode 100644
index 0000000..46ccc4a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wignored-attributes-1.C
@@ -0,0 +1,6 @@
+// PR c++/69884
+// { dg-do compile }
+
+typedef float __m128 __attribute__((__vector_size__(16), __may_alias__));
+template <typename> struct A;
+template <> struct A<__m128>; // { dg-warning "ignoring attributes on template argument" }
diff --git a/gcc/testsuite/g++.dg/warn/Wignored-attributes-2.C b/gcc/testsuite/g++.dg/warn/Wignored-attributes-2.C
new file mode 100644
index 0000000..6431607
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wignored-attributes-2.C
@@ -0,0 +1,7 @@
+// PR c++/69884
+// { dg-do compile }
+// { dg-options "-Wno-ignored-attributes" }
+
+typedef float __m128 __attribute__((__vector_size__(16), __may_alias__));
+template <typename> struct A;
+template <> struct A<__m128>;