This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] objc: update documetation and add test-case of constructor/destructor attr.
- From: Martin Liška <mliska at suse dot cz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 10 Aug 2016 11:11:06 +0200
- Subject: [PATCH] objc: update documetation and add test-case of constructor/destructor attr.
- Authentication-results: sourceware.org; auth=none
Hi.
Following patch clarifies usage of ctor and dtor attributes for Objective C.
Patch survives (on x86_64-linux-gnu):
make -k check-objc RUNTESTFLAGS="execute.exp"
Ready for trunk?
Thanks,
Martin
>From 0fcb15e50905a95d8e824aed45d961b5ddc46479 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 10 Aug 2016 11:01:49 +0200
Subject: [PATCH] objc: update documetation and add test-case of
constructor/destructor attr.
gcc/ChangeLog:
2016-08-10 Martin Liska <mliska@suse.cz>
* doc/extend.texi: Remove limitation of Objective C for
__attribute__((constructor)) and __attribute__((destructor)).
gcc/testsuite/ChangeLog:
2016-08-10 Martin Liska <mliska@suse.cz>
* objc/execute/construct1.m: New test.
---
gcc/doc/extend.texi | 2 --
gcc/testsuite/objc/execute/construct1.m | 11 +++++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/objc/execute/construct1.m
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 5697f3a..cce17aa 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -2485,8 +2485,6 @@ same priority. The priorities for constructor and destructor
functions are the same as those specified for namespace-scope C++
objects (@pxref{C++ Attributes}).
-These attributes are not currently implemented for Objective-C@.
-
@item deprecated
@itemx deprecated (@var{msg})
@cindex @code{deprecated} function attribute
diff --git a/gcc/testsuite/objc/execute/construct1.m b/gcc/testsuite/objc/execute/construct1.m
new file mode 100644
index 0000000..3de036d
--- /dev/null
+++ b/gcc/testsuite/objc/execute/construct1.m
@@ -0,0 +1,11 @@
+int i;
+
+void hello (void) __attribute__ ((constructor));
+void hello (void) { i = 1; }
+
+int main (void) {
+ if (i != 1)
+ return 1;
+
+ return 0;
+}
--
2.9.2