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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [gnu99-static-1.c] - Blame information for rev 816

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

Line No. Rev Author Line
1 298 jeremybenn
/* It is a constraint violation for a static function to be declared
2
   but not defined if it is used except in a sizeof expression whose
3
   result is an integer constant.  In GNU C, we need to consider
4
   __typeof__ and __alignof__ as well.  __alignof__ always returns a
5
   constant, so static functions can always be used therein.
6
   __typeof__ evaluates its argument iff it has variably modified
7
   type.  */
8
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
9
/* { dg-do compile } */
10
/* { dg-options "-O2 -std=gnu99 -pedantic-errors" } */
11
 
12
/* __alignof__, OK.  */
13
static int f0(void);
14
void g0(void) { __alignof__(f0()); }
15
 
16
/* __typeof__ not variably modified, OK.  */
17
static int f1(void);
18
void g1(void) { __typeof__(f1()) x; }
19
 
20
/* __typeof__ variably modified, not OK.  */
21
static int f2(void); /* { dg-error "used but never defined" } */
22
void g2(void) { __typeof__(int [f2()]) x; }
23
 
24
/* __typeof__ variably modified, not OK.  */
25
static int f3(void); /* { dg-error "used but never defined" } */
26
void g3(void) { __typeof__(int (*)[f3()]) x; }
27
 
28
/* Integer sizeof of VM typeof, OK.  */
29
static int f4(void);
30
void g4(void) { sizeof(__typeof__(int (*)[f3()])); }

powered by: WebSVN 2.1.0

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