OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [cpp/] [lexnum.c] - Blame information for rev 405

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

Line No. Rev Author Line
1 149 jeremybenn
/* Copyright (C) 2000 Free Software Foundation, Inc.  */
2
 
3
/* { dg-do run } */
4
/* { dg-options "-trigraphs" } */
5
 
6
/* Test lexing of numbers.  */
7
 
8
extern int puts (const char *);
9
extern void abort (void);
10
#define err(str) do { puts(str); abort(); } while (0)
11
 
12
/* Escaped newlines.  */
13
#define foo 12\
14
3\
15
\
16
4??/
17
5
18
 
19
#if foo != 12345
20
#error foo
21
#endif
22
 
23
int main (int argc, char *argv[])
24
{
25
  double a = 5.;
26
  double x = .5;
27
 
28
/* Decimal points, including initially and immediately before and
29
   after an escaped newline.  */
30
  if (a != 5)
31
    err ("a");
32
  if (x != .\
33
5)
34
    err ("x != .5");
35
  x = 25\
36
.\
37
6;
38
  if (x != 25.6)
39
    err ("x != 25.6");
40
 
41
  /* Test exponentials and their signs.  A buggy lexer is more likely
42
     to fail the compile, but never mind.  */
43
  if (250 != 25e+1 || 250 != 25e1 || 250 != 2500e-1)
44
    err ("exponentials");
45
 
46
  /* Todo: p exponentials, and how to test preprocessing number
47
     tokenisation?  */
48
 
49
  return 0;
50
}

powered by: WebSVN 2.1.0

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