File: utf-cvt.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (59 lines) | stat: -rw-r--r-- 2,012 bytes parent folder | download | duplicates (4)
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
/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
/* Test the char16_t and char32_t promotion rules. */
/* { dg-do compile } */
/* { dg-require-effective-target int32plus } */
/* { dg-options "-std=gnu99 -Wall -Wconversion -Wsign-conversion" } */

typedef __CHAR16_TYPE__ char16_t;
typedef __CHAR32_TYPE__ char32_t;

extern void f_c (char);
extern void fsc (signed char);
extern void fuc (unsigned char);
extern void f_s (short);
extern void fss (signed short);
extern void fus (unsigned short);
extern void f_i (int);
extern void fsi (signed int);
extern void fui (unsigned int);
extern void f_l (long);
extern void fsl (signed long);
extern void ful (unsigned long);
extern void f_ll (long long);
extern void fsll (signed long long);
extern void full (unsigned long long);

void m (char16_t c0, char32_t c1)
{
    f_c (c0);	/* { dg-warning "conversion from .char16_t\[^\n\r\]*. to .char. may change value" } */
    fsc (c0);	/* { dg-warning "may change value" } */
    fuc (c0);	/* { dg-warning "may change value" } */
    f_s (c0);	/* { dg-warning "change the sign" } */
    fss (c0);	/* { dg-warning "change the sign" } */
    fus (c0);
    f_i (c0);
    fsi (c0);
    fui (c0);
    f_l (c0);
    fsl (c0);
    ful (c0);
    f_ll (c0);
    fsll (c0);
    full (c0);

    f_c (c1);	/* { dg-warning "may change value" } */
    fsc (c1);	/* { dg-warning "may change value" } */
    fuc (c1);	/* { dg-warning "may change value" } */
    f_s (c1);	/* { dg-warning "may change value" } */
    fss (c1);	/* { dg-warning "may change value" } */
    fus (c1);	/* { dg-warning "may change value" } */
    f_i (c1);	/* { dg-warning "change the sign" "" { target { ! int16 } } } */
    fsi (c1);	/* { dg-warning "change the sign" "" { target { ! int16 } } } */
    fui (c1);
    f_l (c1);	/* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
    fsl (c1);	/* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
    ful (c1);
    f_ll (c1);
    fsll (c1);
    full (c1);
}