aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorLaurent Alfonsi <laurent.alfonsi@st.com>2014-01-15 19:37:35 +0000
committerJeff Law <law@gcc.gnu.org>2014-01-15 12:37:35 -0700
commit67bf2939d3d2765d2eabbb8905a70384f7039f69 (patch)
tree705afa968fdbcdcb027d1f5a0b8acc748b7b4a0b /gcc
parent352e9ecd3f8a8a7739100752b6a276c9fc95a63f (diff)
downloadgcc-67bf2939d3d2765d2eabbb8905a70384f7039f69.zip
gcc-67bf2939d3d2765d2eabbb8905a70384f7039f69.tar.gz
gcc-67bf2939d3d2765d2eabbb8905a70384f7039f69.tar.bz2
re PR c++/49718 (please allow no_instrument_function attribute in class member definition/declaration)
PR c++/49718 * c-common.c (handle_no_instrument_function_attribute): Allow no_instrument_function attribute in class member definition/declaration. PR c++/49718 * g++.dg/pr49718.C: New test. From-SVN: r206643
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/ChangeLog7
-rw-r--r--gcc/c-family/c-common.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/pr49718.C41
4 files changed, 53 insertions, 6 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 80dd632..fede01f 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,10 @@
+2014-01-15 Laurent Alfonsi <laurent.alfonsi@st.com>
+
+ PR c++/49718
+ * c-common.c (handle_no_instrument_function_attribute): Allow
+ no_instrument_function attribute in class member
+ definition/declaration.
+
2014-01-15 Jakub Jelinek <jakub@redhat.com>
PR c/58943
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 40d12bc..35958ea 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -7985,12 +7985,6 @@ handle_no_instrument_function_attribute (tree *node, tree name,
"%qE attribute applies only to functions", name);
*no_add_attrs = true;
}
- else if (DECL_INITIAL (decl))
- {
- error_at (DECL_SOURCE_LOCATION (decl),
- "can%'t set %qE attribute after definition", name);
- *no_add_attrs = true;
- }
else
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (decl) = 1;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 528a65a..2a5ded2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-15 Laurent Alfonsi <laurent.alfonsi@st.com>
+
+ PR c++/49718
+ * g++.dg/pr49718.C: New test.
+
2014-01-15 Richard Sandiford <rdsandiford@googlemail.com>
* gcc.target/mips/umips-branch-4.c: Add addressing=absolute.
diff --git a/gcc/testsuite/g++.dg/pr49718.C b/gcc/testsuite/g++.dg/pr49718.C
new file mode 100644
index 0000000..f80f995
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr49718.C
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -finstrument-functions" } */
+/* { dg-final { scan-assembler-times "__cyg_profile_func_enter" 1} } */
+
+#define NOINSTR __attribute__((no_instrument_function))
+
+struct t
+{
+ public:
+ /* Function code should be instrumented */
+ __attribute__((noinline)) t() {}
+
+ /* Function t::a() should not be instrumented */
+ NOINSTR void a(){
+ }
+ /* Function t::b() should not be instrumented */
+ void NOINSTR b(){
+ }
+ /* Function t::c() should not be instrumented */
+ void c() NOINSTR {
+ }
+ /* Function t::d() should not be instrumented */
+ void d() NOINSTR;
+};
+
+void t::d()
+{
+}
+
+/* Function call_all_functions() should not be instrumented */
+struct t call_all_functions() __attribute__((no_instrument_function));
+struct t call_all_functions()
+{
+ struct t a; /* Constructor not inlined */
+ a.a(); /* Inlined t::a() should not be instrumented */
+ a.b(); /* Inlined t::b() should not be instrumented */
+ a.c(); /* Inlined t::c() should not be instrumented */
+ a.d(); /* Inlined t::d() should not be instrumented */
+ return a;
+}
+