On Fri, 31 Aug 2018, Vinay Kumar wrote:
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index 1fbcbd5..8dc9fb4 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,3 +1,8 @@
> +2018-08-31 Vinay Kumar <[email protected]>
> +
> + * doc/invoke.texi (-Wreturn-type): Document new warning
> + -Wprio-ctor-dtor.
The documentation is of a new option, not of -Wreturn-type, so the
ChangeLog entry should name the option being documented or the section to
which the documentation is added.
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 637f5ad..49678d7 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -294,7 +294,7 @@ Objective-C and Objective-C++ Dialects}.
> -Wdisabled-optimization @gol
> -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
> -Wno-div-by-zero -Wdouble-promotion @gol
> --Wduplicated-branches -Wduplicated-cond @gol
> +-Wprio-ctor-dtor -Wduplicated-branches -Wduplicated-cond @gol
Please see where invoke.texi says:
Many options have long names starting with @samp{-f} or with
@samp{-W}---for example,
@option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
these have both positive and negative forms; the negative form of
@option{-ffoo} is @option{-fno-foo}. This manual documents
only one of these two forms, whichever one is not the default.
Thus, you should list the option as -Wno-prio-ctor-dtor when documenting
it.
This list appears to be in alphabetical order (ignoring the "no-"), so the
natural place for this option in this list would be after -Wno-pragmas.
> +@item -Wprio-ctor-dtor
And likewise here. See other such options, e.g. -Wno-attributes, for
examples.
> +@opindex Wno-prio-ctor-dtor
> +@opindex Wprio-ctor-dtor
> +Warn if a priority from 0 to 100 is used for constructor or destructor.
And then you need to say "Do not warn", to be consistent with documenting
the negative form of the option.
> +The use of constructor and destructor attributes allow you to assign a
> +priority to the constructor/destructor to control its order of execution
> +before @code{main}, no () is called or after it returns. The priority
You're not meant to have the literal text ", no ()" in the manual. The
point of my ", no ()" in the review comments is to draw attention to the
point in the GNU Coding Standards that you don't put "()" after the name
of a function to indicate that it's a function, because putting "()" there
means a function call with no arguments.
> + * c-c++-common/Wprio-ctor-dtor.c: New test.
> + * g++.dg/warn/Wprio-ctor-dtor.C: New test.
Given that you have a c-c++-common test, I don't see why a g++.dg one is
needed as well; it appears to be testing the same thing.
--
Joseph S. Myers
[email protected]