Commit d3a02ae5 by Sandra Loosemore Committed by Sandra Loosemore

c.opt (Wmissing-attributes): Clean up doc string.

2019-02-25  Sandra Loosemore  <sandra@codesourcery.com>
	    Martin Sebor  <msebor@gmail.com>

	gcc/
	* c-family/c.opt (Wmissing-attributes): Clean up doc string.
	* common.opt (Wattribute-alias): Likewise.
	* doc/invoke.texi (Option Summary): List general form of
	-Wattribute-alias=.  List positive form of -Wmissing-attributes.
	(-Wmissing-attributes): Invert entry, rewrite and correct default.
	Add cross-references.
	(-Wattribute-alias): Rewrite and correct default.  Mention
	considered attributes (same as for -Wmissing-attributes).

Co-Authored-By: Martin Sebor <msebor@gmail.com>

From-SVN: r269196
parent db739d3c
2019-02-25 Sandra Loosemore <sandra@codesourcery.com>
Martin Sebor <msebor@gmail.com>
* c-family/c.opt (Wmissing-attributes): Clean up doc string.
* common.opt (Wattribute-alias): Likewise.
* doc/invoke.texi (Option Summary): List general form of
-Wattribute-alias=. List positive form of -Wmissing-attributes.
(-Wmissing-attributes): Invert entry, rewrite and correct default.
Add cross-references.
(-Wattribute-alias): Rewrite and correct default. Mention
considered attributes (same as for -Wmissing-attributes).
2019-02-25 Paul A. Clarke <pc@us.ibm.com> 2019-02-25 Paul A. Clarke <pc@us.ibm.com>
[gcc] [gcc]
......
...@@ -818,7 +818,7 @@ Warn on primary template declaration. ...@@ -818,7 +818,7 @@ Warn on primary template declaration.
Wmissing-attributes Wmissing-attributes
C ObjC C++ ObjC++ Var(warn_missing_attributes) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) C ObjC C++ ObjC++ Var(warn_missing_attributes) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
Warn about declarations of entities that may be missing attributes Warn about declarations of entities that may be missing attributes
that related entities have been declared with it. that related entities have been declared with.
Wmissing-format-attribute Wmissing-format-attribute
C ObjC C++ ObjC++ Warning Alias(Wsuggest-attribute=format) C ObjC C++ ObjC++ Warning Alias(Wsuggest-attribute=format)
......
...@@ -552,11 +552,11 @@ Warn about inappropriate attribute usage. ...@@ -552,11 +552,11 @@ Warn about inappropriate attribute usage.
Wattribute-alias Wattribute-alias
Common Alias(Wattribute_alias=, 1, 0) Warning Common Alias(Wattribute_alias=, 1, 0) Warning
Warn about type safety and similar errors and mismatches in attribute alias and related. Warn about type safety and similar errors and mismatches in declarations with alias attributes.
Wattribute-alias= Wattribute-alias=
Common Joined RejectNegative UInteger Var(warn_attribute_alias) Init(1) Warning IntegerRange(0, 2) Common Joined RejectNegative UInteger Var(warn_attribute_alias) Init(1) Warning IntegerRange(0, 2)
Warn about type safety and similar errors and mismatches in attribute alias and related. Warn about type safety and similar errors and mismatches in declarations with alias attributes.
Wcannot-profile Wcannot-profile
Common Var(warn_cannot_profile) Init(1) Warning Common Var(warn_cannot_profile) Init(1) Warning
......
...@@ -288,7 +288,7 @@ Objective-C and Objective-C++ Dialects}. ...@@ -288,7 +288,7 @@ Objective-C and Objective-C++ Dialects}.
-Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
-Walloca -Walloca-larger-than=@var{byte-size} @gol -Walloca -Walloca-larger-than=@var{byte-size} @gol
-Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
-Wno-attributes -Wno-attribute-alias @gol -Wno-attributes -Wattribute-alias=@var{n} @gol
-Wbool-compare -Wbool-operation @gol -Wbool-compare -Wbool-operation @gol
-Wno-builtin-declaration-mismatch @gol -Wno-builtin-declaration-mismatch @gol
-Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
...@@ -322,7 +322,7 @@ Objective-C and Objective-C++ Dialects}. ...@@ -322,7 +322,7 @@ Objective-C and Objective-C++ Dialects}.
-Winvalid-pch -Wlarger-than=@var{byte-size} @gol -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
-Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
-Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
-Wmisleading-indentation -Wno-missing-attributes -Wmissing-braces @gol -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
-Wmissing-field-initializers -Wmissing-format-attribute @gol -Wmissing-field-initializers -Wmissing-format-attribute @gol
-Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
-Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
...@@ -5056,7 +5056,7 @@ about the layout of the file that the directive references. ...@@ -5056,7 +5056,7 @@ about the layout of the file that the directive references.
This warning is enabled by @option{-Wall} in C and C++. This warning is enabled by @option{-Wall} in C and C++.
@item -Wno-missing-attributes @item -Wmissing-attributes
@opindex Wmissing-attributes @opindex Wmissing-attributes
@opindex Wno-missing-attributes @opindex Wno-missing-attributes
Warn when a declaration of a function is missing one or more attributes Warn when a declaration of a function is missing one or more attributes
...@@ -5064,10 +5064,10 @@ that a related function is declared with and whose absence may adversely ...@@ -5064,10 +5064,10 @@ that a related function is declared with and whose absence may adversely
affect the correctness or efficiency of generated code. For example, affect the correctness or efficiency of generated code. For example,
the warning is issued for declarations of aliases that use attributes the warning is issued for declarations of aliases that use attributes
to specify less restrictive requirements than those of their targets. to specify less restrictive requirements than those of their targets.
This typically represents a potential optimization oportunity rather This typically represents a potential optimization opportunity.
than a hidden bug. The @option{-Wattribute-alias} option controls warnings By contrast, the @option{-Wattribute-alias=2} option controls warnings
issued for mismatches between declarations of aliases and their targets issued when the alias is more restrictive than the target, which could
that might be indicative of code generation bugs. lead to incorrect code generation.
Attributes considered include @code{alloc_align}, @code{alloc_size}, Attributes considered include @code{alloc_align}, @code{alloc_size},
@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc}, @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure}, @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
...@@ -5080,6 +5080,13 @@ or @code{nonnull} is declared without it. Attributes @code{deprecated}, ...@@ -5080,6 +5080,13 @@ or @code{nonnull} is declared without it. Attributes @code{deprecated},
@code{error}, and @code{warning} suppress the warning. @code{error}, and @code{warning} suppress the warning.
(@pxref{Function Attributes}). (@pxref{Function Attributes}).
You can use the @code{copy} attribute to apply the same
set of attributes to a declaration as that on another declaration without
explicitly enumerating the attributes. This attribute can be applied
to declarations of functions (@pxref{Common Function Attributes}),
variables (@pxref{Common Variable Attributes}), or types
(@pxref{Common Type Attributes}).
@option{-Wmissing-attributes} is enabled by @option{-Wall}. @option{-Wmissing-attributes} is enabled by @option{-Wall}.
For example, since the declaration of the primary function template For example, since the declaration of the primary function template
...@@ -6107,7 +6114,6 @@ false positives and is deactivated by default. ...@@ -6107,7 +6114,6 @@ false positives and is deactivated by default.
Warn about declarations using the @code{alias} and similar attributes whose Warn about declarations using the @code{alias} and similar attributes whose
target is incompatible with the type of the alias. target is incompatible with the type of the alias.
@xref{Function Attributes,,Declaring Attributes of Functions}. @xref{Function Attributes,,Declaring Attributes of Functions}.
The @option{-Wattribute-alias=1} is enabled by @option{-Wall}.
@table @gcctabopt @table @gcctabopt
@item -Wattribute-alias=1 @item -Wattribute-alias=1
...@@ -6116,13 +6122,26 @@ incompatibilities between the type of the alias declaration and that of its ...@@ -6116,13 +6122,26 @@ incompatibilities between the type of the alias declaration and that of its
target. Such incompatibilities are typically indicative of bugs. target. Such incompatibilities are typically indicative of bugs.
@item -Wattribute-alias=2 @item -Wattribute-alias=2
At this level @option{-Wattribute-alias} also diagnoses mismatches between
the set of attributes of the alias declaration and the attributes applied At this level @option{-Wattribute-alias} also diagnoses cases where
to its target. Although in some cases such mismatches may indicate bugs, the attributes of the alias declaration are more restrictive than the
in other cases they may be benign and could be resolved simply by adding attributes applied to its target. These mismatches can potentially
the missing attribute to the target. result in incorrect code generation. In other cases they may be
benign and could be resolved simply by adding the missing attribute to
the target. For comparison, see the @option{-Wmissing-attributes}
option, which controls diagnostics when the alias declaration is less
restrictive than the target, rather than more restrictive.
Attributes considered include @code{alloc_align}, @code{alloc_size},
@code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
@code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
@code{returns_nonnull}, and @code{returns_twice}.
@end table @end table
@option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
This is the default. You can disable these warnings with either
@option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
@item -Wbool-compare @item -Wbool-compare
@opindex Wno-bool-compare @opindex Wno-bool-compare
@opindex Wbool-compare @opindex Wbool-compare
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment