File: constants.c

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-16
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,496,368 kB
  • sloc: cpp: 5,593,980; ansic: 986,873; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,547; xml: 953; cs: 573; fortran: 567
file content (74 lines) | stat: -rw-r--r-- 2,051 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// RUN: %clang_cc1 -fsyntax-only -verify -Wfour-char-constants -pedantic -ftrigraphs %s

int x = 000000080;  // expected-error {{invalid digit}}

int y = 0000\
00080;             // expected-error {{invalid digit}}



float X = 1.17549435e-38F;
float Y = 08.123456;

// PR2252
#if -0x8000000000000000  // should not warn.
#endif
#if -01000000000000000000000  // should not warn.
#endif
#if 9223372036854775808 // expected-warning {{integer literal is too large to be represented in a signed integer type, interpreting as unsigned}}
#endif
#if 0x10000000000000000 // expected-error {{integer literal is too large to be represented in any integer type}}
#endif

int c[] = {
  'df',   // expected-warning {{multi-character character constant}}
  '\t',
  '\\
t',
  '??!',  // expected-warning {{trigraph converted to '|' character}}
  'abcd'  // expected-warning {{multi-character character constant}}
};

//  PR4499
int m0 = '0';
int m1 = '\\\''; // expected-warning {{multi-character character constant}}
int m2 = '\\\\'; // expected-warning {{multi-character character constant}}
int m3 = '\\\
';


#pragma clang diagnostic ignored "-Wmultichar"

int d = 'df'; // no warning.
int e = 'abcd';  // still warn: expected-warning {{multi-character character constant}}

#pragma clang diagnostic ignored "-Wfour-char-constants"

int f = 'abcd';  // ignored.

// rdar://problem/6974641
float t0[] = {
  1.9e20f,
  1.9e-20f,
  1.9e50f,   // expected-warning {{too large}}
  1.9e-50f,  // expected-warning {{too small}}
  -1.9e20f,
  -1.9e-20f,
  -1.9e50f,  // expected-warning {{too large}}
  -1.9e-50f  // expected-warning {{too small}}
};
double t1[] = {
  1.9e50,
  1.9e-50,
  1.9e500,   // expected-warning {{too large}}
  1.9e-500,  // expected-warning {{too small}}
  -1.9e50,
  -1.9e-50,
  -1.9e500,  // expected-warning {{too large}}
  -1.9e-500  // expected-warning {{too small}}
};

// PR7888
double g = 1e100000000; // expected-warning {{too large}}

char h = '\u1234'; // expected-error {{character too large for enclosing character literal type}}