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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [pragma-message.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Test that #pragma message "..." writes compiler messages. */
2
 
3
#pragma message                  /* { dg-warning "expected a string" } */
4
#pragma message 0                /* { dg-warning "expected a string" } */
5
#pragma message id               /* { dg-warning "expected a string" } */
6
#pragma message (                /* { dg-warning "expected a string" } */
7
#pragma message (0               /* { dg-warning "expected a string" } */
8
#pragma message (id              /* { dg-warning "expected a string" } */
9
#pragma message ()               /* { dg-warning "expected a string" } */
10
#pragma message (0)              /* { dg-warning "expected a string" } */
11
#pragma message (id)             /* { dg-warning "expected a string" } */
12
 
13
/* gcc prefixes '#pragma message ...' output with filename and line number,
14
   then 'note: #pragma message: ', allowing dg-message to check output.
15
   If unexpected pragma messages are printed (anything not caught by a
16
   matching dg-message), dejagnu will report these as excess errors.  */
17
 
18
#pragma message "
19
/* { dg-error "missing terminating" "" { target *-*-* } 18 } */
20
/* { dg-warning "expected a string" "" { target *-*-* } 18 } */
21
#pragma message "Bad 1
22
/* { dg-error "missing terminating" "" { target *-*-* } 21 } */
23
/* { dg-warning "expected a string" "" { target *-*-* } 21 } */
24
#pragma message ("Bad 2
25
/* { dg-error "missing terminating" "" { target *-*-* } 24 } */
26
/* { dg-warning "expected a string" "" { target *-*-* } 24 } */
27
#pragma message ("Bad 3"
28
/* { dg-warning "malformed '#pragma message" "" { target *-*-* } 27 } */
29
 
30
#pragma message "" junk
31
/* { dg-warning "junk at end of '#pragma message'" "" { target *-*-* } 30 } */
32
 
33
#pragma message ("") junk
34
/* { dg-warning "junk at end of '#pragma message'" "" { target *-*-* } 33 } */
35
 
36
#pragma message ""               /* No output expected for empty messages.  */
37
#pragma message ("")
38
 
39
#pragma message "Okay 1"         /* { dg-message "Okay 1" } */
40
#pragma message ("Okay 2")       /* { dg-message "Okay 2" } */
41
#define THREE "3"
42
#pragma message ("Okay " THREE)  /* { dg-message "Okay 3" } */
43
 
44
/* Create a TODO() that prints a message on compilation.  */
45
#define DO_PRAGMA(x) _Pragma (#x)
46
#define TODO(x) DO_PRAGMA(message ("TODO - " #x))
47
TODO(Okay 4)                     /* { dg-message "TODO - Okay 4" } */
48
 
49
#if 0
50
#pragma message ("Not printed")
51
#endif
52
 
53
int unused;  /* Silence `ISO C forbids an empty translation unit' warning.  */

powered by: WebSVN 2.1.0

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