OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [c99-scope-1.c] - Blame information for rev 645

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

Line No. Rev Author Line
1 149 jeremybenn
/* Test for new block scopes in C99.  Inspired by C99 Rationale (N897).  */
2
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3
/* { dg-do run } */
4
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
5
 
6
struct foo {
7
  char a;
8
};
9
 
10
extern void abort (void);
11
extern void exit (int);
12
 
13
int
14
sfoo (void)
15
{
16
  if (sizeof (struct foo { int a; double b; char *c; void *d; }))
17
    (void) 0;
18
  return sizeof (struct foo);
19
}
20
 
21
int
22
main (void)
23
{
24
  int t, u;
25
  t = sfoo ();
26
  u = sizeof (struct foo);
27
  /* With C90 scoping rules the new declaration of struct foo is in scope
28
     above; with C99 it is local to the if.
29
  */
30
  if (t == u)
31
    exit (0); /* C99 rules apply.  */
32
  else
33
    abort (); /* C90 rules apply.  */
34
}

powered by: WebSVN 2.1.0

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