From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13867 invoked by alias); 3 Aug 2017 17:34:40 -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 13100 invoked by uid 89); 3 Aug 2017 17:34:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=consuming 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; Thu, 03 Aug 2017 17:34:38 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06ED1539C0; Thu, 3 Aug 2017 17:34:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 06ED1539C0 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=law@redhat.com Received: from localhost.localdomain (ovpn-116-95.phx2.redhat.com [10.3.116.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id A58514FA20; Thu, 3 Aug 2017 17:34:36 +0000 (UTC) Subject: Re: [PATCH 2/3] Matching tokens: C parts (v2) To: David Malcolm , gcc-patches@gcc.gnu.org Cc: Trevor Saunders References: <20170712131300.u3ofifbzkp52lcxa@ball> <1501618904-5593-1-git-send-email-dmalcolm@redhat.com> <1501618904-5593-3-git-send-email-dmalcolm@redhat.com> From: Jeff Law Message-ID: Date: Thu, 03 Aug 2017 17:34:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1501618904-5593-3-git-send-email-dmalcolm@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00340.txt.bz2 On 08/01/2017 02:21 PM, David Malcolm wrote: > Changed in v2: > > * Renamed template argument to traits_t; eliminated subclasses, just > using traits struct. > * Moved enum constants into struct bodies (string constants can't be > without constexpr, which isn't available in C++98). > * Fixed typo. > > OK for trunk? > > gcc/c/ChangeLog: > * c-parser.c (c_parser_error): Rename to... > (c_parser_error_richloc): ...this, making static, and adding > "richloc" parameter, passing it to the c_parse_error call, > rather than calling c_parser_set_source_position_from_token. > (c_parser_error): Reintroduce, reimplementing in terms of the > above, converting return type from void to bool. > (class token_pair): New class. > (struct matching_paren_traits): New struct. > (matching_parens): New typedef. > (struct matching_brace_traits): New struct. > (matching_braces): New typedef. > (get_matching_symbol): New function. > (c_parser_require): Add param MATCHING_LOCATION, using it to > highlight matching "opening" tokens for missing "closing" tokens. > (c_parser_skip_until_found): Likewise. > (c_parser_static_assert_declaration_no_semi): Convert explicit > parsing of CPP_OPEN_PAREN and CPP_CLOSE_PAREN to use of > class matching_parens, so that the pertinent open parenthesis is > highlighted when there are problems locating the close > parenthesis. > (c_parser_struct_or_union_specifier): Likewise. > (c_parser_typeof_specifier): Likewise. > (c_parser_alignas_specifier): Likewise. > (c_parser_simple_asm_expr): Likewise. > (c_parser_braced_init): Likewise, for matching_braces. > (c_parser_paren_condition): Likewise, for matching_parens. > (c_parser_switch_statement): Likewise. > (c_parser_for_statement): Likewise. > (c_parser_asm_statement): Likewise. > (c_parser_asm_operands): Likewise. > (c_parser_cast_expression): Likewise. > (c_parser_sizeof_expression): Likewise. > (c_parser_alignof_expression): Likewise. > (c_parser_generic_selection): Likewise. > (c_parser_postfix_expression): Likewise for cases RID_VA_ARG, > RID_OFFSETOF, RID_TYPES_COMPATIBLE_P, RID_AT_SELECTOR, > RID_AT_PROTOCOL, RID_AT_ENCODE, reindenting as necessary. > In case CPP_OPEN_PAREN, pass loc_open_paren to the > c_parser_skip_until_found call. > (c_parser_objc_class_definition): Use class matching_parens as > above. > (c_parser_objc_method_decl): Likewise. > (c_parser_objc_try_catch_finally_statement): Likewise. > (c_parser_objc_synchronized_statement): Likewise. > (c_parser_objc_at_property_declaration): Likewise. > (c_parser_oacc_wait_list): Likewise. > (c_parser_omp_var_list_parens): Likewise. > (c_parser_omp_clause_collapse): Likewise. > (c_parser_omp_clause_default): Likewise. > (c_parser_omp_clause_if): Likewise. > (c_parser_omp_clause_num_threads): Likewise. > (c_parser_omp_clause_num_tasks): Likewise. > (c_parser_omp_clause_grainsize): Likewise. > (c_parser_omp_clause_priority): Likewise. > (c_parser_omp_clause_hint): Likewise. > (c_parser_omp_clause_defaultmap): Likewise. > (c_parser_oacc_single_int_clause): Likewise. > (c_parser_omp_clause_ordered): Likewise. > (c_parser_omp_clause_reduction): Likewise. > (c_parser_omp_clause_schedule): Likewise. > (c_parser_omp_clause_num_teams): Likewise. > (c_parser_omp_clause_thread_limit): Likewise. > (c_parser_omp_clause_aligned): Likewise. > (c_parser_omp_clause_linear): Likewise. > (c_parser_omp_clause_safelen): Likewise. > (c_parser_omp_clause_simdlen): Likewise. > (c_parser_omp_clause_depend): Likewise. > (c_parser_omp_clause_map): Likewise. > (c_parser_omp_clause_device): Likewise. > (c_parser_omp_clause_dist_schedule): Likewise. > (c_parser_omp_clause_proc_bind): Likewise. > (c_parser_omp_clause_uniform): Likewise. > (c_parser_omp_for_loop): Likewise. > (c_parser_cilk_clause_vectorlength): Likewise. > (c_parser_cilk_clause_linear): Likewise. > (c_parser_transaction_expression): Likewise. > * c-parser.h (c_parser_require): Add param matching_location with > default UNKNOWN_LOCATION. > (c_parser_error): Convert return type from void to bool. > (c_parser_skip_until_found): Add param matching_location with > default UNKNOWN_LOCATION. > > gcc/testsuite/ChangeLog: > * gcc.dg/unclosed-init.c: New test case. Phew. I only spot-checked most of the changes around the new API for requiring the open/close paren/brace/bracket or consuming parens/braces/brackets. They were very mechanical :-) Jeff