Commit 3319c1b8 by Joseph Myers Committed by Jeff Law

c90-hexfloat-1.c, [...]: New tests.

	* gcc.dg/c90-hexfloat-1.c, gcc.dg/c90-hexfloat-2.c,
	gcc.dg/c99-hexfloat-1.c, gcc.dg/c99-hexfloat-2.c: New tests.

From-SVN: r35074
parent 919e0807
2000-07-17 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.dg/c90-hexfloat-1.c, gcc.dg/c90-hexfloat-2.c,
gcc.dg/c99-hexfloat-1.c, gcc.dg/c99-hexfloat-2.c: New tests.
* gcc.dg/c90-enum-comma-1.c, gcc.dg/c90-idem-qual-1.c,
gcc.dg/c90-impl-decl-1.c, gcc.dg/c90-impl-int-1.c,
gcc.dg/c90-longlong.c, gcc.dg/c90-restrict-1.c,
......
/* Test for hex floating point constants: in C99 only. Compiler test. */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
double d = 0x1.2p2; /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "radix 16" "hex float error" { target *-*-* } 6 } */
/* Test for hex floating point constants: in C99 only. Preprocessor test. */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do run } */
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
#define f (
#define l )
#define str(x) #x
#define xstr(x) str(x)
/* C90: "0x1p+( 0x1p+)"; C99: "0x1p+f 0x1p+l" */
const char *s = xstr(0x1p+f 0x1p+l);
extern void abort (void);
extern int strcmp (const char *, const char *);
int
main (void)
{
if (strcmp (s, "0x1p+( 0x1p+)"))
abort ();
else
return 0; /* Correct C90 behaviour. */
}
/* Test for hex floating point constants: in C99 only. Compiler test. */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
double d = 0x1.2p2; /* { dg-bogus "radix 16" "bogus C99 hex float error" } */
/* Test for hex floating point constants: in C99 only. Preprocessor test. */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do run } */
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
#define f (
#define l )
#define str(x) #x
#define xstr(x) str(x)
/* C90: "0x1p+( 0x1p+)"; C99: "0x1p+f 0x1p+l" */
const char *s = xstr(0x1p+f 0x1p+l);
extern void abort (void);
extern int strcmp (const char *, const char *);
int
main (void)
{
if (strcmp (s, "0x1p+f 0x1p+l"))
abort ();
else
return 0; /* Correct C99 behaviour. */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment