From patchwork Fri Oct 27 09:28:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 831149 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-465310-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="n24oapiX"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yNdpZ16DQz9t2h for ; Fri, 27 Oct 2017 20:28:21 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=I41OZ4y8bCgJGjRyZnvDDZdaFDChjcKqlLAUmLimmqQQ2CEOVG do9AVr845PYco3zkhi+KVlxCzyTYk92i+z3VqCk3GsoCDuIAEayUT3pzWCHs0LYI BEK6oaD5gGgGJDczPZyUA36mRfF+ZkNGl0IAJhGiadKynKm342M4+BbKI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=1OZl0Txu8hcS79hMgiTkc7cgM9A=; b=n24oapiX+BIfq8IQPTCy HB423n5Xp/GDNzW6XPCQZw2uMx6saNHmc6C5lS3RSKO5b0hEwSkfNOP5/44wCWEY kMzB9H/tARpYfQDTogp2JvW1DjuE6YMRgwUmnrH8us2UIkDsOSKI6rjhP1k5cjFC Uasrtn35O3wzVW3qmHiUEPA= Received: (qmail 37410 invoked by alias); 27 Oct 2017 09:28:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 37347 invoked by uid 89); 27 Oct 2017 09:28:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: aserp1040.oracle.com Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Oct 2017 09:28:11 +0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v9R9S9Hn029910 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 27 Oct 2017 09:28:09 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v9R9S8J0029654 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 27 Oct 2017 09:28:09 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v9R9S8Ii031062 for ; Fri, 27 Oct 2017 09:28:08 GMT Received: from [192.168.1.4] (/82.61.149.169) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 27 Oct 2017 02:28:08 -0700 To: "gcc-patches@gcc.gnu.org" From: Paolo Carlini Subject: [C++ Patch, obvious] Change invalid_nontype_parm_type_p to return a bool Message-ID: <12cf5bf4-f8d8-b2fd-8545-4780b520c0f9@oracle.com> Date: Fri, 27 Oct 2017 11:28:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, today I noticed once more that the function pointlessly still returns an int instead of a bool. Unless somebody complaints, I'm going to apply the below. Tested x86_64-linux. Thanks, Paolo. //////////////////// 2017-10-27 Paolo Carlini * pt.c (invalid_nontype_parm_type_p): Return a bool instead of an int. Index: pt.c =================================================================== --- pt.c (revision 254136) +++ pt.c (working copy) @@ -203,7 +203,7 @@ static void tsubst_default_arguments (tree, tsubst static tree for_each_template_parm_r (tree *, int *, void *); static tree copy_default_args_to_explicit_spec_1 (tree, tree); static void copy_default_args_to_explicit_spec (tree); -static int invalid_nontype_parm_type_p (tree, tsubst_flags_t); +static bool invalid_nontype_parm_type_p (tree, tsubst_flags_t); static bool dependent_template_arg_p (tree); static bool any_template_arguments_need_structural_equality_p (tree); static bool dependent_type_p_r (tree); @@ -23618,31 +23618,31 @@ instantiating_current_function_p (void) } /* [temp.param] Check that template non-type parm TYPE is of an allowable - type. Return zero for ok, nonzero for disallowed. Issue error and - warning messages under control of COMPLAIN. */ + type. Return false for ok, true for disallowed. Issue error and + inform messages under control of COMPLAIN. */ -static int +static bool invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain) { if (INTEGRAL_OR_ENUMERATION_TYPE_P (type)) - return 0; + return false; else if (POINTER_TYPE_P (type)) - return 0; + return false; else if (TYPE_PTRMEM_P (type)) - return 0; + return false; else if (TREE_CODE (type) == TEMPLATE_TYPE_PARM) - return 0; + return false; else if (TREE_CODE (type) == TYPENAME_TYPE) - return 0; + return false; else if (TREE_CODE (type) == DECLTYPE_TYPE) - return 0; + return false; else if (TREE_CODE (type) == NULLPTR_TYPE) - return 0; + return false; /* A bound template template parm could later be instantiated to have a valid nontype parm type via an alias template. */ else if (cxx_dialect >= cxx11 && TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM) - return 0; + return false; if (complain & tf_error) { @@ -23652,7 +23652,7 @@ invalid_nontype_parm_type_p (tree type, tsubst_fla error ("%q#T is not a valid type for a template non-type parameter", type); } - return 1; + return true; } /* Returns TRUE if TYPE is dependent, in the sense of [temp.dep.type].