]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/Wsign-compare-1.c
gcc/ada/ChangeLog:
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / Wsign-compare-1.c
CommitLineData
cb4d9ee2 1/* PR c/81417 */
2/* { dg-do compile } */
3/* { dg-options "-Wsign-compare -fdiagnostics-show-caret" } */
4
5unsigned int
6f0 (int x, unsigned int y)
7{
85b9be9b 8 return x ? y : -1; /* { dg-warning "18:operand of '\\?:' changes signedness from 'int' to 'unsigned int'" } */
cb4d9ee2 9/* { dg-begin-multiline-output "" }
10 return x ? y : -1;
11 ^~
12 { dg-end-multiline-output "" } */
13}
14
15unsigned int
16f1 (int xxx, unsigned int yyy)
17{
85b9be9b 18 return xxx ? yyy : -1; /* { dg-warning "22:operand of '\\?:' changes signedness from 'int' to 'unsigned int'" } */
cb4d9ee2 19/* { dg-begin-multiline-output "" }
20 return xxx ? yyy : -1;
21 ^~
22 { dg-end-multiline-output "" } */
23}
24
25unsigned int
26f2 (int xxx, unsigned int yyy)
27{
85b9be9b 28 return xxx ? -1 : yyy; /* { dg-warning "16:operand of '\\?:' changes signedness from 'int' to 'unsigned int'" } */
cb4d9ee2 29/* { dg-begin-multiline-output "" }
30 return xxx ? -1 : yyy;
31 ^~
32 { dg-end-multiline-output "" } */
33}
34
35unsigned int
36f3 (unsigned int yyy)
37{
85b9be9b 38 return yyy ?: -1; /* { dg-warning "17:operand of '\\?:' changes signedness from 'int' to 'unsigned int'" } */
cb4d9ee2 39/* { dg-begin-multiline-output "" }
40 return yyy ?: -1;
41 ^~
42 { dg-end-multiline-output "" } */
43}
44
45unsigned int
46f4 (int xxx, unsigned yyy, short uuu)
47{
85b9be9b 48 return xxx ? yyy : uuu; /* { dg-warning "22:operand of '\\?:' changes signedness from 'short int' to 'unsigned int'" } */
cb4d9ee2 49/* { dg-begin-multiline-output "" }
50 return xxx ? yyy : uuu;
51 ^~~
52 { dg-end-multiline-output "" } */
53}
54
55unsigned int
56f5 (int xxx, unsigned yyy, short uuu)
57{
85b9be9b 58 return xxx ? uuu : yyy; /* { dg-warning "16:operand of '\\?:' changes signedness from 'short int' to 'unsigned int'" } */
cb4d9ee2 59/* { dg-begin-multiline-output "" }
60 return xxx ? uuu : yyy;
61 ^~~
62 { dg-end-multiline-output "" } */
63}
64
65unsigned int
66f6 (int xxx, unsigned yyy, signed char uuu)
67{
85b9be9b 68 return xxx ? yyy : uuu; /* { dg-warning "22:operand of '\\?:' changes signedness from 'signed char' to 'unsigned int'" } */
cb4d9ee2 69/* { dg-begin-multiline-output "" }
70 return xxx ? yyy : uuu;
71 ^~~
72 { dg-end-multiline-output "" } */
73}
74
75unsigned int
76f7 (int xxx, unsigned yyy, signed char uuu)
77{
85b9be9b 78 return xxx ? uuu : yyy; /* { dg-warning "16:operand of '\\?:' changes signedness from 'signed char' to 'unsigned int'" } */
cb4d9ee2 79/* { dg-begin-multiline-output "" }
80 return xxx ? uuu : yyy;
81 ^~~
82 { dg-end-multiline-output "" } */
83}