From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78432 invoked by alias); 11 Dec 2018 22:52:34 -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 78415 invoked by uid 89); 11 Dec 2018 22:52:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 22:52:32 +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 C1E6E307CDC2; Tue, 11 Dec 2018 22:52:30 +0000 (UTC) Received: from redhat.com (unknown [10.20.4.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C371160C5C; Tue, 11 Dec 2018 22:52:29 +0000 (UTC) Date: Tue, 11 Dec 2018 22:52:00 -0000 From: Marek Polacek To: Martin Sebor Cc: Jakub Jelinek , "Joseph S. Myers" , 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: <20181211225228.GZ21364@redhat.com> References: <0f3f1395-adac-8b5f-82e4-e656bf1207fb@gmail.com> <20181211071726.GI12380@tucnak> <20181211204745.GB12380@tucnak> <2b1b9cf1-9e24-7705-aaa8-83d336a53a75@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2b1b9cf1-9e24-7705-aaa8-83d336a53a75@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2018-12/txt/msg00748.txt.bz2 On Tue, Dec 11, 2018 at 03:46:37PM -0700, Martin Sebor wrote: > On 12/11/18 1:47 PM, Jakub Jelinek wrote: > > 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++. > > I missed that. It seems needlessly restrictive to me to reject > the preferred kind of an enum when ordinary enums are accepted. > Jason, can you confirm that you really want a warning for B > below when there is none for A (GCC 8 doesn't complain about > either, Clang complains about both, ICC about neither when > using alloc_size -- it doesn't understand alloc_align): > > enum A { /* ... */ }; > __attribute__ ((alloc_align (1))) void* f (A); > > enum class B { /* ... */ }; > __attribute__ ((alloc_align (1))) void* g (B); > > The only use case I can think of for enums is in APIs that try > to restrict the available choices of alignment to those of > the enumerators. In that use case, I would expect it to make > no difference whether the enum is ordinary or the scoped kind. The reason was that C++ scoped enumerations don't implicitly convert to integral types. Marek