URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Go to most recent revision |
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
689 |
jeremybenn |
/* Test for C99 declarations in for loops. Test constraints. */
|
2 |
|
|
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
|
3 |
|
|
/* { dg-do compile } */
|
4 |
|
|
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
|
5 |
|
|
|
6 |
|
|
void
|
7 |
|
|
foo (void)
|
8 |
|
|
{
|
9 |
|
|
/* See comments in check_for_loop_decls (c-decl.c) for the presumptions
|
10 |
|
|
behind these tests. */
|
11 |
|
|
int j = 0;
|
12 |
|
|
for (int i = 1, bar (void); i <= 10; i++) /* { dg-bogus "warning" "warning in place of error" } */
|
13 |
|
|
j += i;
|
14 |
|
|
/* { dg-error "bar" "function in for loop" { target *-*-* } 12 } */
|
15 |
|
|
for (static int i = 1; i <= 10; i++) /* { dg-bogus "warning" "warning in place of error" } */
|
16 |
|
|
j += i;
|
17 |
|
|
/* { dg-error "static" "static in for loop" { target *-*-* } 15 } */
|
18 |
|
|
for (extern int i; j <= 500; j++) /* { dg-bogus "warning" "warning in place of error" } */
|
19 |
|
|
j += 5;
|
20 |
|
|
/* { dg-error "extern" "extern in for loop" { target *-*-* } 18 } */
|
21 |
|
|
for (enum { FOO } i = FOO; i < 10; i++) /* { dg-bogus "warning" "warning in place of error" } */
|
22 |
|
|
j += i;
|
23 |
|
|
/* { dg-error "FOO" "enum value in for loop" { target *-*-* } 21 } */
|
24 |
|
|
for (enum BAR { FOO } i = FOO; i < 10; i++) /* { dg-bogus "warning" "warning in place of error" } */
|
25 |
|
|
j += i;
|
26 |
|
|
/* { dg-error "FOO" "enum value in for loop" { target *-*-* } 24 } */
|
27 |
|
|
/* { dg-error "BAR" "enum tag in for loop" { target *-*-* } 24 } */
|
28 |
|
|
}
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.