public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libobjc/50002] New: class_replaceMethod does not work on class methods
@ 2011-08-06  7:54 nicola at gcc dot gnu.org
  2011-08-06 14:20 ` [Bug libobjc/50002] " nicola at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: nicola at gcc dot gnu.org @ 2011-08-06  7:54 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: class_replaceMethod does not work on class methods
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libobjc
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: nicola@gcc.gnu.org


Reported by Jonathan Schleifer --

#include <stdio.h>
#include <assert.h>

#import <objc/Object.h>
#import <objc/runtime.h>

id
alloc(Class self, SEL _cmd)
{
    puts("Foo!");
    return nil;
}

int
main()
{
    Method method = class_getClassMethod([Object class], @selector(alloc));
    assert(method != NULL);

    /* INCOMPATIBLE to Apple! class_pointer should be isa!! */
    class_replaceMethod([Object class]->class_pointer, @selector(alloc),
        (IMP)alloc, method_getTypeEncoding(method));

    [Object alloc];

    return 0;
}


> If you change Object to NSObject and class_pointer to isa, it works on OS X.

Thanks


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

* [Bug libobjc/50002] class_replaceMethod does not work on class methods
  2011-08-06  7:54 [Bug libobjc/50002] New: class_replaceMethod does not work on class methods nicola at gcc dot gnu.org
@ 2011-08-06 14:20 ` nicola at gcc dot gnu.org
  2011-08-06 14:22 ` nicola at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: nicola at gcc dot gnu.org @ 2011-08-06 14:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Nicola Pero <nicola at gcc dot gnu.org> 2011-08-06 14:20:13 UTC ---
Author: nicola
Date: Sat Aug  6 14:20:09 2011
New Revision: 177510

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177510
Log:
In libobjc/:
2011-08-06  Nicola Pero  <nicola.pero@meta-innovation.com>

    PR libobjc/50002
    * class.c (__objc_update_classes_with_methods): Iterate over meta
    classes as well as normal classes when refreshing the method
    implementations.  This fixes replacing class methods.

2011-08-06  Nicola Pero  <nicola.pero@meta-innovation.com>

    * class.c (class_getSuperclass): Fixed to work with meta classes
    still in construction too.

In gcc/testsuite/:
2011-08-06  Nicola Pero  <nicola.pero@meta-innovation.com>

    PR libobjc/50002
    * objc.dg/gnu-api-2-class.m: Updated comments.
    * obj-c++.dg/gnu-api-2-class.mm: Likewise.
    * objc.dg/gnu-api-2-class-meta.m: New test.
    * obj-c++.dg/gnu-api-2-class-meta.mm: Likewise.

2011-08-06  Nicola Pero  <nicola.pero@meta-innovation.com>

    PR libobjc/49882
    * obj-c++.dg/gnu-api-2-class.mm (main): Test class_getSuperclass()
    with classes that are in construction.

Added:
    trunk/gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm
    trunk/gcc/testsuite/objc.dg/gnu-api-2-class-meta.m
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
    trunk/gcc/testsuite/objc.dg/gnu-api-2-class.m
    trunk/libobjc/ChangeLog
    trunk/libobjc/class.c


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

* [Bug libobjc/50002] class_replaceMethod does not work on class methods
  2011-08-06  7:54 [Bug libobjc/50002] New: class_replaceMethod does not work on class methods nicola at gcc dot gnu.org
  2011-08-06 14:20 ` [Bug libobjc/50002] " nicola at gcc dot gnu.org
@ 2011-08-06 14:22 ` nicola at gcc dot gnu.org
  2011-10-14 17:10 ` nicola at gcc dot gnu.org
  2011-10-14 17:12 ` nicola at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: nicola at gcc dot gnu.org @ 2011-08-06 14:22 UTC (permalink / raw)
  To: gcc-bugs

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

Nicola Pero <nicola at gcc dot gnu.org> changed:

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

--- Comment #2 from Nicola Pero <nicola at gcc dot gnu.org> 2011-08-06 14:22:16 UTC ---
Confirmed, and fixed in trunk (will go into 4.7).

Thanks


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

* [Bug libobjc/50002] class_replaceMethod does not work on class methods
  2011-08-06  7:54 [Bug libobjc/50002] New: class_replaceMethod does not work on class methods nicola at gcc dot gnu.org
  2011-08-06 14:20 ` [Bug libobjc/50002] " nicola at gcc dot gnu.org
  2011-08-06 14:22 ` nicola at gcc dot gnu.org
@ 2011-10-14 17:10 ` nicola at gcc dot gnu.org
  2011-10-14 17:12 ` nicola at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: nicola at gcc dot gnu.org @ 2011-10-14 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Nicola Pero <nicola at gcc dot gnu.org> 2011-10-14 17:10:21 UTC ---
Author: nicola
Date: Fri Oct 14 17:10:14 2011
New Revision: 179996

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179996
Log:
In libobjc/:
2011-10-14  Nicola Pero  <nicola.pero@meta-innovation.com>

    Backport from mainline
    2011-08-06  Nicola Pero  <nicola.pero@meta-innovation.com>

    PR libobjc/50002
    * class.c (__objc_update_classes_with_methods): Iterate over meta
    classes as well as normal classes when refreshing the method
    implementations.  This fixes replacing class methods.

Modified:
    branches/gcc-4_6-branch/libobjc/ChangeLog
    branches/gcc-4_6-branch/libobjc/class.c


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

* [Bug libobjc/50002] class_replaceMethod does not work on class methods
  2011-08-06  7:54 [Bug libobjc/50002] New: class_replaceMethod does not work on class methods nicola at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-10-14 17:10 ` nicola at gcc dot gnu.org
@ 2011-10-14 17:12 ` nicola at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: nicola at gcc dot gnu.org @ 2011-10-14 17:12 UTC (permalink / raw)
  To: gcc-bugs

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

Nicola Pero <nicola at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.2


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

end of thread, other threads:[~2011-10-14 17:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-06  7:54 [Bug libobjc/50002] New: class_replaceMethod does not work on class methods nicola at gcc dot gnu.org
2011-08-06 14:20 ` [Bug libobjc/50002] " nicola at gcc dot gnu.org
2011-08-06 14:22 ` nicola at gcc dot gnu.org
2011-10-14 17:10 ` nicola at gcc dot gnu.org
2011-10-14 17:12 ` nicola at gcc dot gnu.org

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).