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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [attributes/] [proto-attribute-4.mm] - Rev 703

Compare with Previous | Blame | View Log

/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, December 2010.  */
/* { dg-do compile } */

/* Test that you get a warning when an unknown protocol attribute is ignored.  */

#include <objc/objc.h>

__attribute__ ((unknown_attribute))
@protocol MyProtocol /* { dg-warning "ignored" } */
- (id) new;
@end

__attribute__ ((unknown_attribute))
@protocol MyProtocol2; /* { dg-warning "ignored" } */

/* Use the protocols to double-check that no more warnings are
   generated.  */

@interface MyClass <MyProtocol>
@end

int test (id <MyProtocol2> x)
{
  if (@protocol (MyProtocol) == @protocol (MyProtocol2))
    return 1;

  if (x)
    return 2;

  return 3;
}

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.