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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [attributes/] [proto-attribute-4.m] - Blame information for rev 704

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
2
/* { dg-do compile } */
3
 
4
/* Test that you get a warning when an unknown protocol attribute is ignored.  */
5
 
6
#include <objc/objc.h>
7
 
8
__attribute__ ((unknown_attribute))
9
@protocol MyProtocol
10
- (id) new; /* { dg-warning "ignored" } */
11
@end
12
 
13
__attribute__ ((unknown_attribute))
14
@protocol MyProtocol2; /* { dg-warning "ignored" } */
15
 
16
/* Use the protocols to double-check that no more warnings are
17
   generated.  */
18
 
19
@interface MyClass <MyProtocol>
20
@end
21
 
22
int test (id <MyProtocol2> x)
23
{
24
  if (@protocol (MyProtocol) == @protocol (MyProtocol2))
25
    return 1;
26
 
27
  if (x)
28
    return 2;
29
 
30
  return 3;
31
}

powered by: WebSVN 2.1.0

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