From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118553 invoked by alias); 12 Jun 2019 18:25:43 -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 118545 invoked by uid 89); 12 Jun 2019 18:25:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=Oliver X-HELO: mail-lf1-f41.google.com Received: from mail-lf1-f41.google.com (HELO mail-lf1-f41.google.com) (209.85.167.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Jun 2019 18:25:41 +0000 Received: by mail-lf1-f41.google.com with SMTP id p24so12946828lfo.6 for ; Wed, 12 Jun 2019 11:25:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=+YCXtoxs2tlxnt1cq76kcvg6aQ5cmAMjRQLQdEPfji8=; b=fXYAbI9XNHTaFz0rYskGPt/iP6KzrVDSCi7SI7TJcldVGlMtFEqnOo7QOw0B2EsbTA klTQwfjVvj+0unih1l1uI0JXmEIWLiJfQxwlLgsktEhe52fBre7EpZ4A6MaYejCA8nZ5 L+JXrdxqis3fRW34/3Tjum+SmUegjI+klz8gxpYUkhIRgzPjKiU6VGib52d8rgsinVoR J5xQ3VaIfHuiv8506VG0jXNN3DiwC67wWDSHYtcZuAR/9LvssmQJ41l8c1KoXhkEkLK/ m4VUaoHVlLuiODZHJE7nz0YlcA4OhODbEqs8+17wTDHpJLv6HXzZqrwMazWCeY16cgyz 9/9g== MIME-Version: 1.0 From: Oliver Browne Date: Wed, 12 Jun 2019 18:25:00 -0000 Message-ID: Subject: [PATH] Patch to fix -finstrument-functions-exclude-function-list handling of namespaces and escaped commas To: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2019-06/txt/msg00722.txt.bz2 Patch fixes following PRs: c++/90816 - -finstrument-functions-exclude-function-list improperly handles namespace/class definitions c++/90809 - -finstrument-functions-exclude-function-list mishandles comma escaping Fixes as follows: At flag_instrument_functions_exclude_p [gimplify.c] Using lang_hooks.decl_printable_name (fndecl, 1) to get namespace / class information as part of printable name to allow for inclusion of namespace / class specification when passing symbols to -finstrument-functions-exclude-function-list. Was previously lang_hooks.decl_printable_name (fndecl, 0). At add_comma_separated_to_vector [opts.c] Added writing of a null character to w after primary loop finishes, to account for offset between r and w when r reaches end of passed string. from Oliver Browne PR c++/90816 PR c++/90809 * gimplify.c (flag_instrument_functions_exclude_p): include namespace information as part of decl name * opts.c (add_comma_separated_to_vector): add null character to correct position in last token added to token vector Index: gimplify.c =================================================================== --- gimplify.c 2019-06-12 19:07:26.872077000 +0100 +++ gimplify.c 2019-06-12 18:55:10.609255000 +0100 @@ -13987,11 +13987,17 @@ flag_instrument_functions_exclude_p (tre { const char *name; - int i; + unsigned int i; char *s; - name = lang_hooks.decl_printable_name (fndecl, 0); - FOR_EACH_VEC_ELT (*v, i, s) + name = lang_hooks.decl_printable_name (fndecl, 1); + for(i = 0; i < v->length(); i++){ + s = (*v)[i]; + if(strstr(name, s) != NULL){ + return(true); + } + } +/* FOR_EACH_VEC_ELT (*v, i, s) if (strstr (name, s) != NULL) - return true; + return true;*/ } @@ -14278,3 +14284,3 @@ gimplify_hasher::equal (const elt_t *p1, return true; -} \ No newline at end of file +} Index: opts.c =================================================================== --- opts.c 2019-06-12 19:10:04.354612000 +0100 +++ opts.c 2019-06-12 18:53:43.675852000 +0100 @@ -263,7 +263,8 @@ add_comma_separated_to_vector (void **pv *w++ = *r++; } - if (*token_start != '\0') + *w = '\0'; + if (*token_start != '\0'){ v->safe_push (token_start); - + } *pvec = v; } @@ -3151,3 +3152,3 @@ option_name (diagnostic_context *context else return NULL; -} \ No newline at end of file +}