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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [objc.dg/] [conditional-1.m] - Blame information for rev 774

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

Line No. Rev Author Line
1 704 jeremybenn
/* Testing conditional warnings (without headers).  */
2
/* Author: David Ayers */
3
 
4
/* { dg-do compile } */
5
 
6
#define nil ((id)0)
7
@interface MyObject
8
@end
9
 
10
@protocol MyProtocol
11
@end
12
 
13
@interface MyProtoObject <MyProtocol>
14
@end
15
 
16
 
17
int
18
main (int argc, char *argv[])
19
{
20
  id var_id = nil;
21
  id <MyProtocol> var_id_p = nil;
22
  MyObject *var_obj = nil;
23
  MyProtoObject *var_obj_p = nil;
24
 
25
  var_id = (var_id == var_obj) ? var_id : var_obj;
26
  var_id = (var_id == var_obj) ? var_id : var_obj_p;
27
 
28
  /* Ayers: Currently, the following test case passes for
29
     technically the wrong reason (see below).
30
  */
31
  var_obj_p = (var_id == var_obj) ? var_obj_p : var_obj; /* { dg-warning "distinct Objective-C types" } */
32
  var_obj_p = (var_id == var_obj) ? var_obj_p : var_id_p;
33
 
34
  /* Ayers: The first of the following test cases
35
     should probably warn for var_obj_p = var_obj,
36
     yet that would require extensive changes to
37
     build_conditional_expr to create a tree with
38
     multiple types that the assignment would have
39
     to evaluate both versions for correct diagnostics.
40
  */
41
  var_obj_p = (var_id == var_obj) ? var_id : var_obj;
42
  var_obj_p = (var_id == var_obj) ? var_id : var_obj_p;
43
 
44
  return 0;
45
}

powered by: WebSVN 2.1.0

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