The list of -Wsuggest-attribute= variants was out of date in the option summary (and getting too long to fit on one line), and an index entry was missing for -Wsuggest-attribute=returns_nonnull.
gcc/c-family/ChangeLog PR c/115532 * c.opt.urls: Regenerated. gcc/ChangeLog PR c/115532 * common.opt.urls: Regenerated. * doc/invoke.texi (Option Summary): Don't try to list all the -Wsuggest-attribute= variants inline here. (Warning Options): Likewise. Add @opindex for Wsuggest-attribute=returns_nonnull and its no- form. Remove @itemx for no- form. Co-Authored-By: Peter Eisentraut <pe...@eisentraut.org> --- gcc/c-family/c.opt.urls | 3 --- gcc/common.opt.urls | 6 ++++++ gcc/doc/invoke.texi | 12 +++++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/gcc/c-family/c.opt.urls b/gcc/c-family/c.opt.urls index 8fbe3bd2698..6c08b0ae052 100644 --- a/gcc/c-family/c.opt.urls +++ b/gcc/c-family/c.opt.urls @@ -864,9 +864,6 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-system-headers) Wtemplates UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-templates) -Wtautological-compare -UrlSuffix(gcc/Warning-Options.html#index-Wno-tautological-compare) - Wtemplate-body UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-template-body) diff --git a/gcc/common.opt.urls b/gcc/common.opt.urls index 773c021dd94..577e00d7a27 100644 --- a/gcc/common.opt.urls +++ b/gcc/common.opt.urls @@ -223,6 +223,9 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-suggest-attribute_003dnoreturn) Wsuggest-attribute=malloc UrlSuffix(gcc/Warning-Options.html#index-Wno-suggest-attribute_003dmalloc) +Wsuggest-attribute=returns_nonnull +UrlSuffix(gcc/Warning-Options.html#index-Wno-suggest-attribute_003dreturns_005fnonnull) + Wsuggest-final-types UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-suggest-final-types) @@ -235,6 +238,9 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-switch-unreachable) Wsystem-headers UrlSuffix(gcc/Warning-Options.html#index-Wno-system-headers) +Wtautological-compare +UrlSuffix(gcc/Warning-Options.html#index-Wno-tautological-compare) + Wtrampolines UrlSuffix(gcc/Warning-Options.html#index-Wno-trampolines) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index b85084459b1..67a3c8fd91e 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -416,7 +416,7 @@ Objective-C and Objective-C++ Dialects}. -Wstring-compare -Wno-stringop-overflow -Wno-stringop-overread -Wno-stringop-truncation -Wstrict-flex-arrays --Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} +-Wsuggest-attribute=@var{attribute-name} -Wswitch -Wno-switch-bool -Wswitch-default -Wswitch-enum -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand -Wsystem-headers -Wtautological-compare -Wtrailing-whitespace @@ -8354,9 +8354,9 @@ even without optimization. @opindex Wsuggest-attribute= @opindex Wno-suggest-attribute= -@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}returns_nonnull@r{|} +@item -Wsuggest-attribute=@var{attribute-name} Warn for cases where adding an attribute may be beneficial. The -attributes currently supported are listed below. +@var{attribute-name}s currently supported are listed below. @table @gcctabopt @opindex Wsuggest-attribute=pure @@ -8369,16 +8369,18 @@ attributes currently supported are listed below. @opindex Wno-missing-noreturn @opindex Wsuggest-attribute=malloc @opindex Wno-suggest-attribute=malloc +@opindex Wsuggest-attribute=returns_nonnull +@opindex Wno-suggest-attribute=returns_nonnull @item -Wsuggest-attribute=pure @itemx -Wsuggest-attribute=const @itemx -Wsuggest-attribute=noreturn @itemx -Wmissing-noreturn @itemx -Wsuggest-attribute=malloc @itemx -Wsuggest-attribute=returns_nonnull -@itemx -Wno-suggest-attribute=returns_nonnull Warn about functions that might be candidates for attributes -@code{pure}, @code{const}, @code{noreturn}, @code{malloc} or @code{returns_nonnull}. The compiler +@code{pure}, @code{const}, @code{noreturn}, @code{malloc} or +@code{returns_nonnull}. The compiler only warns for functions visible in other compilation units or (in the case of @code{pure} and @code{const}) if it cannot prove that the function returns normally. A function returns normally if it doesn't contain an infinite loop or -- 2.25.1