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

Subversion Repositories openrisc_me

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-src/gcc-4.2.2/gcc/testsuite/objc.dg/special
    from Rev 149 to Rev 154
    Reverse comparison

Rev 149 → Rev 154

/unclaimed-category-1.h
0,0 → 1,32
/* Contributed by Nicola Pero - Fri Dec 14 08:36:00 GMT 2001 */
#include <objc/objc.h>
#include <objc/Object.h>
 
#ifdef __NEXT_RUNTIME__
#define objc_get_class(C) objc_getClass(C)
#define class_create_instance(C) class_createInstance(C, 0)
#endif
 
/* Test loading unclaimed categories - categories of a class defined
separately from the class itself. */
 
@interface TestClass
{
id isa;
}
- (int)D;
@end
 
@interface TestClass (A)
- (int)A;
@end
 
@interface TestClass (B)
- (int)B;
@end
 
@interface TestClass (C)
- (int)C;
@end
 
 
unclaimed-category-1.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: unclaimed-category-1.m =================================================================== --- unclaimed-category-1.m (nonexistent) +++ unclaimed-category-1.m (revision 154) @@ -0,0 +1,71 @@ +/* Contributed by Nicola Pero - Fri Dec 14 08:36:00 GMT 2001 */ +/* { dg-do run } */ +#include +#include +#include + +extern void abort (void); + +/* Test loading unclaimed categories - categories of a class defined + separately from the class itself. */ + + +/* unclaimed-category-1.m contains only the class definition but not + the categories. unclaimed-category-1a.m contains only the + categories of the class, but not the class itself. We want to + check that the runtime can load the class from one module (file) + and the categories from another module (file). */ + +#include "unclaimed-category-1.h" + +@implementation TestClass +- (int)D +{ + return 4; +} +#ifdef __NEXT_RUNTIME__ ++ initialize { return self; } +#endif +@end + + +int main (void) +{ + TestClass *test; + Class testClass; + + testClass = objc_get_class ("TestClass"); + if (testClass == Nil) + { + abort (); + } + + test = (TestClass *)(class_create_instance (testClass)); + if (test == nil) + { + abort (); + } + + if ([test A] != 1) + { + abort (); + } + + if ([test B] != 2) + { + abort (); + } + + if ([test C] != 3) + { + abort (); + } + + + if ([test D] != 4) + { + abort (); + } + + return 0; +} Index: unclaimed-category-1a.m =================================================================== --- unclaimed-category-1a.m (nonexistent) +++ unclaimed-category-1a.m (revision 154) @@ -0,0 +1,31 @@ +/* Contributed by Nicola Pero - Fri Dec 14 08:36:00 GMT 2001 */ +#include +#include + +/* Test loading unclaimed categories - categories of a class defined + separately from the class itself. */ + +#include "unclaimed-category-1.h" + +@implementation TestClass (A) +- (int)A +{ + return 1; +} +@end + +@implementation TestClass (B) +- (int)B +{ + return 2; +} +@end + +@implementation TestClass (C) +- (int)C +{ + return 3; +} +@end + + Index: special.exp =================================================================== --- special.exp (nonexistent) +++ special.exp (revision 154) @@ -0,0 +1,46 @@ +# GCC Objective-C testsuite that uses the `dg.exp' driver. +# Copyright (C) 1997, 2001, 2007 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# Load support procs. +load_lib objc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS "" +} + +# Initialize `dg'. +dg-init + +# +# unclaimed-category-1 test +# +# This test is special because we must compile two different modules, +# unclaimed-category-1a.m and unclaimed-category-1.m, then link +# together, then run the resulting executable. +set lines [objc_target_compile "$srcdir/$subdir/unclaimed-category-1a.m" "unclaimed-category-1a.o" object "additional_flags=-I${srcdir}/../../libobjc"] +if ![string match "" $lines] then { + fail "unclaimed-category-1a.o" +} else { + dg-runtest "$srcdir/$subdir/unclaimed-category-1.m" "unclaimed-category-1a.o" "-I${srcdir}/../../libobjc" + file delete unclaimed-category-1a.o +} + +# All done. +dg-finish +

powered by: WebSVN 2.1.0

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