public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libobjc/14382] New: [libobjc] Calling +initialize on a per category basis
@ 2004-03-02 12:36 d dot ayers at inode dot at
  2004-03-02 15:29 ` [Bug libobjc/14382] " pinskia at gcc dot gnu dot org
  2004-03-02 15:49 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 9+ messages in thread
From: d dot ayers at inode dot at @ 2004-03-02 12:36 UTC (permalink / raw)
  To: gcc-bugs

The file libobjc/README contains the passage:

-----------------------------
+initialize
===========
...each +initialize method is called exactly once (or
never if no methods of that particular class is never called).
Besides this, it is allowed to have several +initialize methods, one
for each category.  The order in which these (multiple methods) are
called is not well defined.  I am not completely certain what the
semantics of this method is for other implementations, but this is
how it works for GNU Objective C.
------------------------------

Yet, currently the invocation of +initialize in libobjc is implemented to send
+initialize only once and does the method lookup manually.

This behavior is compatible to the behavior of the Apple/NeXT runtime.

There is a bug either in the documentation or on the implementation.

Personally I think the documented behavior is very useful, but it would imply
not being able to override +initialize in categories.  Usually that wouldn't
make much sense as these implementations typically have two objectives:
a) insure related classes are initialized
b) initialize static globals which couldn't be initialized in a separate
   category anyway.
But like I said, that's just "usually typical".

I would be in favor of "fixing" the GNU runtime implementation to correspond to
the documentation, *if* the Apple runtime would also implement this feature.
Otherwise, I'd rather "fix" the documentation to avoid code relying on
incompatible features, but I don't have a strong opinion if others think the GNU
runtime should deviate in this respect.

-- 
           Summary: [libobjc] Calling +initialize on a per category basis
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: libobjc
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: d dot ayers at inode dot at
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: *-*-*
  GCC host triplet: *-*-*
GCC target triplet: *-*-*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14382


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libobjc/14382] [libobjc] Calling +initialize on a per category basis
  2004-03-02 12:36 [Bug libobjc/14382] New: [libobjc] Calling +initialize on a per category basis d dot ayers at inode dot at
@ 2004-03-02 15:29 ` pinskia at gcc dot gnu dot org
  2004-03-02 15:49 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-02 15:29 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14382


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libobjc/14382] [libobjc] Calling +initialize on a per category basis
  2004-03-02 12:36 [Bug libobjc/14382] New: [libobjc] Calling +initialize on a per category basis d dot ayers at inode dot at
  2004-03-02 15:29 ` [Bug libobjc/14382] " pinskia at gcc dot gnu dot org
@ 2004-03-02 15:49 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-02 15:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-02 15:49 -------
Confirmed, here is a simple testcase:
#include <objc/objc.h>
#include <objc/Object.h>
int i = 0;
@interface A : Object
+initialize;
@end
@implementation A
+initialize
{
  printf("A\n");
  i++;
}
@end
@interface A(B)
+initialize;
@end
@implementation A(B)
+initialize
{
  printf("A(B)\n");
  i++;
}
@end
int main()
{
        A *b = [A new];
        if (i!=2)
          abort();
        return 0;
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-02 15:49:35
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14382


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libobjc/14382] [libobjc] Calling +initialize on a per category basis
       [not found] <bug-14382-6587@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2005-12-15 18:24 ` ayers at gcc dot gnu dot org
@ 2005-12-15 21:20 ` d dot ayers at inode dot at
  5 siblings, 0 replies; 9+ messages in thread
From: d dot ayers at inode dot at @ 2005-12-15 21:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from d dot ayers at inode dot at  2005-12-15 21:20 -------
        * README (+load,+initialize): Fix documentation to reflect
        intended and implemented semantics for +load and +initialize.


-- 

d dot ayers at inode dot at changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14382


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libobjc/14382] [libobjc] Calling +initialize on a per category basis
       [not found] <bug-14382-6587@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2005-12-15 18:01 ` ayers at gcc dot gnu dot org
@ 2005-12-15 18:24 ` ayers at gcc dot gnu dot org
  2005-12-15 21:20 ` d dot ayers at inode dot at
  5 siblings, 0 replies; 9+ messages in thread
From: ayers at gcc dot gnu dot org @ 2005-12-15 18:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ayers at gcc dot gnu dot org  2005-12-15 18:24 -------
Subject: Bug 14382

Author: ayers
Date: Thu Dec 15 18:23:40 2005
New Revision: 108589

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108589
Log:
2005-12-15  David Ayers  <d.ayers@inode.at>

        PR libobjc/14382
        * README (+load,+initialize): Fix documentation to reflect
        intended and implemented semantics for +load and +initialize.


Modified:
    branches/gcc-3_4-branch/libobjc/ChangeLog
    branches/gcc-3_4-branch/libobjc/README


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14382


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libobjc/14382] [libobjc] Calling +initialize on a per category basis
       [not found] <bug-14382-6587@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2005-12-15 17:23 ` ayers at gcc dot gnu dot org
@ 2005-12-15 18:01 ` ayers at gcc dot gnu dot org
  2005-12-15 18:24 ` ayers at gcc dot gnu dot org
  2005-12-15 21:20 ` d dot ayers at inode dot at
  5 siblings, 0 replies; 9+ messages in thread
From: ayers at gcc dot gnu dot org @ 2005-12-15 18:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from ayers at gcc dot gnu dot org  2005-12-15 18:01 -------
Subject: Bug 14382

Author: ayers
Date: Thu Dec 15 18:01:17 2005
New Revision: 108588

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108588
Log:
2005-12-15  David Ayers  <d.ayers@inode.at>

        PR libobjc/14382
        * README (+load,+initialize): Fix documentation to reflect
        intended and implemented semantics for +load and +initialize.


Modified:
    branches/gcc-4_1-branch/libobjc/ChangeLog
    branches/gcc-4_1-branch/libobjc/README


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14382


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libobjc/14382] [libobjc] Calling +initialize on a per category basis
       [not found] <bug-14382-6587@http.gcc.gnu.org/bugzilla/>
  2005-12-15 11:13 ` d dot ayers at inode dot at
  2005-12-15 16:46 ` ayers at gcc dot gnu dot org
@ 2005-12-15 17:23 ` ayers at gcc dot gnu dot org
  2005-12-15 18:01 ` ayers at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: ayers at gcc dot gnu dot org @ 2005-12-15 17:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ayers at gcc dot gnu dot org  2005-12-15 17:23 -------
Subject: Bug 14382

Author: ayers
Date: Thu Dec 15 17:23:10 2005
New Revision: 108587

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108587
Log:
2005-12-15  David Ayers  <d.ayers@inode.at>

        PR libobjc/14382
        * README (+load,+initialize): Fix documentation to reflect
        intended and implemented semantics for +load and +initialize.



Modified:
    branches/gcc-4_0-branch/libobjc/ChangeLog
    branches/gcc-4_0-branch/libobjc/README


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14382


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libobjc/14382] [libobjc] Calling +initialize on a per category basis
       [not found] <bug-14382-6587@http.gcc.gnu.org/bugzilla/>
  2005-12-15 11:13 ` d dot ayers at inode dot at
@ 2005-12-15 16:46 ` ayers at gcc dot gnu dot org
  2005-12-15 17:23 ` ayers at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: ayers at gcc dot gnu dot org @ 2005-12-15 16:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ayers at gcc dot gnu dot org  2005-12-15 16:46 -------
Subject: Bug 14382

Author: ayers
Date: Thu Dec 15 16:46:17 2005
New Revision: 108584

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108584
Log:
2005-12-15  David Ayers  <d.ayers@inode.at>

        PR libobjc/14382
        * README (+load,+initialize): Fix documentation to reflect
        intended and implemented semantics for +load and +initialize.


Modified:
    trunk/libobjc/ChangeLog
    trunk/libobjc/README


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14382


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libobjc/14382] [libobjc] Calling +initialize on a per category basis
       [not found] <bug-14382-6587@http.gcc.gnu.org/bugzilla/>
@ 2005-12-15 11:13 ` d dot ayers at inode dot at
  2005-12-15 16:46 ` ayers at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: d dot ayers at inode dot at @ 2005-12-15 11:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from d dot ayers at inode dot at  2005-12-15 11:13 -------
Created an attachment (id=10493)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10493&action=view)
documentation patch

After the discussion here:
http://lists.apple.com/archives/objc-language/2004/Mar/msg00007.html
I propose the attached patch to close this report.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14382


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-12-15 21:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-02 12:36 [Bug libobjc/14382] New: [libobjc] Calling +initialize on a per category basis d dot ayers at inode dot at
2004-03-02 15:29 ` [Bug libobjc/14382] " pinskia at gcc dot gnu dot org
2004-03-02 15:49 ` pinskia at gcc dot gnu dot org
     [not found] <bug-14382-6587@http.gcc.gnu.org/bugzilla/>
2005-12-15 11:13 ` d dot ayers at inode dot at
2005-12-15 16:46 ` ayers at gcc dot gnu dot org
2005-12-15 17:23 ` ayers at gcc dot gnu dot org
2005-12-15 18:01 ` ayers at gcc dot gnu dot org
2005-12-15 18:24 ` ayers at gcc dot gnu dot org
2005-12-15 21:20 ` d dot ayers at inode dot at

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).