From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52451 invoked by alias); 11 Dec 2018 20:48:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 51731 invoked by uid 89); 11 Dec 2018 20:48:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.9 required=5.0 tests=BAYES_00,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Dec 2018 20:48:01 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0A9AE308A94F; Tue, 11 Dec 2018 20:47:59 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-117-214.ams2.redhat.com [10.36.117.214]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A818160C66; Tue, 11 Dec 2018 20:47:49 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id wBBKllC2006248; Tue, 11 Dec 2018 21:47:47 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id wBBKljkW006247; Tue, 11 Dec 2018 21:47:45 +0100 Date: Tue, 11 Dec 2018 20:48:00 -0000 From: Jakub Jelinek To: Martin Sebor Cc: "Joseph S. Myers" , Marek Polacek , Jason Merrill , Nathan Sidwell , Gcc Patch List Subject: Re: [PATCH] accept all C integer types in function parameters referenced by alloc_align (PR 88363) Message-ID: <20181211204745.GB12380@tucnak> Reply-To: Jakub Jelinek References: <0f3f1395-adac-8b5f-82e4-e656bf1207fb@gmail.com> <20181211071726.GI12380@tucnak> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00741.txt.bz2 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