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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [cpp/] [charconst-3.c] - Blame information for rev 801

Go to most recent revision | 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 run } */
4
/* { dg-options -Wno-multichar } */
5
 
6
/* This tests values and signedness of multichar charconsts.
7
 
8
   Neil Booth, 5 May 2002.  */
9
 
10
#include <limits.h>
11
 
12
extern void abort (void);
13
 
14
int main ()
15
{
16
  /* These tests require at least 2-byte ints.  8-)  */
17
#if INT_MAX > 127
18
  int scale = (int) (unsigned char) -1 + 1;
19
 
20
  if ('ab' != (int) ((unsigned char) 'a' * scale + (unsigned char) 'b'))
21
    abort ();
22
 
23
  if ('\234b' != (int) ((unsigned char) '\234' * scale + (unsigned char) 'b'))
24
    abort ();
25
 
26
  if ('b\234' != (int) ((unsigned char) 'b' * scale + (unsigned char) '\234'))
27
    abort ();
28
  /* Multichar charconsts have type int and should be signed.  */
29
#if INT_MAX == 32767
30
# if '\234a' > 0
31
#  error Preprocessor charconsts 1
32
# endif
33
  if ('\234a' > 0)
34
    abort ();
35
#elif INT_MAX == 2147483647
36
# if '\234aaa' > 0
37
#  error Preprocessor charconsts 2
38
# endif
39
  if ('\234aaa' > 0)
40
    abort ();
41
#elif INT_MAX == 9223372036854775807
42
# if '\234aaaaaaa' > 0
43
#  error Preprocessor charconsts 3
44
# endif
45
  if ('\234aaaaaaa' > 0)
46
    abort ();
47
#endif
48
#endif
49
  return 0;
50
}

powered by: WebSVN 2.1.0

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