From patchwork Tue Jul 31 11:16:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 174216 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id C77F92C0086 for ; Tue, 31 Jul 2012 21:16:48 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1344338210; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Message-ID:Date:From:User-Agent:MIME-Version: To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=Hh+Jd8tpMkCbB2ICV9tHAwE/+1I=; b=EHes61Pc9SfTEgG r1gWEY9pOsVlblM42lO+a0uVoqlF9w+fWhUX2rZa62TsB8oDcN0NfThPcQt7AC+/ KjLjn5urUTiI0jOBr6N2u6uuArXe5RzrItchUr2nQ3P/ulzDjr0+QoWdVKledi24 dY8gQH0PUjsuTXvfh4qdLniyfw8E= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=erC3xA+eVQuo1cCXnR9RCuVHGJbSNTb06k/FIFdgDB9u2+6lDbezdlCJjDlUxp CD42SuyY2viYJYtxNCj6WWUZOqeancWCHpvvAIK6PmygJgw/tyMSMLmWSKeBhsjk MPa/EnbxHL/PRWLfPZQ5S0t3zBUBVWDFErsKLkypTjOyA=; Received: (qmail 22489 invoked by alias); 31 Jul 2012 11:16:46 -0000 Received: (qmail 22480 invoked by uid 22791); 31 Jul 2012 11:16:45 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_W, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from acsinet15.oracle.com (HELO acsinet15.oracle.com) (141.146.126.227) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 31 Jul 2012 11:16:32 +0000 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q6VBGUaH011040 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 31 Jul 2012 11:16:31 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q6VBGTA8014154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 Jul 2012 11:16:29 GMT Received: from abhmt107.oracle.com (abhmt107.oracle.com [141.146.116.59]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q6VBGQu9024768; Tue, 31 Jul 2012 06:16:26 -0500 Received: from [192.168.1.4] (/79.33.220.142) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 31 Jul 2012 04:16:25 -0700 Message-ID: <5017BE87.4040609@oracle.com> Date: Tue, 31 Jul 2012 13:16:23 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] Mini int -> bool clean up X-IsSubscribed: yes 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 Hi, noticed yesterday, booted & tested x86_64-linux. Ok? Thanks, Paolo. ////////////////////// 2012-07-31 Paolo Carlini * pt.c (check_default_tmpl_args): Change is_primary and is_partial parameters to bool type, adjust. (push_template_decl_real): Tidy. * parser.c (cp_parser_init_declarator): Adjust. * decl.c (redeclaration_error_message): Likewise. * cp-tree.h (check_default_tmpl_args): Update prototype. Index: decl.c =================================================================== --- decl.c (revision 190000) +++ decl.c (working copy) @@ -2480,7 +2480,8 @@ redeclaration_error_message (tree newdecl, tree ol if ((cxx_dialect != cxx98) && TREE_CODE (ot) == FUNCTION_DECL && DECL_FRIEND_P (ot) && !check_default_tmpl_args (nt, DECL_TEMPLATE_PARMS (newdecl), - /*is_primary=*/1, /*is_partial=*/0, + /*is_primary=*/true, + /*is_partial=*/false, /*is_friend_decl=*/2)) return G_("redeclaration of friend %q#D " "may not have default template arguments"); Index: pt.c =================================================================== --- pt.c (revision 190001) +++ pt.c (working copy) @@ -4210,10 +4210,9 @@ process_partial_specialization (tree decl) /* Check that a template declaration's use of default arguments and parameter packs is not invalid. Here, PARMS are the template - parameters. IS_PRIMARY is nonzero if DECL is the thing declared by - a primary template. IS_PARTIAL is nonzero if DECL is a partial + parameters. IS_PRIMARY is true if DECL is the thing declared by + a primary template. IS_PARTIAL is true if DECL is a partial specialization. - IS_FRIEND_DECL is nonzero if DECL is a friend function template declaration (but not a definition); 1 indicates a declaration, 2 @@ -4223,8 +4222,8 @@ process_partial_specialization (tree decl) Returns TRUE if there were no errors found, FALSE otherwise. */ bool -check_default_tmpl_args (tree decl, tree parms, int is_primary, - int is_partial, int is_friend_decl) +check_default_tmpl_args (tree decl, tree parms, bool is_primary, + bool is_partial, int is_friend_decl) { const char *msg; int last_level_to_check; @@ -4456,8 +4455,8 @@ push_template_decl_real (tree decl, bool is_friend tree args; tree info; tree ctx; - int primary; - int is_partial; + bool is_primary; + bool is_partial; int new_template_p = 0; /* True if the template is a member template, in the sense of [temp.mem]. */ @@ -4499,11 +4498,11 @@ push_template_decl_real (tree decl, bool is_friend /* A friend template that specifies a class context, i.e. template friend void A::f(); is not primary. */ - primary = 0; + is_primary = false; else - primary = template_parm_scope_p (); + is_primary = template_parm_scope_p (); - if (primary) + if (is_primary) { if (DECL_CLASS_SCOPE_P (decl)) member_template_p = true; @@ -4556,7 +4555,7 @@ push_template_decl_real (tree decl, bool is_friend /* Check to see that the rules regarding the use of default arguments are not being violated. */ check_default_tmpl_args (decl, current_template_parms, - primary, is_partial, /*is_friend_decl=*/0); + is_primary, is_partial, /*is_friend_decl=*/0); /* Ensure that there are no parameter packs in the type of this declaration that have not been expanded. */ @@ -4773,7 +4772,7 @@ template arguments to %qD do not match original te } } - if (primary) + if (is_primary) { tree parms = DECL_TEMPLATE_PARMS (tmpl); int i; @@ -4815,7 +4814,7 @@ template arguments to %qD do not match original te SET_TYPE_TEMPLATE_INFO (TREE_TYPE (tmpl), info); else { - if (primary && !DECL_LANG_SPECIFIC (decl)) + if (is_primary && !DECL_LANG_SPECIFIC (decl)) retrofit_lang_decl (decl); if (DECL_LANG_SPECIFIC (decl)) DECL_TEMPLATE_INFO (decl) = info; Index: parser.c =================================================================== --- parser.c (revision 190000) +++ parser.c (working copy) @@ -15849,8 +15849,8 @@ cp_parser_init_declarator (cp_parser* parser, /* Core issue #226 (C++0x only): A default template-argument shall not be specified in a friend class template declaration. */ - check_default_tmpl_args (decl, current_template_parms, /*is_primary=*/1, - /*is_partial=*/0, /*is_friend_decl=*/1); + check_default_tmpl_args (decl, current_template_parms, /*is_primary=*/true, + /*is_partial=*/false, /*is_friend_decl=*/1); if (!friend_p && pushed_scope) pop_scope (pushed_scope); Index: cp-tree.h =================================================================== --- cp-tree.h (revision 190000) +++ cp-tree.h (working copy) @@ -5328,7 +5328,7 @@ extern tree process_template_parm (tree, location extern tree end_template_parm_list (tree); extern void end_template_decl (void); extern tree maybe_update_decl_type (tree, tree); -extern bool check_default_tmpl_args (tree, tree, int, int, int); +extern bool check_default_tmpl_args (tree, tree, bool, bool, int); extern tree push_template_decl (tree); extern tree push_template_decl_real (tree, bool); extern bool redeclare_class_template (tree, tree);