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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [c90-const-expr-9.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 689 jeremybenn
/* Test for constant expressions: __builtin_offsetof allowed in
2
   integer constant expressions but not traditional offsetof
3
   expansion.  */
4
/* Origin: Joseph Myers <joseph@codesourcery.com> */
5
/* { dg-do compile } */
6
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
7
 
8
struct s {
9
  int a;
10
};
11
 
12
struct t {
13
  struct s a;
14
  int b[2];
15
};
16
 
17
__extension__ typedef __SIZE_TYPE__ size_t;
18
 
19
#define old_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
20
 
21
enum e {
22
  E1 = old_offsetof (struct s, a), /* { dg-error "constant" } */
23
  E2 = old_offsetof (struct t, a.a), /* { dg-error "constant" } */
24
  E3 = old_offsetof (struct t, b[1]), /* { dg-error "constant" } */
25
  E4 = __builtin_offsetof (struct s, a),
26
  E5 = __builtin_offsetof (struct t, a.a),
27
  E6 = __builtin_offsetof (struct t, b[1])
28
};

powered by: WebSVN 2.1.0

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