From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 7AE1638293E4 for ; Sun, 29 May 2022 19:55:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7AE1638293E4 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-631-X_Z3kVYhN5iBhfZIdx5bVw-1; Sun, 29 May 2022 15:55:03 -0400 X-MC-Unique: X_Z3kVYhN5iBhfZIdx5bVw-1 Received: by mail-qv1-f71.google.com with SMTP id kj4-20020a056214528400b0044399a9bb4cso6978170qvb.15 for ; Sun, 29 May 2022 12:55:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=BPAuEySIzJ0O+PUgEYgt+BGSH3RE3ZAQ9nizMbHraEg=; b=YwuWk1oJqmIFE4GqVaH45NlYoiDvh5pCVWCg81KdKv+99+k4wRxv2RmbVrpUlmGB+8 f6y7aVyVDwzkTqUXOeCoTONjMeBJZXUVhodGoH+0RRXhKWXXXujhtHUzVKqUVEn1EPIh g4ufmzGwgfZ9VUAW36IXBS8M8Z25rWBOx0kGlBFjiHy2GfrjGSb63T/wNDKOfHERirEq L49VEs4Y1e0J88zDsjsHFyPcSvj/H56dmx1q6PLeOxiY4tH83aCsRDnUpEL17xsSHBFn JIXw7oOWx8j7DilTJNL4jCJ7F3z+q0kUAlJG/2/vKlIIfZH/l55PZHnFPrmohZpwHpEH ZB/w== X-Gm-Message-State: AOAM533fJNhvyPxnZLfX1OxsKbEtDQ5yZii5r44flvkvFs/s2pRVHiQN Wg4Jb9Dy882coqMx6EV+3IK45WjV5tZ5ktfSR1fIDtUwKmApCMw7UjiJwuQyKhru8SYFiu6DrVz kFOsEKR3qGRgfuESlGg== X-Received: by 2002:a05:6214:27e4:b0:462:5003:add6 with SMTP id jt4-20020a05621427e400b004625003add6mr24756994qvb.10.1653854102758; Sun, 29 May 2022 12:55:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhwOfJm9dUENAW4oGBGIFpga6gJKrn36WrsXBSgg2//DXETQAewIqnn9oS2fojJmOLldSTMw== X-Received: by 2002:a05:6214:27e4:b0:462:5003:add6 with SMTP id jt4-20020a05621427e400b004625003add6mr24756979qvb.10.1653854102465; Sun, 29 May 2022 12:55:02 -0700 (PDT) Received: from [192.168.1.100] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id o16-20020a05620a0d5000b006a34bdb0c36sm6224528qkl.31.2022.05.29.12.55.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 May 2022 12:55:01 -0700 (PDT) Message-ID: Date: Sun, 29 May 2022 15:55:01 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] c++: document comp_template_args's default args To: Patrick Palka , gcc-patches@gcc.gnu.org References: <20220527180732.2909166-1-ppalka@redhat.com> From: Jason Merrill In-Reply-To: <20220527180732.2909166-1-ppalka@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 May 2022 19:55:06 -0000 On 5/27/22 14:07, Patrick Palka wrote: > In passing, use bool for its return type. OK. > gcc/cp/ChangeLog: > > * cp-tree.h (comp_template_args): Change return type to bool. > * pt.cc (comp_template_args): Document default arguments. > Change return type to bool and adjust returns accordingly. > --- > gcc/cp/cp-tree.h | 2 +- > gcc/cp/pt.cc | 24 +++++++++++------------- > 2 files changed, 12 insertions(+), 14 deletions(-) > > diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h > index d77fd1eb8a9..da8898155e0 100644 > --- a/gcc/cp/cp-tree.h > +++ b/gcc/cp/cp-tree.h > @@ -7327,7 +7327,7 @@ extern tree get_template_info (const_tree); > extern int template_class_depth (tree); > extern int is_specialization_of (tree, tree); > extern bool is_specialization_of_friend (tree, tree); > -extern int comp_template_args (tree, tree, tree * = NULL, > +extern bool comp_template_args (tree, tree, tree * = NULL, > tree * = NULL, bool = false); > extern int template_args_equal (tree, tree, bool = false); > extern tree maybe_process_partial_specialization (tree); > diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc > index ec168234325..b5064990857 100644 > --- a/gcc/cp/pt.cc > +++ b/gcc/cp/pt.cc > @@ -9368,27 +9368,25 @@ template_args_equal (tree ot, tree nt, bool partial_order /* = false */) > } > } > > -/* Returns 1 iff the OLDARGS and NEWARGS are in fact identical sets of > - template arguments. Returns 0 otherwise, and updates OLDARG_PTR and > +/* Returns true iff the OLDARGS and NEWARGS are in fact identical sets of > + template arguments. Returns false otherwise, and updates OLDARG_PTR and > NEWARG_PTR with the offending arguments if they are non-NULL. */ > > -int > +bool > comp_template_args (tree oldargs, tree newargs, > - tree *oldarg_ptr, tree *newarg_ptr, > - bool partial_order) > + tree *oldarg_ptr /* = NULL */, tree *newarg_ptr /* = NULL */, > + bool partial_order /* = false */) > { > - int i; > - > if (oldargs == newargs) > - return 1; > + return true; > > if (!oldargs || !newargs) > - return 0; > + return false; > > if (TREE_VEC_LENGTH (oldargs) != TREE_VEC_LENGTH (newargs)) > - return 0; > + return false; > > - for (i = 0; i < TREE_VEC_LENGTH (oldargs); ++i) > + for (int i = 0; i < TREE_VEC_LENGTH (oldargs); ++i) > { > tree nt = TREE_VEC_ELT (newargs, i); > tree ot = TREE_VEC_ELT (oldargs, i); > @@ -9399,10 +9397,10 @@ comp_template_args (tree oldargs, tree newargs, > *oldarg_ptr = ot; > if (newarg_ptr != NULL) > *newarg_ptr = nt; > - return 0; > + return false; > } > } > - return 1; > + return true; > } > > inline bool