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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [obj-c++.dg/] [attributes/] [method-sentinel-1.mm] - Blame information for rev 703

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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