PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / gcc.dg / Wsign-compare-1.c
blobbe3bd2fcbd8d9febc336e72cac8b9165d2e3ca06
1 /* PR c/81417 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wsign-compare -fdiagnostics-show-caret" } */
5 unsigned int
6 f0 (int x, unsigned int y)
8 return x ? y : -1; /* { dg-warning "18:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */
9 /* { dg-begin-multiline-output "" }
10 return x ? y : -1;
12 { dg-end-multiline-output "" } */
15 unsigned int
16 f1 (int xxx, unsigned int yyy)
18 return xxx ? yyy : -1; /* { dg-warning "22:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */
19 /* { dg-begin-multiline-output "" }
20 return xxx ? yyy : -1;
22 { dg-end-multiline-output "" } */
25 unsigned int
26 f2 (int xxx, unsigned int yyy)
28 return xxx ? -1 : yyy; /* { dg-warning "16:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */
29 /* { dg-begin-multiline-output "" }
30 return xxx ? -1 : yyy;
32 { dg-end-multiline-output "" } */
35 unsigned int
36 f3 (unsigned int yyy)
38 return yyy ?: -1; /* { dg-warning "17:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */
39 /* { dg-begin-multiline-output "" }
40 return yyy ?: -1;
42 { dg-end-multiline-output "" } */
45 unsigned int
46 f4 (int xxx, unsigned yyy, short uuu)
48 return xxx ? yyy : uuu; /* { dg-warning "22:operand of \\?: changes signedness from 'short int' to 'unsigned int'" } */
49 /* { dg-begin-multiline-output "" }
50 return xxx ? yyy : uuu;
51 ^~~
52 { dg-end-multiline-output "" } */
55 unsigned int
56 f5 (int xxx, unsigned yyy, short uuu)
58 return xxx ? uuu : yyy; /* { dg-warning "16:operand of \\?: changes signedness from 'short int' to 'unsigned int'" } */
59 /* { dg-begin-multiline-output "" }
60 return xxx ? uuu : yyy;
61 ^~~
62 { dg-end-multiline-output "" } */
65 unsigned int
66 f6 (int xxx, unsigned yyy, signed char uuu)
68 return xxx ? yyy : uuu; /* { dg-warning "22:operand of \\?: changes signedness from 'signed char' to 'unsigned int'" } */
69 /* { dg-begin-multiline-output "" }
70 return xxx ? yyy : uuu;
71 ^~~
72 { dg-end-multiline-output "" } */
75 unsigned int
76 f7 (int xxx, unsigned yyy, signed char uuu)
78 return xxx ? uuu : yyy; /* { dg-warning "16:operand of \\?: changes signedness from 'signed char' to 'unsigned int'" } */
79 /* { dg-begin-multiline-output "" }
80 return xxx ? uuu : yyy;
81 ^~~
82 { dg-end-multiline-output "" } */