http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54287
Bug #: 54287
Summary: -finstrument-functions-exclude-function-list ignores
class/namespace scope
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: [email protected]
ReportedBy: [email protected]
In it's current implementation, the symbol matching of
-finstrument-functions-exclude-function-list performs a strstr() on the
function name only, ignoring the class/namespace scope. That is, with sym=func,
both foo::func() and bar::func() with foo and bar being either classes or
namespaces will be matched and excluded from instrumentation.
To allow for a more fine-grained specification, the function name used for
matching should include the class/namespace scope. This can easily be achived
using the patch given below (against the 4.7.1 release). A matching based on
regular expressions would be even more convenient, but the proposed change
would already help a lot.
diff -Nrup gcc-4.7.1.orig/gcc/gimplify.c gcc-4.7.1/gcc/gimplify.c
--- gcc-4.7.1.orig/gcc/gimplify.c 2012-05-10 17:00:11.000000000 +0200
+++ gcc-4.7.1/gcc/gimplify.c 2012-08-16 18:12:45.793020996 +0200
@@ -8079,7 +8079,7 @@ flag_instrument_functions_exclude_p (tre
int i;
char *s;
- name = lang_hooks.decl_printable_name (fndecl, 0);
+ name = lang_hooks.decl_printable_name (fndecl, 1);
FOR_EACH_VEC_ELT (char_p, vec, i, s)
if (strstr (name, s) != NULL)
return true;