On Tue, Dec 11, 2018 at 01:36:58PM -0700, Martin Sebor wrote:
> Attached is an updated version of the patch that restores
> the original behavior for the positional argument validation
> (i.e., prior to r266195) for integral types except bool as
> discussed.

I thought Jason wanted to also warn for scoped enums in C++.

> +      else if (code == INTEGER_TYPE)
> +     /* For integers, accept enums, wide characters and other types
> +        that match INTEGRAL_TYPE_P except for bool.  */
> +     type_match = (INTEGRAL_TYPE_P (argtype)
> +                   && TREE_CODE (argtype) != BOOLEAN_TYPE);

So it would better be:
        type_match = (TREE_CODE (argtype) == INTEGER_TYPE
                      || (TREE_CODE (argtype) == ENUMERAL_TYPE
                          && !ENUM_IS_SCOPED (argtype)));

> --- gcc/doc/extend.texi       (revision 266966)
> +++ gcc/doc/extend.texi       (working copy)
> @@ -2471,7 +2471,9 @@ The @code{aligned} attribute can also be used for
>  @item alloc_align (@var{position})
>  @cindex @code{alloc_align} function attribute
>  The @code{alloc_align} attribute may be applied to a function that
> -returns a pointer and takes at least one argument of an integer type.
> +returns a pointer and takes at least one argument of an integer or
> +enumerated type, but not @code{bool}.  Arguments of other types are
> +diagnosed.

The keyword is _Bool in C, so wouldn't it be better to say but not Boolean
type or but not @code{bool} or @code{_Bool}?
And it should mention the scoped enumeration types for C++ too
(+ testsuite coverage for them).

        Jakub

Reply via email to