OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [libobjc-selector-1.m] - Rev 704

Compare with Previous | Blame | View Log

/* Test a little inefficiency that was fixed in libobjc when dealing
   with selectors (PR libobjc/45953).  */
 
/* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
 
/* To get the modern GNU Objective-C Runtime API, you include
   objc/runtime.h.  */
#include <objc/runtime.h>
#include <stdlib.h>
 
/* Test that registering a new selector, with the same name but a
   different type than the previous one, does not change the original
   name string.  It is actually fine to change it (there is no
   guarantee that it won't change), except for runtime performance /
   memory consumption, since changing it means that the runtime is
   doing an unneeded objc_malloc()/strcpy(), which is inefficient.  */
 
int main (void)
{
  SEL selector_1;
  SEL selector_2;
  const char *name_1;
  const char *name_2;
 
  /* These method type strings may well be invalid.  Please don't use
     them as examples.  They are irrelevant for this test; any string
     will do.  */
  selector_1 = sel_registerTypedName ("method", "v@:");
  name_1 = sel_getName (selector_1);
 
  selector_2 = sel_registerTypedName ("method", "i@:");
  name_2 = sel_getName (selector_1);
 
  if (name_1 != name_2)
    abort ();
 
  return 0;
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.