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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [attributes/] [method-sentinel-1.m] - Blame information for rev 754

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 704 jeremybenn
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
2
/* { dg-do compile } */
3
/* { dg-options "-Wall" } */
4
 
5
#include <objc/objc.h>
6
#include <stdlib.h>
7
#include "../../objc-obj-c++-shared/objc-test-suite-types.h"
8
 
9
@interface NSArray
10
{
11
  Class isa;
12
}
13
+ (id) arrayWithObject: (id)object __attribute__ ((sentinel));            /* { dg-warning "attribute only applies to variadic functions" } */
14
+ (id) arrayWithObjects: (id)firstObject, ... __attribute__ ((sentinel));
15
 
16
- (id) initWithObject: (id)object __attribute__ ((sentinel));            /* { dg-warning "attribute only applies to variadic functions" } */
17
- (id) initWithObjects: (id)firstObject, ... __attribute__ ((sentinel));
18
@end
19
 
20
void test (id object)
21
{
22
  NSArray *array;
23
 
24
  array = [NSArray arrayWithObject: object];
25
  array = [NSArray arrayWithObjects: object, nil];
26
  array = [NSArray arrayWithObjects: object, object, nil];
27
  array = [NSArray arrayWithObjects: object];               /* { dg-warning "not enough variable arguments" } */
28
  array = [NSArray arrayWithObjects: object, object];       /* { dg-warning "missing sentinel" } */
29
 
30
  [array initWithObject: object];
31
  [array initWithObjects: object, nil];
32
  [array initWithObjects: object, object, nil];
33
  [array initWithObjects: object];               /* { dg-warning "not enough variable arguments" } */
34
  [array initWithObjects: object, object];       /* { dg-warning "missing sentinel" } */
35
}

powered by: WebSVN 2.1.0

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