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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [bitfld-1.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* Copyright (C) 2002 Free Software Foundation, Inc.
2
 
3
   Tests various diagnostics about a bit-field's type and width.
4
 
5
   Source: Neil Booth, 26 Jan 2002.
6
*/
7
 
8
/* { dg-options -pedantic } */
9
 
10
enum foo {e1 = 0, e2, e3, e4, e5};
11
 
12
int x;
13
typedef unsigned int ui;
14
 
15
struct bf1
16
{
17
  unsigned int a: 3.5;          /* { dg-error "integer constant" } */
18
  unsigned int b: x;            /* { dg-error "integer constant" } */
19
  unsigned int c: -1;           /* { dg-error "negative width" } */
20
  unsigned int d: 0;             /* { dg-error "zero width" } */
21
  unsigned int : 0;              /* { dg-bogus "zero width" } */
22
  unsigned int : 5;
23
  double e: 1;                  /* { dg-error "invalid type" } */
24
  float f: 1;                   /* { dg-error "invalid type" } */
25
  unsigned long g: 5;           /* { dg-warning "GCC extension|ISO C" } */
26
  ui h: 5;
27
  enum foo i: 2;                /* { dg-warning "narrower" } */
28
    /* { dg-warning "GCC extension|ISO C" "extension" { target *-*-* } 27 } */
29
  enum foo j: 3;                /* { dg-warning "GCC extension|ISO C" } */
30
  unsigned int k: 256;          /* { dg-error "exceeds its type" } */
31
};

powered by: WebSVN 2.1.0

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