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
This commit is contained in:
Marek Polacek 2016-03-23 17:51:56 +00:00 committed by Marek Polacek
parent d79ee5242b
commit fbdb6bafe2
9 changed files with 49 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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" }

View File

@ -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>;