From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33165 invoked by alias); 19 Dec 2016 16:45:44 -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 33151 invoked by uid 89); 19 Dec 2016 16:45:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1799, Say, Offer, H*MI:sk:1482166 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; Mon, 19 Dec 2016 16:45:42 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E1FFC04B311 for ; Mon, 19 Dec 2016 16:45:41 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-54.ams2.redhat.com [10.36.116.54]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uBJGjclE018421 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 19 Dec 2016 11:45:40 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id uBJGjaE4001904; Mon, 19 Dec 2016 17:45:37 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id uBJGjZmp001903; Mon, 19 Dec 2016 17:45:35 +0100 Date: Mon, 19 Dec 2016 16:46:00 -0000 From: Jakub Jelinek To: David Malcolm Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Offer suggestions for misspelled attributes (PR c/70186) Message-ID: <20161219164535.GT21933@tucnak> Reply-To: Jakub Jelinek References: <1482166289-33945-1-git-send-email-dmalcolm@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1482166289-33945-1-git-send-email-dmalcolm@redhat.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg01620.txt.bz2 Hi! On Mon, Dec 19, 2016 at 11:51:29AM -0500, David Malcolm wrote: > +/* Look for near matches for the scoped attribute with namespace NS and > + name NAME. > + Return the best matching attribute name, or NULL if none is found. > + If it returns non-NULL then *UNDERSCORES is written to, with true > + iff leading and trailing underscores were stripped from NAME > + before the match. */ > + > +static const char * > +fuzzy_lookup_scoped_attribute_spec (const_tree ns, const_tree name, > + bool *underscores) > +{ > + struct substring attr; > + scoped_attributes *attrs; > + > + const char *ns_str = (ns != NULL_TREE) ? IDENTIFIER_POINTER (ns): NULL; > + > + attrs = find_attribute_namespace (ns_str); > + > + if (attrs == NULL) > + return NULL; > + > + attr.str = IDENTIFIER_POINTER (name); > + attr.length = IDENTIFIER_LENGTH (name); > + *underscores = extract_attribute_substring (&attr); > + > + best_match bm (&attr); > + > + hash_table *h = attrs->attribute_hash; > + for (hash_table::iterator iter = h->begin (); > + iter != h->end (); ++iter) > + bm.consider ((*iter)->name); > + return bm.get_best_meaningful_candidate (); Does this consider the decl_req, type_req and fn_type_req flags in the attribute tables (i.e. that for attribute on a VAR_DECL it doesn't suggest attributes that apply to functions only, on FUNCTION_DECL suggest attributes that apply only to non-function decls, etc.)? Does it ignore internal only attributes (i.e. attributes containing spaces or * characters in their names)? Say void foo (void) __attribute ((omp_declare_target)); should not suggest the omp declare target attribute, since users can't type it in. Jakub