OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [obj-c++.dg/] [proto-qual-1.mm] - Diff between revs 308 and 338

Only display areas with differences | Details | Blame | View Log

Rev 308 Rev 338
/* Check that protocol qualifiers are compiled and encoded properly.  */
/* Check that protocol qualifiers are compiled and encoded properly.  */
/* Author: Ziemowit Laski   */
/* Author: Ziemowit Laski   */
/* { dg-do run } */
/* { dg-do run } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
#include "../objc-obj-c++-shared/Protocol1.h"
#include "../objc-obj-c++-shared/Protocol1.h"
#ifndef __NEXT_RUNTIME__
#ifndef __NEXT_RUNTIME__
#include 
#include 
#endif
#endif
#include 
#include 
#include 
#include 
/* The encoded parameter sizes will be rounded up to match pointer alignment.  */
/* The encoded parameter sizes will be rounded up to match pointer alignment.  */
#define ROUND(s,a) (a * ((s + a - 1) / a))
#define ROUND(s,a) (a * ((s + a - 1) / a))
#define aligned_sizeof(T) ROUND(sizeof(T),__alignof(void *))
#define aligned_sizeof(T) ROUND(sizeof(T),__alignof(void *))
#define CHECK_IF(expr) if(!(expr)) abort()
#define CHECK_IF(expr) if(!(expr)) abort()
@protocol Retain
@protocol Retain
+ (oneway void)retainArgument:(out bycopy id)arg1 with:(in signed char **)arg2;
+ (oneway void)retainArgument:(out bycopy id)arg1 with:(in signed char **)arg2;
- (bycopy) address:(byref inout id)location with:(out short unsigned **)arg2;
- (bycopy) address:(byref inout id)location with:(out short unsigned **)arg2;
@end
@end
@interface Foo 
@interface Foo 
+ (oneway void)retainArgument:(out bycopy id)arg with:(in signed char **)arg2;
+ (oneway void)retainArgument:(out bycopy id)arg with:(in signed char **)arg2;
@end
@end
@implementation Foo
@implementation Foo
+ (oneway void)retainArgument:(out bycopy id)arg1 with:(in signed char **)arg2 { }
+ (oneway void)retainArgument:(out bycopy id)arg1 with:(in signed char **)arg2 { }
- (bycopy) address:(byref inout id)location with:(out short unsigned **)arg2 { return nil; }
- (bycopy) address:(byref inout id)location with:(out short unsigned **)arg2 { return nil; }
@end
@end
Protocol *proto = @protocol(Retain);
Protocol *proto = @protocol(Retain);
struct objc_method_description *meth;
struct objc_method_description *meth;
unsigned totsize, offs0, offs1, offs2, offs3, offs4, offs5, offs6, offs7;
unsigned totsize, offs0, offs1, offs2, offs3, offs4, offs5, offs6, offs7;
static void scan_initial(const char *pattern) {
static void scan_initial(const char *pattern) {
  totsize = offs0 = offs1 = offs2 = offs3 = offs4 = offs5 = offs6 = offs7 = (unsigned)-1;
  totsize = offs0 = offs1 = offs2 = offs3 = offs4 = offs5 = offs6 = offs7 = (unsigned)-1;
  sscanf(meth->types, pattern, &totsize, &offs0, &offs1, &offs2, &offs3,
  sscanf(meth->types, pattern, &totsize, &offs0, &offs1, &offs2, &offs3,
      &offs4, &offs5, &offs6, &offs7);
      &offs4, &offs5, &offs6, &offs7);
  CHECK_IF(!offs0 && offs1 == aligned_sizeof(id) && offs2 == offs1 + aligned_sizeof(SEL) && totsize >= offs2);
  CHECK_IF(!offs0 && offs1 == aligned_sizeof(id) && offs2 == offs1 + aligned_sizeof(SEL) && totsize >= offs2);
}
}
int main(void) {
int main(void) {
  meth = [proto descriptionForInstanceMethod: @selector(address:with:)];
  meth = [proto descriptionForInstanceMethod: @selector(address:with:)];
  scan_initial("O@%u@%u:%uNR@%uo^^S%u");
  scan_initial("O@%u@%u:%uNR@%uo^^S%u");
  CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(unsigned));
  CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(unsigned));
  meth = [proto descriptionForClassMethod: @selector(retainArgument:with:)];
  meth = [proto descriptionForClassMethod: @selector(retainArgument:with:)];
  scan_initial("Vv%u@%u:%uOo@%un^*%u");
  scan_initial("Vv%u@%u:%uOo@%un^*%u");
  CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(char **));
  CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(char **));
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

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