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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* Copyright (C) 2001 Free Software Foundation, Inc.  */
2
 
3
/* { dg-do compile } */
4
/* { dg-options "-std=c99" } */
5
 
6
/* This tests universal character sequences.
7
 
8
   Neil Booth, 22 May 2001.
9
   Richard Henderson, 3 Apr 2002.  */
10
 
11
#include <limits.h>
12
 
13
#define unsigned        +0
14
#define int             +0 
15
#define char            +1
16
#define short           +2 
17
#define long            +3
18
 
19
#if __WCHAR_TYPE__ == 0
20
# define WCHAR_MAX      INT_MAX
21
#elif __WCHAR_TYPE__ == 1
22
# define WCHAR_MAX      CHAR_MAX
23
#elif __WCHAR_TYPE__ == 2
24
# define WCHAR_MAX      SHRT_MAX
25
#elif __WCHAR_TYPE__ == 3
26
# define WCHAR_MAX      LONG_MAX
27
#else
28
# error wacky wchar_t
29
#endif
30
 
31
#undef unsigned
32
#undef int
33
#undef char
34
#undef short
35
#undef long
36
 
37
#if L'\u1234' != 0x1234
38
#error bad short ucs    /* { dg-bogus "bad" "bad u1234 evaluation" } */
39
#endif
40
 
41
#if WCHAR_MAX >= 0x7ffffff
42
# if L'\U1234abcd' != 0x1234abcd
43
#  error bad long ucs   /* { dg-bogus "bad" "bad U1234abcd evaluation" } */
44
# endif
45
#endif
46
 
47
void foo ()
48
{
49
  int c;
50
 
51
  c = L'\ubad';         /* { dg-error "incomplete" "incomplete UCN 1" } */
52
  c = L"\U1234"[0];      /* { dg-error "incomplete" "incompete UCN 2" } */
53
 
54
  c = L'\u000x';        /* { dg-error "incomplete" "non-hex digit in UCN" } */
55
  /* If sizeof(HOST_WIDE_INT) > sizeof(wchar_t), we can get a multi-character
56
     constant warning even for wide characters.  */
57
  /* { dg-warning "too long|multi-character" "" { target *-*-* } 54 } */
58
 
59
  c = '\u0024';         /* { dg-bogus "invalid" "0024 is a valid UCN" } */
60
  c = "\u0040"[0];       /* { dg-bogus "invalid" "0040 is a valid UCN" } */
61
  c = L'\u00a0';        /* { dg-bogus "invalid" "00a0 is a valid UCN" } */
62
  c = '\U00000060';     /* { dg-bogus "invalid" "0060 is a valid UCN" } */
63
 
64
  c = '\u0025';         /* { dg-error "not a valid" "0025 invalid UCN" } */
65
  c = L"\uD800"[0];      /* { dg-error "not a valid" "D800 invalid UCN" } */
66
  c = L'\U0000DFFF';    /* { dg-error "not a valid" "DFFF invalid UCN" } */
67
}

powered by: WebSVN 2.1.0

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