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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [wtr-aggr-init-1.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Test for -Wtraditional warnings on automatic aggregate initialization.
2
   Note, gcc should omit these warnings in system header files.
3
   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000.  */
4
/* { dg-do compile } */
5
/* { dg-options "-Wtraditional" } */
6
 
7
struct foo
8
{
9
  int i;
10
  long l;
11
};
12
 
13
struct foo f0 = { 0, 0 };
14
static struct foo f1 = { 0, 0 };
15
 
16
void
17
testfunc1 ()
18
{
19
  struct foo f3 = { 0, 0 }; /* { dg-warning "traditional C rejects automatic" "automatic aggregate initialization" } */
20
  static struct foo f4 = { 0, 0 };
21
 
22
  f3 = f4;
23
 
24
  __extension__ ({
25
    struct foo f5 = { 0, 0 }; /* { dg-bogus "traditional C rejects automatic" "__extension__ disables warnings" } */
26
    f5.i = 0;
27
  });
28
 
29
  {
30
    struct foo f6 = { 0, 0 }; /* { dg-warning "traditional C rejects automatic" "__extension__ reenables warnings" } */
31
    f6.i = 0;
32
  }
33
}
34
 
35
# 35 "sys-header.h" 3
36
/* We are in system headers now, no -Wtraditional warnings should issue.  */
37
 
38
struct foo f7 = { 0, 0 };
39
static struct foo f8 = { 0, 0 };
40
 
41
void
42
testfunc2 ()
43
{
44
  struct foo f9 = { 0, 0 };
45
  static struct foo f10 = { 0, 0 };
46
 
47
  f9 = f10;
48
}

powered by: WebSVN 2.1.0

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