tests/lint: expect complete messages in feature tests

Previously, the tests contained many comments like /* expect: 123 */,
which were useless to a casual reader since nobody is expected to learn
lint's message IDs by heart.  Replace these with the complete
diagnostics, to show what lint is complaining about.

The tests named msg_*.c have been left unmodified since they mention the
full message text in their header comment.

No functional change.
This commit is contained in:
rillig 2022-01-15 14:22:03 +00:00
parent 250e8719cd
commit a4a927ac8f
65 changed files with 851 additions and 587 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: c11_generic_expression.c,v 1.10 2021/08/01 21:12:31 rillig Exp $ */
/* $NetBSD: c11_generic_expression.c,v 1.11 2022/01/15 14:22:03 rillig Exp $ */
# 3 "c11_generic_expression.c"
/*
@ -69,7 +69,8 @@ classify_char(char c)
const int *
comma_expression(char first, double second)
{
return _Generic(first, second, /* expect: syntax error 'second' */
/* expect+1: error: syntax error 'second' [249] */
return _Generic(first, second,
char: "first",
double: 2.0
);

View File

@ -2,5 +2,5 @@ c11_generic_expression.c(29): warning: function 'classify_type_without_default'
c11_generic_expression.c(21): warning: argument 'var' unused in function 'classify_type_without_default' [231]
c11_generic_expression.c(37): warning: argument 'var' unused in function 'classify_type_with_default' [231]
c11_generic_expression.c(53): warning: argument 'c' unused in function 'classify_char' [231]
c11_generic_expression.c(72): error: syntax error 'second' [249]
c11_generic_expression.c(77): warning: function comma_expression falls off bottom without returning value [217]
c11_generic_expression.c(73): error: syntax error 'second' [249]
c11_generic_expression.c(78): warning: function comma_expression falls off bottom without returning value [217]

View File

@ -1,4 +1,4 @@
/* $NetBSD: c99_init_designator.c,v 1.1 2021/06/20 18:09:48 rillig Exp $ */
/* $NetBSD: c99_init_designator.c,v 1.2 2022/01/15 14:22:03 rillig Exp $ */
# 3 "c99_init_designator.c"
/*
@ -21,7 +21,8 @@ struct point {
*/
struct point origin = {
.x = 0,
->y = 0, /* expect: syntax error '->' */
/* expect+1: error: syntax error '->' [249] */
->y = 0,
};
/* Ensure that the parser can recover from the parse error. */

View File

@ -1 +1 @@
c99_init_designator.c(24): error: syntax error '->' [249]
c99_init_designator.c(25): error: syntax error '->' [249]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_c99_bool.c,v 1.7 2021/03/30 14:25:28 rillig Exp $ */
/* $NetBSD: d_c99_bool.c,v 1.8 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_c99_bool.c"
/*
@ -12,19 +12,24 @@
/* Below, each false statement produces "negative array dimension" [20]. */
int int_0_converts_to_false[(_Bool)0 ? -1 : 1];
int int_0_converts_to_true_[(_Bool)0 ? 1 : -1]; /* expect: 20 */
/* expect+1: error: negative array dimension (-1) [20] */
int int_0_converts_to_true_[(_Bool)0 ? 1 : -1];
int int_1_converts_to_false[(_Bool)1 ? -1 : 1]; /* expect: 20 */
/* expect+1: error: negative array dimension (-1) [20] */
int int_1_converts_to_false[(_Bool)1 ? -1 : 1];
int int_1_converts_to_true_[(_Bool)1 ? 1 : -1];
int int_2_converts_to_false[(_Bool)2 ? -1 : 1]; /* expect: 20 */
/* expect+1: error: negative array dimension (-1) [20] */
int int_2_converts_to_false[(_Bool)2 ? -1 : 1];
int int_2_converts_to_true_[(_Bool)2 ? 1 : -1];
int int_256_converts_to_false[(_Bool)256 ? -1 : 1]; /* expect: 20 */
/* expect+1: error: negative array dimension (-1) [20] */
int int_256_converts_to_false[(_Bool)256 ? -1 : 1];
int int_256_converts_to_true_[(_Bool)256 ? 1 : -1];
int null_pointer_converts_to_false[(_Bool)(void *)0 ? -1 : 1];
int null_pointer_converts_to_true_[(_Bool)(void *)0 ? 1 : -1]; /* expect: 20 */
/* expect+1: error: negative array dimension (-1) [20] */
int null_pointer_converts_to_true_[(_Bool)(void *)0 ? 1 : -1];
/*
* XXX: lint does not treat the address of a global variable as a constant
@ -38,23 +43,29 @@ char ch;
int nonnull_pointer_converts_to_false[(_Bool)&ch ? -1 : 1];
int nonnull_pointer_converts_to_true_[(_Bool)&ch ? 1 : -1];
int double_minus_1_0_converts_to_false[(_Bool)-1.0 ? -1 : 1]; /* expect: 20 */
/* expect+1: error: negative array dimension (-1) [20] */
int double_minus_1_0_converts_to_false[(_Bool)-1.0 ? -1 : 1];
int double_minus_1_0_converts_to_true_[(_Bool)-1.0 ? 1 : -1];
int double_minus_0_5_converts_to_false[(_Bool)-0.5 ? -1 : 1]; /* expect: 20 */
/* expect+1: error: negative array dimension (-1) [20] */
int double_minus_0_5_converts_to_false[(_Bool)-0.5 ? -1 : 1];
int double_minus_0_5_converts_to_true_[(_Bool)-0.5 ? 1 : -1];
int double_minus_0_0_converts_to_false[(_Bool)-0.0 ? -1 : 1];
int double_minus_0_0_converts_to_true_[(_Bool)-0.0 ? 1 : -1]; /* expect: 20 */
/* expect+1: error: negative array dimension (-1) [20] */
int double_minus_0_0_converts_to_true_[(_Bool)-0.0 ? 1 : -1];
int double_0_0_converts_to_false[(_Bool)0.0 ? -1 : 1];
int double_0_0_converts_to_true_[(_Bool)0.0 ? 1 : -1]; /* expect: 20 */
/* expect+1: error: negative array dimension (-1) [20] */
int double_0_0_converts_to_true_[(_Bool)0.0 ? 1 : -1];
/* The C99 rationale explains in 6.3.1.2 why (_Bool)0.5 is true. */
int double_0_5_converts_to_false[(_Bool)0.5 ? -1 : 1]; /* expect: 20 */
/* expect+1: error: negative array dimension (-1) [20] */
int double_0_5_converts_to_false[(_Bool)0.5 ? -1 : 1];
int double_0_5_converts_to_true_[(_Bool)0.5 ? 1 : -1];
int double_1_0_converts_to_false[(_Bool)1.0 ? -1 : 1]; /* expect: 20 */
/* expect+1: error: negative array dimension (-1) [20] */
int double_1_0_converts_to_false[(_Bool)1.0 ? -1 : 1];
int double_1_0_converts_to_true_[(_Bool)1.0 ? 1 : -1];
_Bool

View File

@ -1,11 +1,11 @@
d_c99_bool.c(15): error: negative array dimension (-1) [20]
d_c99_bool.c(17): error: negative array dimension (-1) [20]
d_c99_bool.c(20): error: negative array dimension (-1) [20]
d_c99_bool.c(16): error: negative array dimension (-1) [20]
d_c99_bool.c(19): error: negative array dimension (-1) [20]
d_c99_bool.c(23): error: negative array dimension (-1) [20]
d_c99_bool.c(27): error: negative array dimension (-1) [20]
d_c99_bool.c(41): error: negative array dimension (-1) [20]
d_c99_bool.c(44): error: negative array dimension (-1) [20]
d_c99_bool.c(48): error: negative array dimension (-1) [20]
d_c99_bool.c(32): error: negative array dimension (-1) [20]
d_c99_bool.c(47): error: negative array dimension (-1) [20]
d_c99_bool.c(51): error: negative array dimension (-1) [20]
d_c99_bool.c(54): error: negative array dimension (-1) [20]
d_c99_bool.c(57): error: negative array dimension (-1) [20]
d_c99_bool.c(56): error: negative array dimension (-1) [20]
d_c99_bool.c(60): error: negative array dimension (-1) [20]
d_c99_bool.c(64): error: negative array dimension (-1) [20]
d_c99_bool.c(68): error: negative array dimension (-1) [20]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_c99_bool_strict.c,v 1.35 2021/11/20 17:27:46 rillig Exp $ */
/* $NetBSD: d_c99_bool_strict.c,v 1.36 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_c99_bool_strict.c"
/*
@ -124,29 +124,38 @@ strict_bool_constant(void)
{
accept_bool(__lint_false);
accept_bool(__lint_true);
accept_bool(0); /* expect: 334 */
accept_bool(1); /* expect: 334 */
accept_bool(2); /* expect: 334 */
/* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */
accept_bool(0);
/* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */
accept_bool(1);
/* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */
accept_bool(2);
}
enum strict_bool_constant_expressions {
/* Ok: __lint_false is a boolean constant expression. */
FALSE = __lint_false ? 100 : 101, /* expect: 161 */
/* expect+1: warning: constant in conditional context [161] */
FALSE = __lint_false ? 100 : 101,
/* Ok: __lint_true is a boolean constant expression. */
TRUE = __lint_true ? 100 : 101, /* expect: 161 */
/* expect+1: warning: constant in conditional context [161] */
TRUE = __lint_true ? 100 : 101,
/* Not ok: an integer is not a boolean constant expression. */
INT0 = 0 ? 100 : 101, /* expect: 331 */
/* expect+1: error: left operand of '?' must be bool, not 'int' [331] */
INT0 = 0 ? 100 : 101,
/* Not ok: an integer is not a boolean constant expression. */
INT1 = 1 ? 100 : 101, /* expect: 331 */
/* expect+1: error: left operand of '?' must be bool, not 'int' [331] */
INT1 = 1 ? 100 : 101,
/* Not ok: 2 is not a boolean constant. */
INT2 = 2 ? 100 : 101, /* expect: 331 */
/* expect+1: error: left operand of '?' must be bool, not 'int' [331] */
INT2 = 2 ? 100 : 101,
/* Not ok: compound integer expressions are not bool. */
ARITH = (2 - 2) ? 100 : 101, /* expect: 331 */
/* expect+1: error: left operand of '?' must be bool, not 'int' [331] */
ARITH = (2 - 2) ? 100 : 101,
/*
* Without strict bool mode, these two variants of an expression can
@ -156,32 +165,48 @@ enum strict_bool_constant_expressions {
* In strict bool mode, the resulting expression can be compared
* against 0 to achieve the same effect (so +0 != 0 or 1 + 0 != 0).
*/
BINARY_PLUS = (1 + 0) ? 100 : 101, /* expect: 331 */
UNARY_PLUS = (+0) ? 100 : 101, /* expect: 331 */
/* expect+1: error: left operand of '?' must be bool, not 'int' [331] */
BINARY_PLUS = (1 + 0) ? 100 : 101,
/* expect+1: error: left operand of '?' must be bool, not 'int' [331] */
UNARY_PLUS = (+0) ? 100 : 101,
/* The main operator '>' has return type bool. */
Q1 = (13 > 12) ? 100 : 101, /* expect: 161 */
/* expect+1: warning: constant in conditional context [161] */
Q1 = (13 > 12) ? 100 : 101,
/*
* The parenthesized expression has type int and thus cannot be
* used as the controlling expression in the '?:' operator.
*/
Q2 = (13 > 12 ? 1 : 7) ? 100 : 101, /* expect: 161 *//* expect: 331 */
/* expect+2: warning: constant in conditional context [161] */
/* expect+1: error: left operand of '?' must be bool, not 'int' [331] */
Q2 = (13 > 12 ? 1 : 7) ? 100 : 101,
BINAND_BOOL = __lint_false & __lint_true, /* expect: 55 */
/* expect+1: error: integral constant expression expected [55] */
BINAND_BOOL = __lint_false & __lint_true,
BINAND_INT = 0 & 1,
BINXOR_BOOL = __lint_false ^ __lint_true, /* expect: 55 */
/* expect+1: error: integral constant expression expected [55] */
BINXOR_BOOL = __lint_false ^ __lint_true,
BINXOR_INT = 0 ^ 1,
BINOR_BOOL = __lint_false | __lint_true, /* expect: 55 */
/* expect+1: error: integral constant expression expected [55] */
BINOR_BOOL = __lint_false | __lint_true,
BINOR_INT = 0 | 1,
LOGOR_BOOL = __lint_false || __lint_true, /* expect: 161 *//* expect: 55 */
LOGOR_INT = 0 || 1, /* expect: 331 *//* expect: 332 */
/* expect+2: warning: constant in conditional context [161] */
/* expect+1: error: integral constant expression expected [55] */
LOGOR_BOOL = __lint_false || __lint_true,
/* expect+2: error: left operand of '||' must be bool, not 'int' [331] */
/* expect+1: error: right operand of '||' must be bool, not 'int' [332] */
LOGOR_INT = 0 || 1,
LOGAND_BOOL = __lint_false && __lint_true, /* expect: 161 *//* expect: 55 */
LOGAND_INT = 0 && 1, /* expect: 331 *//* expect: 332 */
/* expect+2: warning: constant in conditional context [161] */
/* expect+1: error: integral constant expression expected [55] */
LOGAND_BOOL = __lint_false && __lint_true,
/* expect+2: error: left operand of '&&' must be bool, not 'int' [331] */
/* expect+1: error: right operand of '&&' must be bool, not 'int' [332] */
LOGAND_INT = 0 && 1,
};
/*
@ -201,14 +226,18 @@ strict_bool_bit_fields(void)
bool b;
b = flags.bool_flag;
b = flags.uint_flag; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (_Bool != unsigned int) [107] */
b = flags.uint_flag;
flags.bool_flag = b;
flags.uint_flag = b; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (unsigned int != _Bool) [107] */
flags.uint_flag = b;
b = flags_ptr->bool_flag;
b = flags_ptr->uint_flag; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (_Bool != unsigned int) [107] */
b = flags_ptr->uint_flag;
flags_ptr->bool_flag = b;
flags_ptr->uint_flag = b; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (unsigned int != _Bool) [107] */
flags_ptr->uint_flag = b;
}
void
@ -250,37 +279,44 @@ strict_bool_conversion_return_bool(bool b)
bool
strict_bool_conversion_return_0(void)
{
return 0; /* expect: 211 */
/* expect+1: error: return value type mismatch (_Bool) and (int) [211] */
return 0;
}
bool
strict_bool_conversion_return_1(void)
{
return 1; /* expect: 211 */
/* expect+1: error: return value type mismatch (_Bool) and (int) [211] */
return 1;
}
bool
strict_bool_conversion_return_2(void)
{
return 2; /* expect: 211 */
/* expect+1: error: return value type mismatch (_Bool) and (int) [211] */
return 2;
}
/* expect+2: warning: argument 'p' unused in function 'strict_bool_conversion_return_pointer' [231] */
bool
strict_bool_conversion_return_pointer(const void *p) /* expect: 231 */
strict_bool_conversion_return_pointer(const void *p)
{
return p; /* expect: 211 */
/* expect+1: error: return value type mismatch (_Bool) and (pointer) [211] */
return p;
}
char
strict_bool_conversion_return_false_as_char(void)
{
return __lint_false; /* expect: 211 */
/* expect+1: error: return value type mismatch (char) and (_Bool) [211] */
return __lint_false;
}
char
strict_bool_conversion_return_true_as_char(void)
{
return __lint_true; /* expect: 211 */
/* expect+1: error: return value type mismatch (char) and (_Bool) [211] */
return __lint_true;
}
@ -298,16 +334,23 @@ strict_bool_conversion_function_argument_pass(bool b, int i, const char *p)
take_arguments(b, i, p);
/* Implicitly converting bool to other scalar types. */
take_arguments(b, b, b); /* expect: 334 *//* expect: 334 */
/* expect+2: error: argument #2 expects 'int', gets passed '_Bool' [334] */
/* expect+1: error: argument #3 expects 'pointer', gets passed '_Bool' [334] */
take_arguments(b, b, b);
/* Implicitly converting int to bool (arg #1). */
take_arguments(i, i, i); /* expect: 334 *//* expect: 154 */
/* expect+2: error: argument #1 expects '_Bool', gets passed 'int' [334] */
/* expect+1: warning: illegal combination of pointer (pointer to const char) and integer (int), arg #3 [154] */
take_arguments(i, i, i);
/* Implicitly converting pointer to bool (arg #1). */
take_arguments(p, p, p); /* expect: 334 *//* expect: 154 */
/* expect+2: error: argument #1 expects '_Bool', gets passed 'pointer' [334] */
/* expect+1: warning: illegal combination of integer (int) and pointer (pointer to const char), arg #2 [154] */
take_arguments(p, p, p);
/* Passing bool as vararg. */
take_arguments(b, i, p, b, i, p); /* TODO: expect: arg#4 */
/* TODO: maybe expect+1: arg#4 should not be bool but scalar */
take_arguments(b, i, p, b, i, p);
/* Passing a bool constant. */
take_arguments(__lint_false, i, p);
@ -316,9 +359,12 @@ strict_bool_conversion_function_argument_pass(bool b, int i, const char *p)
take_arguments(__lint_true, i, p);
/* Trying to pass integer constants. */
take_arguments(0, i, p); /* expect: 334 */
take_arguments(1, i, p); /* expect: 334 */
take_arguments(2, i, p); /* expect: 334 */
/* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */
take_arguments(0, i, p);
/* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */
take_arguments(1, i, p);
/* expect+1: error: argument #1 expects '_Bool', gets passed 'int' [334] */
take_arguments(2, i, p);
}
void
@ -327,32 +373,43 @@ strict_bool_conversion_between_bool_and_int(void)
bool b;
int i;
b = 0; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (_Bool != int) [107] */
b = 0;
b = __lint_false;
b = 1; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (_Bool != int) [107] */
b = 1;
b = __lint_true;
i = 0;
i = __lint_false; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (int != _Bool) [107] */
i = __lint_false;
i = 1;
i = __lint_true; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (int != _Bool) [107] */
i = __lint_true;
i = b; /* expect: 107 */
b = i; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (int != _Bool) [107] */
i = b;
/* expect+1: error: operands of '=' have incompatible types (_Bool != int) [107] */
b = i;
}
/* expect+2: warning: argument 'b' unused in function 'strict_bool_conversion_from_bool_to_scalar' [231] */
void
strict_bool_conversion_from_bool_to_scalar(bool b) /* expect: 231 */
strict_bool_conversion_from_bool_to_scalar(bool b)
{
int i;
unsigned u;
double d;
void *p;
i = b; /* expect: 107 */
u = b; /* expect: 107 */
d = b; /* expect: 107 */
p = b; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (int != _Bool) [107] */
i = b;
/* expect+1: error: operands of '=' have incompatible types (unsigned int != _Bool) [107] */
u = b;
/* expect+1: error: operands of '=' have incompatible types (double != _Bool) [107] */
d = b;
/* expect+1: error: operands of '=' have incompatible types (pointer != _Bool) [107] */
p = b;
}
/*
@ -364,38 +421,48 @@ strict_bool_conversion_from_bool_to_scalar(bool b) /* expect: 231 */
void
strict_bool_controlling_expression(bool b, int i, double d, const void *p)
{
if (__lint_false) /* expect: 161 */
do_nothing(); /* expect: statement not reached */
/* expect+1: warning: constant in conditional context [161] */
if (__lint_false)
do_nothing();
/* expect-1: warning: statement not reached [193] */
if (__lint_true) /* expect: 161 */
/* expect+1: warning: constant in conditional context [161] */
if (__lint_true)
do_nothing();
if (b)
do_nothing();
if (/*CONSTCOND*/0) /* expect: 333 */
do_nothing(); /* expect: statement not reached [193] */
/* expect+1: error: controlling expression must be bool, not 'int' [333] */
if (/*CONSTCOND*/0)
do_nothing();
/* expect-1: warning: statement not reached [193] */
if (/*CONSTCOND*/1) /* expect: 333 */
/* expect+1: error: controlling expression must be bool, not 'int' [333] */
if (/*CONSTCOND*/1)
do_nothing();
if (/*CONSTCOND*/2) /* expect: 333 */
/* expect+1: error: controlling expression must be bool, not 'int' [333] */
if (/*CONSTCOND*/2)
do_nothing();
/* Not allowed: There is no implicit conversion from scalar to bool. */
if (i) /* expect: 333 */
/* expect+1: error: controlling expression must be bool, not 'int' [333] */
if (i)
do_nothing();
if (i != 0)
do_nothing();
/* Not allowed: There is no implicit conversion from scalar to bool. */
if (d) /* expect: 333 */
/* expect+1: error: controlling expression must be bool, not 'double' [333] */
if (d)
do_nothing();
if (d != 0.0)
do_nothing();
/* Not allowed: There is no implicit conversion from scalar to bool. */
if (p) /* expect: 333 */
/* expect+1: error: controlling expression must be bool, not 'pointer' [333] */
if (p)
do_nothing();
if (p != (void *)0)
do_nothing();
@ -416,15 +483,23 @@ strict_bool_operand_unary_not(void)
b = !b;
b = !!!b;
b = !__lint_false; /* expect: 161 *//* expect: 239 */
b = !__lint_true; /* expect: 161 *//* expect: 239 */
/* expect+2: warning: constant in conditional context [161] */
/* expect+1: warning: constant argument to '!' [239] */
b = !__lint_false;
/* expect+2: warning: constant in conditional context [161] */
/* expect+1: warning: constant argument to '!' [239] */
b = !__lint_true;
int i = 0;
i = !i; /* expect: 330 */
i = !!!i; /* expect: 330 */
i = !0; /* expect: 330 */
i = !1; /* expect: 330 */
/* expect+1: error: operand of '!' must be bool, not 'int' [330] */
i = !i;
/* expect+1: error: operand of '!' must be bool, not 'int' [330] */
i = !!!i;
/* expect+1: error: operand of '!' must be bool, not 'int' [330] */
i = !0;
/* expect+1: error: operand of '!' must be bool, not 'int' [330] */
i = !1;
}
void
@ -479,13 +554,15 @@ strict_bool_operand_binary_dot_arrow(void)
struct bool_struct bs = { __lint_true };
b = bs.b;
bs.b = b;
bs.b = 0; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (_Bool != int) [107] */
bs.b = 0;
/* Access a struct member using the '->' operator. */
struct bool_struct *bsp = &bs;
b = bsp->b;
bsp->b = b;
bsp->b = 0; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (_Bool != int) [107] */
bsp->b = 0;
}
int
@ -501,14 +578,23 @@ strict_bool_operand_binary(bool b, int i)
* The right-hand sides of these assignments implicitly convert from
* scalar to bool.
*/
b = !i; /* expect: 330 */
b = i && i; /* expect: 331 *//* expect: 332 */
b = i || i; /* expect: 331 *//* expect: 332 */
/* expect+1: error: operand of '!' must be bool, not 'int' [330] */
b = !i;
/* expect+2: error: left operand of '&&' must be bool, not 'int' [331] */
/* expect+1: error: right operand of '&&' must be bool, not 'int' [332] */
b = i && i;
/* expect+2: error: left operand of '||' must be bool, not 'int' [331] */
/* expect+1: error: right operand of '||' must be bool, not 'int' [332] */
b = i || i;
b = b && 0; /* expect: 332 */
b = 0 && b; /* expect: 331 */
b = b || 0; /* expect: 332 */
b = 0 || b; /* expect: 331 */
/* expect+1: error: right operand of '&&' must be bool, not 'int' [332] */
b = b && 0;
/* expect+1: error: left operand of '&&' must be bool, not 'int' [331] */
b = 0 && b;
/* expect+1: error: right operand of '||' must be bool, not 'int' [332] */
b = b || 0;
/* expect+1: error: left operand of '||' must be bool, not 'int' [331] */
b = 0 || b;
return i;
}
@ -517,30 +603,59 @@ void
strict_bool_operand_unary_all(bool b)
{
b = !b;
b = ~b; /* expect: 335 */
++b; /* expect: 335 */
--b; /* expect: 335 */
b++; /* expect: 335 */
b--; /* expect: 335 */
b = +b; /* expect: 335 */
b = -b; /* expect: 335 */
/* expect+1: error: operand of '~' must not be bool [335] */
b = ~b;
/* expect+1: error: operand of '++x' must not be bool [335] */
++b;
/* expect+1: error: operand of '--x' must not be bool [335] */
--b;
/* expect+1: error: operand of 'x++' must not be bool [335] */
b++;
/* expect+1: error: operand of 'x--' must not be bool [335] */
b--;
/* expect+1: error: operand of '+' must not be bool [335] */
b = +b;
/* expect+1: error: operand of '-' must not be bool [335] */
b = -b;
}
void
strict_bool_operand_binary_all(bool b, unsigned u)
{
b = b * b; /* expect: 336 *//* expect: 337 */
b = b / b; /* expect: 336 *//* expect: 337 */
b = b % b; /* expect: 336 *//* expect: 337 */
b = b + b; /* expect: 336 *//* expect: 337 */
b = b - b; /* expect: 336 *//* expect: 337 */
b = b << b; /* expect: 336 *//* expect: 337 */
b = b >> b; /* expect: 336 *//* expect: 337 */
/* expect+2: error: left operand of '*' must not be bool [336] */
/* expect+1: error: right operand of '*' must not be bool [337] */
b = b * b;
/* expect+2: error: left operand of '/' must not be bool [336] */
/* expect+1: error: right operand of '/' must not be bool [337] */
b = b / b;
/* expect+2: error: left operand of '%' must not be bool [336] */
/* expect+1: error: right operand of '%' must not be bool [337] */
b = b % b;
/* expect+2: error: left operand of '+' must not be bool [336] */
/* expect+1: error: right operand of '+' must not be bool [337] */
b = b + b;
/* expect+2: error: left operand of '-' must not be bool [336] */
/* expect+1: error: right operand of '-' must not be bool [337] */
b = b - b;
/* expect+2: error: left operand of '<<' must not be bool [336] */
/* expect+1: error: right operand of '<<' must not be bool [337] */
b = b << b;
/* expect+2: error: left operand of '>>' must not be bool [336] */
/* expect+1: error: right operand of '>>' must not be bool [337] */
b = b >> b;
b = b < b; /* expect: 336 *//* expect: 337 */
b = b <= b; /* expect: 336 *//* expect: 337 */
b = b > b; /* expect: 336 *//* expect: 337 */
b = b >= b; /* expect: 336 *//* expect: 337 */
/* expect+2: error: left operand of '<' must not be bool [336] */
/* expect+1: error: right operand of '<' must not be bool [337] */
b = b < b;
/* expect+2: error: left operand of '<=' must not be bool [336] */
/* expect+1: error: right operand of '<=' must not be bool [337] */
b = b <= b;
/* expect+2: error: left operand of '>' must not be bool [336] */
/* expect+1: error: right operand of '>' must not be bool [337] */
b = b > b;
/* expect+2: error: left operand of '>=' must not be bool [336] */
/* expect+1: error: right operand of '>=' must not be bool [337] */
b = b >= b;
b = b == b;
b = b != b;
@ -552,42 +667,74 @@ strict_bool_operand_binary_all(bool b, unsigned u)
b = b ? b : b;
b = b;
b *= b; /* expect: 336 *//* expect: 337 */
b /= b; /* expect: 336 *//* expect: 337 */
b %= b; /* expect: 336 *//* expect: 337 */
b += b; /* expect: 336 *//* expect: 337 */
b -= b; /* expect: 336 *//* expect: 337 */
b <<= b; /* expect: 336 *//* expect: 337 */
b >>= b; /* expect: 336 *//* expect: 337 */
/* expect+2: error: left operand of '*=' must not be bool [336] */
/* expect+1: error: right operand of '*=' must not be bool [337] */
b *= b;
/* expect+2: error: left operand of '/=' must not be bool [336] */
/* expect+1: error: right operand of '/=' must not be bool [337] */
b /= b;
/* expect+2: error: left operand of '%=' must not be bool [336] */
/* expect+1: error: right operand of '%=' must not be bool [337] */
b %= b;
/* expect+2: error: left operand of '+=' must not be bool [336] */
/* expect+1: error: right operand of '+=' must not be bool [337] */
b += b;
/* expect+2: error: left operand of '-=' must not be bool [336] */
/* expect+1: error: right operand of '-=' must not be bool [337] */
b -= b;
/* expect+2: error: left operand of '<<=' must not be bool [336] */
/* expect+1: error: right operand of '<<=' must not be bool [337] */
b <<= b;
/* expect+2: error: left operand of '>>=' must not be bool [336] */
/* expect+1: error: right operand of '>>=' must not be bool [337] */
b >>= b;
b &= b;
b ^= b;
b |= b;
/* Operations with mixed types. */
u = b * u; /* expect: 336 */
u = u * b; /* expect: 337 */
u = b / u; /* expect: 336 */
u = u / b; /* expect: 337 */
u = b % u; /* expect: 336 */
u = u % b; /* expect: 337 */
u = b + u; /* expect: 336 */
u = u + b; /* expect: 337 */
u = b - u; /* expect: 336 */
u = u - b; /* expect: 337 */
u = b << u; /* expect: 336 */
u = u << b; /* expect: 337 */
u = b >> u; /* expect: 336 */
u = u >> b; /* expect: 337 */
/* expect+1: error: left operand of '*' must not be bool [336] */
u = b * u;
/* expect+1: error: right operand of '*' must not be bool [337] */
u = u * b;
/* expect+1: error: left operand of '/' must not be bool [336] */
u = b / u;
/* expect+1: error: right operand of '/' must not be bool [337] */
u = u / b;
/* expect+1: error: left operand of '%' must not be bool [336] */
u = b % u;
/* expect+1: error: right operand of '%' must not be bool [337] */
u = u % b;
/* expect+1: error: left operand of '+' must not be bool [336] */
u = b + u;
/* expect+1: error: right operand of '+' must not be bool [337] */
u = u + b;
/* expect+1: error: left operand of '-' must not be bool [336] */
u = b - u;
/* expect+1: error: right operand of '-' must not be bool [337] */
u = u - b;
/* expect+1: error: left operand of '<<' must not be bool [336] */
u = b << u;
/* expect+1: error: right operand of '<<' must not be bool [337] */
u = u << b;
/* expect+1: error: left operand of '>>' must not be bool [336] */
u = b >> u;
/* expect+1: error: right operand of '>>' must not be bool [337] */
u = u >> b;
u = b ? u : u;
u = b ? b : u; /* expect: 107 */
u = b ? u : b; /* expect: 107 */
/* expect+1: error: operands of ':' have incompatible types (_Bool != unsigned int) [107] */
u = b ? b : u;
/* expect+1: error: operands of ':' have incompatible types (unsigned int != _Bool) [107] */
u = b ? u : b;
}
bool
strict_bool_operand_binary_comma(bool b, int i)
{
b = (b, !b); /* expect: 129 */
i = (i, i + 1); /* expect: 129 */
/* expect+1: warning: expression has null effect [129] */
b = (b, !b);
/* expect+1: warning: expression has null effect [129] */
i = (i, i + 1);
return b;
}
@ -600,10 +747,14 @@ strict_bool_operand_binary_comma(bool b, int i)
void
strict_bool_operator_result(bool b)
{
char c = b; /* expect: 107 */
int i = b; /* expect: 107 */
double d = b; /* expect: 107 */
void *p = b; /* expect: 107 */
/* expect+1: error: operands of 'init' have incompatible types (char != _Bool) [107] */
char c = b;
/* expect+1: error: operands of 'init' have incompatible types (int != _Bool) [107] */
int i = b;
/* expect+1: error: operands of 'init' have incompatible types (double != _Bool) [107] */
double d = b;
/* expect+1: error: operands of 'init' have incompatible types (pointer != _Bool) [107] */
void *p = b;
/* The right-hand sides of these assignments are all ok. */
b = !b;
@ -620,15 +771,24 @@ strict_bool_operator_result(bool b)
* The right-hand sides of these assignments are not ok, they
* implicitly convert from bool to int.
*/
i = !b; /* expect: 107 */
i = i == i; /* expect: 107 */
i = i != i; /* expect: 107 */
i = i < i; /* expect: 107 */
i = i <= i; /* expect: 107 */
i = i >= i; /* expect: 107 */
i = i > i; /* expect: 107 */
i = b && b; /* expect: 107 */
i = b || b; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (int != _Bool) [107] */
i = !b;
/* expect+1: error: operands of '=' have incompatible types (int != _Bool) [107] */
i = i == i;
/* expect+1: error: operands of '=' have incompatible types (int != _Bool) [107] */
i = i != i;
/* expect+1: error: operands of '=' have incompatible types (int != _Bool) [107] */
i = i < i;
/* expect+1: error: operands of '=' have incompatible types (int != _Bool) [107] */
i = i <= i;
/* expect+1: error: operands of '=' have incompatible types (int != _Bool) [107] */
i = i >= i;
/* expect+1: error: operands of '=' have incompatible types (int != _Bool) [107] */
i = i > i;
/* expect+1: error: operands of '=' have incompatible types (int != _Bool) [107] */
i = b && b;
/* expect+1: error: operands of '=' have incompatible types (int != _Bool) [107] */
i = b || b;
}
@ -655,8 +815,9 @@ enum Flags {
FLAG28 = 1 << 28
};
/* expect+2: warning: argument 'flags' unused in function 'strict_bool_bitwise_and_enum' [231] */
void
strict_bool_bitwise_and_enum(enum Flags flags) /* expect: 231 */
strict_bool_bitwise_and_enum(enum Flags flags)
{
bool b;
@ -666,7 +827,8 @@ strict_bool_bitwise_and_enum(enum Flags flags) /* expect: 231 */
* because it would be too confusing if FLAG0 would work and all the
* other flags wouldn't.
*/
b = flags & FLAG0; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (_Bool != int) [107] */
b = flags & FLAG0;
/*
* Assuming that FLAG1 is set in flags, a _Bool variable stores this
@ -674,14 +836,16 @@ strict_bool_bitwise_and_enum(enum Flags flags) /* expect: 231 */
* it as 2, as that is the integer value of FLAG1. Since FLAG1 fits
* in a uint8_t, no truncation takes place.
*/
b = flags & FLAG1; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (_Bool != int) [107] */
b = flags & FLAG1;
/*
* In a _Bool variable, FLAG28 is stored as 1, since it is unequal to
* zero. In a uint8_t, the stored value would be 0 since bit 28 is
* out of range for a uint8_t and thus gets truncated.
*/
b = flags & FLAG28; /* expect: 107 */
/* expect+1: error: operands of '=' have incompatible types (_Bool != int) [107] */
b = flags & FLAG28;
}
/*
@ -720,7 +884,8 @@ query_flag_from_enum_bit_set(enum Flags flags)
void
strict_bool_operator_eq_bool_int(void)
{
(void)(strict_bool_conversion_return_false() == 0); /* expect: 107 */
/* expect+1: error: operands of '==' have incompatible types (_Bool != int) [107] */
(void)(strict_bool_conversion_return_false() == 0);
}
void
@ -732,7 +897,8 @@ strict_bool_assign_bit_field_then_compare(void)
struct s s = { __lint_false };
(void)((s.flag = s.flag) != __lint_false); /* expect: 129 */
/* expect+1: warning: expression has null effect [129] */
(void)((s.flag = s.flag) != __lint_false);
}
void
@ -744,7 +910,8 @@ bool_as_array_index(bool cond)
* translates 'arr[ind]' to '*(arr + ind)' in an early stage of
* parsing.
*/
println(repr[cond]); /* expect: 337 */
/* expect+1: error: right operand of '+' must not be bool [337] */
println(repr[cond]);
println(cond ? "yes" : "no");
}
@ -761,7 +928,8 @@ do_while_true(void)
{
do {
} while (__lint_true); /* expect: 161 */
} while (__lint_true);
/* expect-1: warning: constant in conditional context [161] */
}
void
@ -772,8 +940,10 @@ initialization(void)
} var[] = {
{ __lint_false },
{ __lint_true },
{ 0 }, /* expect: 107 */
{ 1 }, /* expect: 107 */
/* expect+1: error: operands of 'init' have incompatible types (_Bool != int) [107] */
{ 0 },
/* expect+1: error: operands of 'init' have incompatible types (_Bool != int) [107] */
{ 1 },
};
}
@ -793,10 +963,10 @@ typedef struct stdio_file {
int ferror(FILE *);
FILE stdio_files[3];
FILE *stdio_stdout;
# 797 "d_c99_bool_strict.c" 2
# 967 "d_c99_bool_strict.c" 2
# 1 "string.h" 1 3 4
int strcmp(const char *, const char *);
# 800 "d_c99_bool_strict.c" 2
# 970 "d_c99_bool_strict.c" 2
void
controlling_expression(FILE *f, const char *a, const char *b)
@ -830,9 +1000,9 @@ controlling_expression(FILE *f, const char *a, const char *b)
*/
/* expect+5: error: controlling expression must be bool, not 'int' [333] */
if (ferror(
# 834 "d_c99_bool_strict.c" 3 4
# 1004 "d_c99_bool_strict.c" 3 4
&stdio_files[1]
# 836 "d_c99_bool_strict.c"
# 1006 "d_c99_bool_strict.c"
))
return;
@ -848,9 +1018,9 @@ controlling_expression(FILE *f, const char *a, const char *b)
*/
/* expect+5: error: controlling expression must be bool, not 'int' [333] */
if (ferror(
# 852 "d_c99_bool_strict.c" 3 4
# 1022 "d_c99_bool_strict.c" 3 4
stdio_stdout
# 854 "d_c99_bool_strict.c"
# 1024 "d_c99_bool_strict.c"
))
return;
@ -863,9 +1033,9 @@ controlling_expression(FILE *f, const char *a, const char *b)
*/
/* expect+5: error: controlling expression must be bool, not 'int' [333] */
if (ferror(
# 867 "d_c99_bool_strict.c" 3 4
# 1037 "d_c99_bool_strict.c" 3 4
(stdio_stdout)
# 869 "d_c99_bool_strict.c"
# 1039 "d_c99_bool_strict.c"
))
return;
@ -889,9 +1059,9 @@ controlling_expression(FILE *f, const char *a, const char *b)
*/
/* expect+5: error: controlling expression must be bool, not 'int' [333] */
if (ferror(
# 893 "d_c99_bool_strict.c" 3 4
# 1063 "d_c99_bool_strict.c" 3 4
stdio_stdout /* comment */
# 895 "d_c99_bool_strict.c"
# 1065 "d_c99_bool_strict.c"
))
return;
}

View File

@ -1,177 +1,177 @@
d_c99_bool_strict.c(127): error: argument #1 expects '_Bool', gets passed 'int' [334]
d_c99_bool_strict.c(128): error: argument #1 expects '_Bool', gets passed 'int' [334]
d_c99_bool_strict.c(129): error: argument #1 expects '_Bool', gets passed 'int' [334]
d_c99_bool_strict.c(134): warning: constant in conditional context [161]
d_c99_bool_strict.c(137): warning: constant in conditional context [161]
d_c99_bool_strict.c(140): error: left operand of '?' must be bool, not 'int' [331]
d_c99_bool_strict.c(143): error: left operand of '?' must be bool, not 'int' [331]
d_c99_bool_strict.c(130): error: argument #1 expects '_Bool', gets passed 'int' [334]
d_c99_bool_strict.c(132): error: argument #1 expects '_Bool', gets passed 'int' [334]
d_c99_bool_strict.c(138): warning: constant in conditional context [161]
d_c99_bool_strict.c(142): warning: constant in conditional context [161]
d_c99_bool_strict.c(146): error: left operand of '?' must be bool, not 'int' [331]
d_c99_bool_strict.c(149): error: left operand of '?' must be bool, not 'int' [331]
d_c99_bool_strict.c(159): error: left operand of '?' must be bool, not 'int' [331]
d_c99_bool_strict.c(160): error: left operand of '?' must be bool, not 'int' [331]
d_c99_bool_strict.c(163): warning: constant in conditional context [161]
d_c99_bool_strict.c(169): warning: constant in conditional context [161]
d_c99_bool_strict.c(150): error: left operand of '?' must be bool, not 'int' [331]
d_c99_bool_strict.c(154): error: left operand of '?' must be bool, not 'int' [331]
d_c99_bool_strict.c(158): error: left operand of '?' must be bool, not 'int' [331]
d_c99_bool_strict.c(169): error: left operand of '?' must be bool, not 'int' [331]
d_c99_bool_strict.c(171): error: integral constant expression expected [55]
d_c99_bool_strict.c(174): error: integral constant expression expected [55]
d_c99_bool_strict.c(177): error: integral constant expression expected [55]
d_c99_bool_strict.c(180): warning: constant in conditional context [161]
d_c99_bool_strict.c(180): error: integral constant expression expected [55]
d_c99_bool_strict.c(181): error: left operand of '||' must be bool, not 'int' [331]
d_c99_bool_strict.c(181): error: right operand of '||' must be bool, not 'int' [332]
d_c99_bool_strict.c(171): error: left operand of '?' must be bool, not 'int' [331]
d_c99_bool_strict.c(175): warning: constant in conditional context [161]
d_c99_bool_strict.c(183): warning: constant in conditional context [161]
d_c99_bool_strict.c(183): error: integral constant expression expected [55]
d_c99_bool_strict.c(184): error: left operand of '&&' must be bool, not 'int' [331]
d_c99_bool_strict.c(184): error: right operand of '&&' must be bool, not 'int' [332]
d_c99_bool_strict.c(204): error: operands of '=' have incompatible types (_Bool != unsigned int) [107]
d_c99_bool_strict.c(206): error: operands of '=' have incompatible types (unsigned int != _Bool) [107]
d_c99_bool_strict.c(209): error: operands of '=' have incompatible types (_Bool != unsigned int) [107]
d_c99_bool_strict.c(211): error: operands of '=' have incompatible types (unsigned int != _Bool) [107]
d_c99_bool_strict.c(253): error: return value type mismatch (_Bool) and (int) [211]
d_c99_bool_strict.c(259): error: return value type mismatch (_Bool) and (int) [211]
d_c99_bool_strict.c(265): error: return value type mismatch (_Bool) and (int) [211]
d_c99_bool_strict.c(271): error: return value type mismatch (_Bool) and (pointer) [211]
d_c99_bool_strict.c(269): warning: argument 'p' unused in function 'strict_bool_conversion_return_pointer' [231]
d_c99_bool_strict.c(277): error: return value type mismatch (char) and (_Bool) [211]
d_c99_bool_strict.c(283): error: return value type mismatch (char) and (_Bool) [211]
d_c99_bool_strict.c(301): error: argument #2 expects 'int', gets passed '_Bool' [334]
d_c99_bool_strict.c(301): error: argument #3 expects 'pointer', gets passed '_Bool' [334]
d_c99_bool_strict.c(304): error: argument #1 expects '_Bool', gets passed 'int' [334]
d_c99_bool_strict.c(304): warning: illegal combination of pointer (pointer to const char) and integer (int), arg #3 [154]
d_c99_bool_strict.c(307): error: argument #1 expects '_Bool', gets passed 'pointer' [334]
d_c99_bool_strict.c(307): warning: illegal combination of integer (int) and pointer (pointer to const char), arg #2 [154]
d_c99_bool_strict.c(319): error: argument #1 expects '_Bool', gets passed 'int' [334]
d_c99_bool_strict.c(320): error: argument #1 expects '_Bool', gets passed 'int' [334]
d_c99_bool_strict.c(321): error: argument #1 expects '_Bool', gets passed 'int' [334]
d_c99_bool_strict.c(330): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(332): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(336): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(338): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(340): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(341): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(352): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(353): error: operands of '=' have incompatible types (unsigned int != _Bool) [107]
d_c99_bool_strict.c(354): error: operands of '=' have incompatible types (double != _Bool) [107]
d_c99_bool_strict.c(355): error: operands of '=' have incompatible types (pointer != _Bool) [107]
d_c99_bool_strict.c(345): warning: argument 'b' unused in function 'strict_bool_conversion_from_bool_to_scalar' [231]
d_c99_bool_strict.c(367): warning: constant in conditional context [161]
d_c99_bool_strict.c(368): warning: statement not reached [193]
d_c99_bool_strict.c(370): warning: constant in conditional context [161]
d_c99_bool_strict.c(376): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(377): warning: statement not reached [193]
d_c99_bool_strict.c(379): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(382): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(386): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(392): error: controlling expression must be bool, not 'double' [333]
d_c99_bool_strict.c(398): error: controlling expression must be bool, not 'pointer' [333]
d_c99_bool_strict.c(419): warning: constant in conditional context [161]
d_c99_bool_strict.c(419): warning: constant argument to '!' [239]
d_c99_bool_strict.c(420): warning: constant in conditional context [161]
d_c99_bool_strict.c(420): warning: constant argument to '!' [239]
d_c99_bool_strict.c(424): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(425): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(426): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(427): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(482): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(488): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(504): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(505): error: left operand of '&&' must be bool, not 'int' [331]
d_c99_bool_strict.c(505): error: right operand of '&&' must be bool, not 'int' [332]
d_c99_bool_strict.c(506): error: left operand of '||' must be bool, not 'int' [331]
d_c99_bool_strict.c(506): error: right operand of '||' must be bool, not 'int' [332]
d_c99_bool_strict.c(508): error: right operand of '&&' must be bool, not 'int' [332]
d_c99_bool_strict.c(509): error: left operand of '&&' must be bool, not 'int' [331]
d_c99_bool_strict.c(510): error: right operand of '||' must be bool, not 'int' [332]
d_c99_bool_strict.c(511): error: left operand of '||' must be bool, not 'int' [331]
d_c99_bool_strict.c(520): error: operand of '~' must not be bool [335]
d_c99_bool_strict.c(521): error: operand of '++x' must not be bool [335]
d_c99_bool_strict.c(522): error: operand of '--x' must not be bool [335]
d_c99_bool_strict.c(523): error: operand of 'x++' must not be bool [335]
d_c99_bool_strict.c(524): error: operand of 'x--' must not be bool [335]
d_c99_bool_strict.c(525): error: operand of '+' must not be bool [335]
d_c99_bool_strict.c(526): error: operand of '-' must not be bool [335]
d_c99_bool_strict.c(532): error: left operand of '*' must not be bool [336]
d_c99_bool_strict.c(532): error: right operand of '*' must not be bool [337]
d_c99_bool_strict.c(533): error: left operand of '/' must not be bool [336]
d_c99_bool_strict.c(533): error: right operand of '/' must not be bool [337]
d_c99_bool_strict.c(534): error: left operand of '%' must not be bool [336]
d_c99_bool_strict.c(534): error: right operand of '%' must not be bool [337]
d_c99_bool_strict.c(535): error: left operand of '+' must not be bool [336]
d_c99_bool_strict.c(535): error: right operand of '+' must not be bool [337]
d_c99_bool_strict.c(536): error: left operand of '-' must not be bool [336]
d_c99_bool_strict.c(536): error: right operand of '-' must not be bool [337]
d_c99_bool_strict.c(537): error: left operand of '<<' must not be bool [336]
d_c99_bool_strict.c(537): error: right operand of '<<' must not be bool [337]
d_c99_bool_strict.c(538): error: left operand of '>>' must not be bool [336]
d_c99_bool_strict.c(538): error: right operand of '>>' must not be bool [337]
d_c99_bool_strict.c(540): error: left operand of '<' must not be bool [336]
d_c99_bool_strict.c(540): error: right operand of '<' must not be bool [337]
d_c99_bool_strict.c(541): error: left operand of '<=' must not be bool [336]
d_c99_bool_strict.c(541): error: right operand of '<=' must not be bool [337]
d_c99_bool_strict.c(542): error: left operand of '>' must not be bool [336]
d_c99_bool_strict.c(542): error: right operand of '>' must not be bool [337]
d_c99_bool_strict.c(543): error: left operand of '>=' must not be bool [336]
d_c99_bool_strict.c(543): error: right operand of '>=' must not be bool [337]
d_c99_bool_strict.c(555): error: left operand of '*=' must not be bool [336]
d_c99_bool_strict.c(555): error: right operand of '*=' must not be bool [337]
d_c99_bool_strict.c(556): error: left operand of '/=' must not be bool [336]
d_c99_bool_strict.c(556): error: right operand of '/=' must not be bool [337]
d_c99_bool_strict.c(557): error: left operand of '%=' must not be bool [336]
d_c99_bool_strict.c(557): error: right operand of '%=' must not be bool [337]
d_c99_bool_strict.c(558): error: left operand of '+=' must not be bool [336]
d_c99_bool_strict.c(558): error: right operand of '+=' must not be bool [337]
d_c99_bool_strict.c(559): error: left operand of '-=' must not be bool [336]
d_c99_bool_strict.c(559): error: right operand of '-=' must not be bool [337]
d_c99_bool_strict.c(560): error: left operand of '<<=' must not be bool [336]
d_c99_bool_strict.c(560): error: right operand of '<<=' must not be bool [337]
d_c99_bool_strict.c(561): error: left operand of '>>=' must not be bool [336]
d_c99_bool_strict.c(561): error: right operand of '>>=' must not be bool [337]
d_c99_bool_strict.c(567): error: left operand of '*' must not be bool [336]
d_c99_bool_strict.c(568): error: right operand of '*' must not be bool [337]
d_c99_bool_strict.c(569): error: left operand of '/' must not be bool [336]
d_c99_bool_strict.c(570): error: right operand of '/' must not be bool [337]
d_c99_bool_strict.c(571): error: left operand of '%' must not be bool [336]
d_c99_bool_strict.c(572): error: right operand of '%' must not be bool [337]
d_c99_bool_strict.c(573): error: left operand of '+' must not be bool [336]
d_c99_bool_strict.c(574): error: right operand of '+' must not be bool [337]
d_c99_bool_strict.c(575): error: left operand of '-' must not be bool [336]
d_c99_bool_strict.c(576): error: right operand of '-' must not be bool [337]
d_c99_bool_strict.c(577): error: left operand of '<<' must not be bool [336]
d_c99_bool_strict.c(578): error: right operand of '<<' must not be bool [337]
d_c99_bool_strict.c(579): error: left operand of '>>' must not be bool [336]
d_c99_bool_strict.c(580): error: right operand of '>>' must not be bool [337]
d_c99_bool_strict.c(582): error: operands of ':' have incompatible types (_Bool != unsigned int) [107]
d_c99_bool_strict.c(583): error: operands of ':' have incompatible types (unsigned int != _Bool) [107]
d_c99_bool_strict.c(589): warning: expression has null effect [129]
d_c99_bool_strict.c(590): warning: expression has null effect [129]
d_c99_bool_strict.c(603): error: operands of 'init' have incompatible types (char != _Bool) [107]
d_c99_bool_strict.c(604): error: operands of 'init' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(605): error: operands of 'init' have incompatible types (double != _Bool) [107]
d_c99_bool_strict.c(606): error: operands of 'init' have incompatible types (pointer != _Bool) [107]
d_c99_bool_strict.c(623): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(624): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(625): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(626): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(627): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(628): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(629): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(630): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(631): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(669): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(677): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(684): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(659): warning: argument 'flags' unused in function 'strict_bool_bitwise_and_enum' [231]
d_c99_bool_strict.c(723): error: operands of '==' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(183): error: left operand of '?' must be bool, not 'int' [331]
d_c99_bool_strict.c(186): error: integral constant expression expected [55]
d_c99_bool_strict.c(190): error: integral constant expression expected [55]
d_c99_bool_strict.c(194): error: integral constant expression expected [55]
d_c99_bool_strict.c(199): warning: constant in conditional context [161]
d_c99_bool_strict.c(199): error: integral constant expression expected [55]
d_c99_bool_strict.c(202): error: left operand of '||' must be bool, not 'int' [331]
d_c99_bool_strict.c(202): error: right operand of '||' must be bool, not 'int' [332]
d_c99_bool_strict.c(206): warning: constant in conditional context [161]
d_c99_bool_strict.c(206): error: integral constant expression expected [55]
d_c99_bool_strict.c(209): error: left operand of '&&' must be bool, not 'int' [331]
d_c99_bool_strict.c(209): error: right operand of '&&' must be bool, not 'int' [332]
d_c99_bool_strict.c(230): error: operands of '=' have incompatible types (_Bool != unsigned int) [107]
d_c99_bool_strict.c(233): error: operands of '=' have incompatible types (unsigned int != _Bool) [107]
d_c99_bool_strict.c(237): error: operands of '=' have incompatible types (_Bool != unsigned int) [107]
d_c99_bool_strict.c(240): error: operands of '=' have incompatible types (unsigned int != _Bool) [107]
d_c99_bool_strict.c(283): error: return value type mismatch (_Bool) and (int) [211]
d_c99_bool_strict.c(290): error: return value type mismatch (_Bool) and (int) [211]
d_c99_bool_strict.c(297): error: return value type mismatch (_Bool) and (int) [211]
d_c99_bool_strict.c(305): error: return value type mismatch (_Bool) and (pointer) [211]
d_c99_bool_strict.c(302): warning: argument 'p' unused in function 'strict_bool_conversion_return_pointer' [231]
d_c99_bool_strict.c(312): error: return value type mismatch (char) and (_Bool) [211]
d_c99_bool_strict.c(319): error: return value type mismatch (char) and (_Bool) [211]
d_c99_bool_strict.c(339): error: argument #2 expects 'int', gets passed '_Bool' [334]
d_c99_bool_strict.c(339): error: argument #3 expects 'pointer', gets passed '_Bool' [334]
d_c99_bool_strict.c(344): error: argument #1 expects '_Bool', gets passed 'int' [334]
d_c99_bool_strict.c(344): warning: illegal combination of pointer (pointer to const char) and integer (int), arg #3 [154]
d_c99_bool_strict.c(349): error: argument #1 expects '_Bool', gets passed 'pointer' [334]
d_c99_bool_strict.c(349): warning: illegal combination of integer (int) and pointer (pointer to const char), arg #2 [154]
d_c99_bool_strict.c(363): error: argument #1 expects '_Bool', gets passed 'int' [334]
d_c99_bool_strict.c(365): error: argument #1 expects '_Bool', gets passed 'int' [334]
d_c99_bool_strict.c(367): error: argument #1 expects '_Bool', gets passed 'int' [334]
d_c99_bool_strict.c(377): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(380): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(385): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(388): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(391): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(393): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(406): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(408): error: operands of '=' have incompatible types (unsigned int != _Bool) [107]
d_c99_bool_strict.c(410): error: operands of '=' have incompatible types (double != _Bool) [107]
d_c99_bool_strict.c(412): error: operands of '=' have incompatible types (pointer != _Bool) [107]
d_c99_bool_strict.c(398): warning: argument 'b' unused in function 'strict_bool_conversion_from_bool_to_scalar' [231]
d_c99_bool_strict.c(425): warning: constant in conditional context [161]
d_c99_bool_strict.c(426): warning: statement not reached [193]
d_c99_bool_strict.c(430): warning: constant in conditional context [161]
d_c99_bool_strict.c(437): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(438): warning: statement not reached [193]
d_c99_bool_strict.c(442): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(446): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(451): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(458): error: controlling expression must be bool, not 'double' [333]
d_c99_bool_strict.c(465): error: controlling expression must be bool, not 'pointer' [333]
d_c99_bool_strict.c(488): warning: constant in conditional context [161]
d_c99_bool_strict.c(488): warning: constant argument to '!' [239]
d_c99_bool_strict.c(491): warning: constant in conditional context [161]
d_c99_bool_strict.c(491): warning: constant argument to '!' [239]
d_c99_bool_strict.c(496): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(498): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(500): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(502): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(558): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(565): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(582): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(585): error: left operand of '&&' must be bool, not 'int' [331]
d_c99_bool_strict.c(585): error: right operand of '&&' must be bool, not 'int' [332]
d_c99_bool_strict.c(588): error: left operand of '||' must be bool, not 'int' [331]
d_c99_bool_strict.c(588): error: right operand of '||' must be bool, not 'int' [332]
d_c99_bool_strict.c(591): error: right operand of '&&' must be bool, not 'int' [332]
d_c99_bool_strict.c(593): error: left operand of '&&' must be bool, not 'int' [331]
d_c99_bool_strict.c(595): error: right operand of '||' must be bool, not 'int' [332]
d_c99_bool_strict.c(597): error: left operand of '||' must be bool, not 'int' [331]
d_c99_bool_strict.c(607): error: operand of '~' must not be bool [335]
d_c99_bool_strict.c(609): error: operand of '++x' must not be bool [335]
d_c99_bool_strict.c(611): error: operand of '--x' must not be bool [335]
d_c99_bool_strict.c(613): error: operand of 'x++' must not be bool [335]
d_c99_bool_strict.c(615): error: operand of 'x--' must not be bool [335]
d_c99_bool_strict.c(617): error: operand of '+' must not be bool [335]
d_c99_bool_strict.c(619): error: operand of '-' must not be bool [335]
d_c99_bool_strict.c(627): error: left operand of '*' must not be bool [336]
d_c99_bool_strict.c(627): error: right operand of '*' must not be bool [337]
d_c99_bool_strict.c(630): error: left operand of '/' must not be bool [336]
d_c99_bool_strict.c(630): error: right operand of '/' must not be bool [337]
d_c99_bool_strict.c(633): error: left operand of '%' must not be bool [336]
d_c99_bool_strict.c(633): error: right operand of '%' must not be bool [337]
d_c99_bool_strict.c(636): error: left operand of '+' must not be bool [336]
d_c99_bool_strict.c(636): error: right operand of '+' must not be bool [337]
d_c99_bool_strict.c(639): error: left operand of '-' must not be bool [336]
d_c99_bool_strict.c(639): error: right operand of '-' must not be bool [337]
d_c99_bool_strict.c(642): error: left operand of '<<' must not be bool [336]
d_c99_bool_strict.c(642): error: right operand of '<<' must not be bool [337]
d_c99_bool_strict.c(645): error: left operand of '>>' must not be bool [336]
d_c99_bool_strict.c(645): error: right operand of '>>' must not be bool [337]
d_c99_bool_strict.c(649): error: left operand of '<' must not be bool [336]
d_c99_bool_strict.c(649): error: right operand of '<' must not be bool [337]
d_c99_bool_strict.c(652): error: left operand of '<=' must not be bool [336]
d_c99_bool_strict.c(652): error: right operand of '<=' must not be bool [337]
d_c99_bool_strict.c(655): error: left operand of '>' must not be bool [336]
d_c99_bool_strict.c(655): error: right operand of '>' must not be bool [337]
d_c99_bool_strict.c(658): error: left operand of '>=' must not be bool [336]
d_c99_bool_strict.c(658): error: right operand of '>=' must not be bool [337]
d_c99_bool_strict.c(672): error: left operand of '*=' must not be bool [336]
d_c99_bool_strict.c(672): error: right operand of '*=' must not be bool [337]
d_c99_bool_strict.c(675): error: left operand of '/=' must not be bool [336]
d_c99_bool_strict.c(675): error: right operand of '/=' must not be bool [337]
d_c99_bool_strict.c(678): error: left operand of '%=' must not be bool [336]
d_c99_bool_strict.c(678): error: right operand of '%=' must not be bool [337]
d_c99_bool_strict.c(681): error: left operand of '+=' must not be bool [336]
d_c99_bool_strict.c(681): error: right operand of '+=' must not be bool [337]
d_c99_bool_strict.c(684): error: left operand of '-=' must not be bool [336]
d_c99_bool_strict.c(684): error: right operand of '-=' must not be bool [337]
d_c99_bool_strict.c(687): error: left operand of '<<=' must not be bool [336]
d_c99_bool_strict.c(687): error: right operand of '<<=' must not be bool [337]
d_c99_bool_strict.c(690): error: left operand of '>>=' must not be bool [336]
d_c99_bool_strict.c(690): error: right operand of '>>=' must not be bool [337]
d_c99_bool_strict.c(697): error: left operand of '*' must not be bool [336]
d_c99_bool_strict.c(699): error: right operand of '*' must not be bool [337]
d_c99_bool_strict.c(701): error: left operand of '/' must not be bool [336]
d_c99_bool_strict.c(703): error: right operand of '/' must not be bool [337]
d_c99_bool_strict.c(705): error: left operand of '%' must not be bool [336]
d_c99_bool_strict.c(707): error: right operand of '%' must not be bool [337]
d_c99_bool_strict.c(709): error: left operand of '+' must not be bool [336]
d_c99_bool_strict.c(711): error: right operand of '+' must not be bool [337]
d_c99_bool_strict.c(713): error: left operand of '-' must not be bool [336]
d_c99_bool_strict.c(715): error: right operand of '-' must not be bool [337]
d_c99_bool_strict.c(717): error: left operand of '<<' must not be bool [336]
d_c99_bool_strict.c(719): error: right operand of '<<' must not be bool [337]
d_c99_bool_strict.c(721): error: left operand of '>>' must not be bool [336]
d_c99_bool_strict.c(723): error: right operand of '>>' must not be bool [337]
d_c99_bool_strict.c(726): error: operands of ':' have incompatible types (_Bool != unsigned int) [107]
d_c99_bool_strict.c(728): error: operands of ':' have incompatible types (unsigned int != _Bool) [107]
d_c99_bool_strict.c(735): warning: expression has null effect [129]
d_c99_bool_strict.c(747): error: right operand of '+' must not be bool [337]
d_c99_bool_strict.c(764): warning: constant in conditional context [161]
d_c99_bool_strict.c(775): error: operands of 'init' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(776): error: operands of 'init' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(805): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(808): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(811): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(814): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(836): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(854): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(869): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(895): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(737): warning: expression has null effect [129]
d_c99_bool_strict.c(751): error: operands of 'init' have incompatible types (char != _Bool) [107]
d_c99_bool_strict.c(753): error: operands of 'init' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(755): error: operands of 'init' have incompatible types (double != _Bool) [107]
d_c99_bool_strict.c(757): error: operands of 'init' have incompatible types (pointer != _Bool) [107]
d_c99_bool_strict.c(775): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(777): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(779): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(781): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(783): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(785): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(787): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(789): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(791): error: operands of '=' have incompatible types (int != _Bool) [107]
d_c99_bool_strict.c(831): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(840): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(848): error: operands of '=' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(820): warning: argument 'flags' unused in function 'strict_bool_bitwise_and_enum' [231]
d_c99_bool_strict.c(888): error: operands of '==' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(901): warning: expression has null effect [129]
d_c99_bool_strict.c(914): error: right operand of '+' must not be bool [337]
d_c99_bool_strict.c(931): warning: constant in conditional context [161]
d_c99_bool_strict.c(944): error: operands of 'init' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(946): error: operands of 'init' have incompatible types (_Bool != int) [107]
d_c99_bool_strict.c(975): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(978): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(981): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(984): error: operand of '!' must be bool, not 'int' [330]
d_c99_bool_strict.c(1006): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(1024): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(1039): error: controlling expression must be bool, not 'int' [333]
d_c99_bool_strict.c(1065): error: controlling expression must be bool, not 'int' [333]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_c99_complex_split.c,v 1.8 2021/07/11 19:39:00 rillig Exp $ */
/* $NetBSD: d_c99_complex_split.c,v 1.9 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_c99_complex_split.c"
/*
@ -79,7 +79,8 @@ void
trigger_warning(double _Complex c)
{
c += 1.0;
return c | c; /* expect: incompatible types */
/* expect+1: error: operands of '|' have incompatible types (double _Complex != double _Complex) [107] */
return c | c;
}
void

View File

@ -1 +1 @@
d_c99_complex_split.c(82): error: operands of '|' have incompatible types (double _Complex != double _Complex) [107]
d_c99_complex_split.c(83): error: operands of '|' have incompatible types (double _Complex != double _Complex) [107]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_c99_init.c,v 1.39 2021/12/28 22:54:08 rillig Exp $ */
/* $NetBSD: d_c99_init.c,v 1.40 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_c99_init.c"
/*
@ -21,7 +21,8 @@ typedef struct any {
int scalar_without_braces = 3;
int scalar_with_optional_braces = { 3 };
int scalar_with_too_many_braces = {{ 3 }};
int scalar_with_too_many_initializers = { 3, 5 }; /* expect: 174 */
/* expect+1: error: too many initializers [174] */
int scalar_with_too_many_initializers = { 3, 5 };
// See initialization_expr, 'handing over to INIT'.
@ -61,7 +62,8 @@ initialization_by_redundantly_braced_string(void)
void
initialization_with_too_many_braces(any arg)
{
any local = { arg }; /* expect: 185 */
/* expect+1: error: cannot initialize 'pointer to const void' from 'struct any' [185] */
any local = { arg };
use(&arg);
}
@ -78,7 +80,8 @@ int array_with_fixed_size[3] = {
111,
222,
333,
444, /* expect: too many array initializers */
/* expect+1: error: too many array initializers, expected 3 [173] */
444,
};
// See update_type_of_array_of_unknown_size.
@ -136,13 +139,15 @@ struct point point_with_designators = {
struct point point_with_mixed_designators = {
.x = 3,
4,
5, /* expect: too many struct/union initializers */
/* expect+1: error: too many struct/union initializers [172] */
5,
.x = 3,
};
int array_with_designator[] = {
111,
.member = 222, /* expect: 249 */
/* expect+1: error: syntax error 'designator '.member' is only for struct/union' [249] */
.member = 222,
333,
};
@ -386,7 +391,8 @@ ensure_array_type_is_not_modified_during_initialization(void)
switch (4) {
case sizeof(array_of_unknown_size):
case 0: /* expect: duplicate case in switch: 0 */
/* expect+1: error: duplicate case in switch: 0 [199] */
case 0:
case 3:
case 4:
case 12:
@ -398,21 +404,24 @@ ensure_array_type_is_not_modified_during_initialization(void)
}
struct point unknown_member_name_beginning = {
.r = 5, /* expect: does not have member 'r' */
/* expect+1: error: type 'struct point' does not have member 'r' [101] */
.r = 5,
.x = 4,
.y = 3,
};
struct point unknown_member_name_middle = {
.x = 4,
.r = 5, /* expect: does not have member 'r' */
/* expect+1: error: type 'struct point' does not have member 'r' [101] */
.r = 5,
.y = 3,
};
struct point unknown_member_name_end = {
.x = 4,
.y = 3,
.r = 5, /* expect: does not have member 'r' */
/* expect+1: error: type 'struct point' does not have member 'r' [101] */
.r = 5,
};
union value {
@ -421,17 +430,20 @@ union value {
};
union value unknown_union_member_name_first = {
.unknown_value = 4, /* expect: does not have member */
/* expect+1: error: type 'union value' does not have member 'unknown_value' [101] */
.unknown_value = 4,
.int_value = 3,
};
union value unknown_union_member_name_second = {
.int_value = 3,
.unknown_value = 4, /* expect: does not have member */
/* expect+1: error: type 'union value' does not have member 'unknown_value' [101] */
.unknown_value = 4,
};
struct point subscript_designator_on_struct = {
[0] = 3, /* expect: only for arrays */
/* expect+1: error: syntax error 'designator '[...]' is only for arrays' [249] */
[0] = 3,
};
struct point unknown_member_on_struct = {
@ -461,11 +473,13 @@ union {
};
int designator_for_scalar = {
.value = 3, /* expect: scalar type cannot use designator */
/* expect+1: error: syntax error 'scalar type cannot use designator' [249] */
.value = 3,
};
struct point member_designator_for_scalar_in_struct = {
{ .x = 3 }, /* expect: scalar type cannot use designator */
/* expect+1: error: syntax error 'scalar type cannot use designator' [249] */
{ .x = 3 },
};
struct point subscript_designator_for_scalar_in_struct = {
/* expect+1: error: syntax error 'designator '[...]' is only for arrays' [249] */

View File

@ -1,29 +1,29 @@
d_c99_init.c(24): error: too many initializers [174]
d_c99_init.c(64): error: cannot initialize 'pointer to const void' from 'struct any' [185]
d_c99_init.c(81): error: too many array initializers, expected 3 [173]
d_c99_init.c(139): error: too many struct/union initializers [172]
d_c99_init.c(145): error: syntax error 'designator '.member' is only for struct/union' [249]
d_c99_init.c(221): error: array subscript cannot be > 2: 3 [168]
d_c99_init.c(223): error: array subscript cannot be > 4: 5 [168]
d_c99_init.c(225): error: array subscript cannot be > 1: 2 [168]
d_c99_init.c(234): error: too many struct/union initializers [172]
d_c99_init.c(240): warning: illegal combination of integer (char) and pointer (pointer to char) [183]
d_c99_init.c(334): error: negative array dimension (-8) [20]
d_c99_init.c(336): error: negative array dimension (-12) [20]
d_c99_init.c(389): error: duplicate case in switch: 0 [199]
d_c99_init.c(397): error: negative array dimension (-12) [20]
d_c99_init.c(401): error: type 'struct point' does not have member 'r' [101]
d_c99_init.c(25): error: too many initializers [174]
d_c99_init.c(66): error: cannot initialize 'pointer to const void' from 'struct any' [185]
d_c99_init.c(84): error: too many array initializers, expected 3 [173]
d_c99_init.c(143): error: too many struct/union initializers [172]
d_c99_init.c(150): error: syntax error 'designator '.member' is only for struct/union' [249]
d_c99_init.c(226): error: array subscript cannot be > 2: 3 [168]
d_c99_init.c(228): error: array subscript cannot be > 4: 5 [168]
d_c99_init.c(230): error: array subscript cannot be > 1: 2 [168]
d_c99_init.c(239): error: too many struct/union initializers [172]
d_c99_init.c(245): warning: illegal combination of integer (char) and pointer (pointer to char) [183]
d_c99_init.c(339): error: negative array dimension (-8) [20]
d_c99_init.c(341): error: negative array dimension (-12) [20]
d_c99_init.c(395): error: duplicate case in switch: 0 [199]
d_c99_init.c(403): error: negative array dimension (-12) [20]
d_c99_init.c(408): error: type 'struct point' does not have member 'r' [101]
d_c99_init.c(415): error: type 'struct point' does not have member 'r' [101]
d_c99_init.c(424): error: type 'union value' does not have member 'unknown_value' [101]
d_c99_init.c(430): error: type 'union value' does not have member 'unknown_value' [101]
d_c99_init.c(434): error: syntax error 'designator '[...]' is only for arrays' [249]
d_c99_init.c(439): error: type 'struct point' does not have member 'member' [101]
d_c99_init.c(444): error: syntax error 'scalar type cannot use designator' [249]
d_c99_init.c(451): warning: structure has no named members [65]
d_c99_init.c(451): error: cannot initialize struct/union with no named member [179]
d_c99_init.c(459): warning: union has no named members [65]
d_c99_init.c(459): error: cannot initialize struct/union with no named member [179]
d_c99_init.c(464): error: syntax error 'scalar type cannot use designator' [249]
d_c99_init.c(468): error: syntax error 'scalar type cannot use designator' [249]
d_c99_init.c(472): error: syntax error 'designator '[...]' is only for arrays' [249]
d_c99_init.c(416): error: type 'struct point' does not have member 'r' [101]
d_c99_init.c(424): error: type 'struct point' does not have member 'r' [101]
d_c99_init.c(434): error: type 'union value' does not have member 'unknown_value' [101]
d_c99_init.c(441): error: type 'union value' does not have member 'unknown_value' [101]
d_c99_init.c(446): error: syntax error 'designator '[...]' is only for arrays' [249]
d_c99_init.c(451): error: type 'struct point' does not have member 'member' [101]
d_c99_init.c(456): error: syntax error 'scalar type cannot use designator' [249]
d_c99_init.c(463): warning: structure has no named members [65]
d_c99_init.c(463): error: cannot initialize struct/union with no named member [179]
d_c99_init.c(471): warning: union has no named members [65]
d_c99_init.c(471): error: cannot initialize struct/union with no named member [179]
d_c99_init.c(477): error: syntax error 'scalar type cannot use designator' [249]
d_c99_init.c(482): error: syntax error 'scalar type cannot use designator' [249]
d_c99_init.c(486): error: syntax error 'designator '[...]' is only for arrays' [249]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_constant_conv1.c,v 1.3 2021/02/21 09:07:58 rillig Exp $ */
/* $NetBSD: d_constant_conv1.c,v 1.4 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_constant_conv1.c"
/* Flag information-losing constant conversion in argument lists */
@ -8,5 +8,6 @@ int f(unsigned int);
void
should_fail()
{
f(-1); /* expect: 296 */
/* expect+1: warning: conversion of negative constant to unsigned type, arg #1 [296] */
f(-1);
}

View File

@ -1 +1 @@
d_constant_conv1.c(11): warning: conversion of negative constant to unsigned type, arg #1 [296]
d_constant_conv1.c(12): warning: conversion of negative constant to unsigned type, arg #1 [296]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_constant_conv2.c,v 1.3 2021/02/21 09:07:58 rillig Exp $ */
/* $NetBSD: d_constant_conv2.c,v 1.4 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_constant_conv2.c"
/* Flag information-losing constant conversion in argument lists */
@ -8,5 +8,6 @@ int f(unsigned int);
void
should_fail()
{
f(2.1); /* expect: 259 */
/* expect+1: warning: argument #1 is converted from 'double' to 'unsigned int' due to prototype [259] */
f(2.1);
}

View File

@ -1 +1 @@
d_constant_conv2.c(11): warning: argument #1 is converted from 'double' to 'unsigned int' due to prototype [259]
d_constant_conv2.c(12): warning: argument #1 is converted from 'double' to 'unsigned int' due to prototype [259]

View File

@ -1,11 +1,12 @@
/* $NetBSD: d_cvt_constant.c,v 1.5 2021/02/21 09:17:55 rillig Exp $ */
/* $NetBSD: d_cvt_constant.c,v 1.6 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_cvt_constant.c"
/* the second assignment assumes failed before */
int
main(void)
{
double x = 1; /* expect: 191 */
/* expect+1: warning: 'x' set but not used in function 'main' [191] */
double x = 1;
int foo = 0;
if (foo)
x = 1;

View File

@ -1 +1 @@
d_cvt_constant.c(8): warning: 'x' set but not used in function 'main' [191]
d_cvt_constant.c(9): warning: 'x' set but not used in function 'main' [191]

View File

@ -7,9 +7,15 @@
void func(int a, int b, int c);
void func(num, ptr, dbl, def) /* expect: 231 *//* expect: 231 *//* expect: 231 *//* expect: 231 */
/* expect+4: warning: argument 'num' unused in function 'func' [231] */
/* expect+3: warning: argument 'ptr' unused in function 'func' [231] */
/* expect+2: warning: argument 'dbl' unused in function 'func' [231] */
/* expect+1: warning: argument 'def' unused in function 'func' [231] */
void func(num, ptr, dbl, def)
int num;
char *ptr;
double dbl;
{ /* expect: 32 *//* expect: 51 */
{
/* expect-1: warning: argument type defaults to 'int': def [32] */
/* expect-2: error: parameter mismatch: 3 declared, 4 defined [51] */
}

View File

@ -1,6 +1,6 @@
d_decl_old_style_arguments.c(14): warning: argument type defaults to 'int': def [32]
d_decl_old_style_arguments.c(14): error: parameter mismatch: 3 declared, 4 defined [51]
d_decl_old_style_arguments.c(10): warning: argument 'num' unused in function 'func' [231]
d_decl_old_style_arguments.c(10): warning: argument 'ptr' unused in function 'func' [231]
d_decl_old_style_arguments.c(10): warning: argument 'dbl' unused in function 'func' [231]
d_decl_old_style_arguments.c(10): warning: argument 'def' unused in function 'func' [231]
d_decl_old_style_arguments.c(18): warning: argument type defaults to 'int': def [32]
d_decl_old_style_arguments.c(18): error: parameter mismatch: 3 declared, 4 defined [51]
d_decl_old_style_arguments.c(14): warning: argument 'num' unused in function 'func' [231]
d_decl_old_style_arguments.c(14): warning: argument 'ptr' unused in function 'func' [231]
d_decl_old_style_arguments.c(14): warning: argument 'dbl' unused in function 'func' [231]
d_decl_old_style_arguments.c(14): warning: argument 'def' unused in function 'func' [231]

View File

@ -56,15 +56,29 @@ void if_enum(enum e e) { if (e) return; }
/* C99 6.2.5p20 */
void if_array(struct arr arr) { if (arr.arr) return; }
void if_struct(struct s s) { if (s) return; } /* expect: 204 *//* expect: 231 */
void if_union(union u u) { if (u) return; } /* expect: 204 *//* expect: 231 */
/* expect+2: error: controlling expressions must have scalar type [204] */
/* expect+1: warning: argument 's' unused in function 'if_struct' [231] */
void if_struct(struct s s) { if (s) return; }
/* expect+2: error: controlling expressions must have scalar type [204] */
/* expect+1: warning: argument 'u' unused in function 'if_union' [231] */
void if_union(union u u) { if (u) return; }
void if_function(void) { if (if_function) return; }
void if_pointer(void *p) { if (p) return; }
/* C99 6.8.5 */
void while_struct(struct s s) { while (s) return; } /* expect: 204 *//* expect: 231 */
void for_struct(struct s s) { for (;s;) return; } /* expect: 204 *//* expect: 223 *//* expect: 231 */
void do_while_struct(struct s s) { do { return; } while (s); } /* expect: 204 *//* expect: 231 */
/* expect+2: error: controlling expressions must have scalar type [204] */
/* expect+1: warning: argument 's' unused in function 'while_struct' [231] */
void while_struct(struct s s) { while (s) return; }
/* expect+3: error: controlling expressions must have scalar type [204] */
/* expect+2: warning: end-of-loop code not reached [223] */
/* expect+1: warning: argument 's' unused in function 'for_struct' [231] */
void for_struct(struct s s) { for (;s;) return; }
/* expect+2: error: controlling expressions must have scalar type [204] */
/* expect+1: warning: argument 's' unused in function 'do_while_struct' [231] */
void do_while_struct(struct s s) { do { return; } while (s); }
/* C99 6.5.15 does not require a scalar type, curiously. */
int conditional_struct(struct s s) { return s ? 1 : 2; } /* expect: 170 *//* expect: 214 *//* expect: 231 */
/* expect+3: error: first operand must have scalar type, op ? : [170] */
/* expect+2: warning: function 'conditional_struct' expects to return value [214] */
/* expect+1: warning: argument 's' unused in function 'conditional_struct' [231] */
int conditional_struct(struct s s) { return s ? 1 : 2; }

View File

@ -1,14 +1,14 @@
d_fold_test.c(59): error: controlling expressions must have scalar type [204]
d_fold_test.c(59): warning: argument 's' unused in function 'if_struct' [231]
d_fold_test.c(60): error: controlling expressions must have scalar type [204]
d_fold_test.c(60): warning: argument 'u' unused in function 'if_union' [231]
d_fold_test.c(65): error: controlling expressions must have scalar type [204]
d_fold_test.c(65): warning: argument 's' unused in function 'while_struct' [231]
d_fold_test.c(66): error: controlling expressions must have scalar type [204]
d_fold_test.c(66): warning: end-of-loop code not reached [223]
d_fold_test.c(66): warning: argument 's' unused in function 'for_struct' [231]
d_fold_test.c(67): error: controlling expressions must have scalar type [204]
d_fold_test.c(67): warning: argument 's' unused in function 'do_while_struct' [231]
d_fold_test.c(70): error: first operand must have scalar type, op ? : [170]
d_fold_test.c(70): warning: function 'conditional_struct' expects to return value [214]
d_fold_test.c(70): warning: argument 's' unused in function 'conditional_struct' [231]
d_fold_test.c(61): error: controlling expressions must have scalar type [204]
d_fold_test.c(61): warning: argument 's' unused in function 'if_struct' [231]
d_fold_test.c(64): error: controlling expressions must have scalar type [204]
d_fold_test.c(64): warning: argument 'u' unused in function 'if_union' [231]
d_fold_test.c(71): error: controlling expressions must have scalar type [204]
d_fold_test.c(71): warning: argument 's' unused in function 'while_struct' [231]
d_fold_test.c(75): error: controlling expressions must have scalar type [204]
d_fold_test.c(75): warning: end-of-loop code not reached [223]
d_fold_test.c(75): warning: argument 's' unused in function 'for_struct' [231]
d_fold_test.c(78): error: controlling expressions must have scalar type [204]
d_fold_test.c(78): warning: argument 's' unused in function 'do_while_struct' [231]
d_fold_test.c(84): error: first operand must have scalar type, op ? : [170]
d_fold_test.c(84): warning: function 'conditional_struct' expects to return value [214]
d_fold_test.c(84): warning: argument 's' unused in function 'conditional_struct' [231]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_gcc_compound_statements1.c,v 1.6 2021/06/20 11:42:26 rillig Exp $ */
/* $NetBSD: d_gcc_compound_statements1.c,v 1.7 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_gcc_compound_statements1.c"
/* GCC compound statement with expression */
@ -20,8 +20,10 @@ foo(unsigned long z)
* fault.
*/
int c = ({
return 3; /* expect: return outside function */
}); /* expect: cannot initialize 'int' from 'void' */
/* expect+1: error: syntax error 'return outside function' [249] */
return 3;
});
/* expect-1: error: cannot initialize 'int' from 'void' [185] */
void
function(void)
@ -31,6 +33,7 @@ function(void)
* syntax error, which made an expression NULL.
*/
({
0->e; /* expect: type 'int' does not have member 'e' */
/* expect+1: error: type 'int' does not have member 'e' [101] */
0->e;
});
}

View File

@ -1,3 +1,3 @@
d_gcc_compound_statements1.c(23): error: syntax error 'return outside function' [249]
d_gcc_compound_statements1.c(24): error: cannot initialize 'int' from 'void' [185]
d_gcc_compound_statements1.c(34): error: type 'int' does not have member 'e' [101]
d_gcc_compound_statements1.c(24): error: syntax error 'return outside function' [249]
d_gcc_compound_statements1.c(25): error: cannot initialize 'int' from 'void' [185]
d_gcc_compound_statements1.c(37): error: type 'int' does not have member 'e' [101]

View File

@ -1,6 +1,7 @@
/* $NetBSD: d_incorrect_array_size.c,v 1.3 2021/02/21 09:07:58 rillig Exp $ */
/* $NetBSD: d_incorrect_array_size.c,v 1.4 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_incorrect_array_size.c"
struct foo {
int a[-1]; /* expect: 20 */
/* expect+1: error: negative array dimension (-1) [20] */
int a[-1];
};

View File

@ -1 +1 @@
d_incorrect_array_size.c(5): error: negative array dimension (-1) [20]
d_incorrect_array_size.c(6): error: negative array dimension (-1) [20]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_init_array_using_string.c,v 1.9 2021/12/22 14:11:14 rillig Exp $ */
/* $NetBSD: d_init_array_using_string.c,v 1.10 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_init_array_using_string.c"
/*
@ -60,8 +60,10 @@ test_array_initialization_in_struct(void)
};
struct cs_ws type_mismatch = {
L"", /* expect: warning: illegal combination of integer (char) and pointer (pointer to int) [183] */
"", /* expect: warning: illegal combination of integer (char) and pointer (pointer to char) [183] */
/* expect+1: warning: illegal combination of integer (char) and pointer (pointer to int) [183] */
L"",
/* expect+1: warning: illegal combination of integer (char) and pointer (pointer to char) [183] */
"",
};
struct cs_ws no_terminating_null = {

View File

@ -2,7 +2,7 @@ d_init_array_using_string.c(17): warning: illegal combination of 'pointer to con
d_init_array_using_string.c(19): warning: illegal combination of 'pointer to const int' and 'pointer to char', op 'init' [124]
d_init_array_using_string.c(37): warning: illegal combination of 'pointer to const char' and 'pointer to int', op 'init' [124]
d_init_array_using_string.c(39): warning: illegal combination of 'pointer to const int' and 'pointer to char', op 'init' [124]
d_init_array_using_string.c(63): warning: illegal combination of integer (char) and pointer (pointer to int) [183]
d_init_array_using_string.c(64): warning: illegal combination of integer (char) and pointer (pointer to char) [183]
d_init_array_using_string.c(74): warning: string literal too long (11) for target array (10) [187]
d_init_array_using_string.c(64): warning: illegal combination of integer (char) and pointer (pointer to int) [183]
d_init_array_using_string.c(66): warning: illegal combination of integer (char) and pointer (pointer to char) [183]
d_init_array_using_string.c(76): warning: string literal too long (11) for target array (10) [187]
d_init_array_using_string.c(78): warning: string literal too long (11) for target array (10) [187]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_init_pop_member.c,v 1.8 2021/06/20 18:11:21 rillig Exp $ */
/* $NetBSD: d_init_pop_member.c,v 1.9 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_init_pop_member.c"
/*
@ -35,7 +35,8 @@ struct state {
void func(void)
{
struct state st = { /* expect: set but not used */
/* expect+1: warning: 'st' set but not used in function 'func' [191] */
struct state st = {
.capital.mayor.hobbies.dancing = 1,
/*
* Since 2015-07-28:

View File

@ -1 +1 @@
d_init_pop_member.c(38): warning: 'st' set but not used in function 'func' [191]
d_init_pop_member.c(39): warning: 'st' set but not used in function 'func' [191]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_lint_assert.c,v 1.4 2021/07/10 12:10:39 rillig Exp $ */
/* $NetBSD: d_lint_assert.c,v 1.5 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_lint_assert.c"
/*
@ -12,7 +12,8 @@ enum {
// failed in check_global_variable at decl.c:3135
// near d_lint_assert.c:14
A = +++
}; /* expect: 249 */
};
/* expect-1: error: syntax error '}' [249] */
/*
* Before decl.c 1.196 from 2021-07-10, lint ran into an assertion failure

View File

@ -1,2 +1,2 @@
d_lint_assert.c(15): error: syntax error '}' [249]
d_lint_assert.c(22): warning: old style declaration; add 'int' [1]
d_lint_assert.c(23): warning: old style declaration; add 'int' [1]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_long_double_int.c,v 1.4 2021/02/21 09:07:58 rillig Exp $ */
/* $NetBSD: d_long_double_int.c,v 1.5 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_long_double_int.c"
/* PR bin/39639: writing "long double" gave "long int" */
@ -6,5 +6,6 @@
int
fail(long double *a, long int *b)
{
return a == b; /* expect: 124 */
/* expect+1: warning: illegal combination of 'pointer to long double' and 'pointer to long', op '==' [124] */
return a == b;
}

View File

@ -1 +1 @@
d_long_double_int.c(9): warning: illegal combination of 'pointer to long double' and 'pointer to long', op '==' [124]
d_long_double_int.c(10): warning: illegal combination of 'pointer to long double' and 'pointer to long', op '==' [124]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_pr_22119.c,v 1.2 2021/03/26 23:17:33 rillig Exp $ */
/* $NetBSD: d_pr_22119.c,v 1.3 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_pr_22119.c"
/*
@ -13,6 +13,7 @@ func1(void)
{
void (*f1)(void);
f1 = (void (*)(void))p; /* expect: 'p' undefined [99] */
/* expect+1: error: 'p' undefined [99] */
f1 = (void (*)(void))p;
f1 = (void *()(void))p; /* crash before 2021-02-28 */
}

View File

@ -1 +1 @@
d_pr_22119.c(16): error: 'p' undefined [99]
d_pr_22119.c(17): error: 'p' undefined [99]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_return_type.c,v 1.3 2021/02/21 09:07:58 rillig Exp $ */
/* $NetBSD: d_return_type.c,v 1.4 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_return_type.c"
enum A {
@ -12,5 +12,6 @@ enum B {
enum A
func(enum B arg)
{
return arg; /* expect: 211 */
/* expect+1: warning: return value type mismatch (enum A) and (enum B) [211] */
return arg;
}

View File

@ -1 +1 @@
d_return_type.c(15): warning: return value type mismatch (enum A) and (enum B) [211]
d_return_type.c(16): warning: return value type mismatch (enum A) and (enum B) [211]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_struct_init_nested.c,v 1.6 2021/03/25 01:42:53 rillig Exp $ */
/* $NetBSD: d_struct_init_nested.c,v 1.7 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_struct_init_nested.c"
/*
@ -75,6 +75,7 @@ struct Inner2 inner = {
};
struct Outer3Inner2 o3i2 = {
O1C,
inner, /* expect: non-constant initializer */
/* expect+1: error: non-constant initializer [177] */
inner,
O3C
};

View File

@ -1 +1 @@
d_struct_init_nested.c(78): error: non-constant initializer [177]
d_struct_init_nested.c(79): error: non-constant initializer [177]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_type_conv1.c,v 1.3 2021/02/21 09:07:58 rillig Exp $ */
/* $NetBSD: d_type_conv1.c,v 1.4 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_type_conv1.c"
/* Flag information-losing type conversion in argument lists */
@ -10,5 +10,6 @@ should_fail()
{
long long x = 20;
f(x); /* expect: 259 */
/* expect+1: warning: argument #1 is converted from 'long long' to 'unsigned int' due to prototype [259] */
f(x);
}

View File

@ -1 +1 @@
d_type_conv1.c(13): warning: argument #1 is converted from 'long long' to 'unsigned int' due to prototype [259]
d_type_conv1.c(14): warning: argument #1 is converted from 'long long' to 'unsigned int' due to prototype [259]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_type_conv2.c,v 1.3 2021/02/21 09:07:58 rillig Exp $ */
/* $NetBSD: d_type_conv2.c,v 1.4 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_type_conv2.c"
/* Flag information-losing type conversion in argument lists */
@ -10,5 +10,6 @@ should_fail()
{
double x = 2.0;
f(x); /* expect: 259 */
/* expect+1: warning: argument #1 is converted from 'double' to 'float' due to prototype [259] */
f(x);
}

View File

@ -1 +1 @@
d_type_conv2.c(13): warning: argument #1 is converted from 'double' to 'float' due to prototype [259]
d_type_conv2.c(14): warning: argument #1 is converted from 'double' to 'float' due to prototype [259]

View File

@ -1,4 +1,4 @@
/* $NetBSD: d_type_conv3.c,v 1.4 2021/04/05 01:35:34 rillig Exp $ */
/* $NetBSD: d_type_conv3.c,v 1.5 2022/01/15 14:22:03 rillig Exp $ */
# 3 "d_type_conv3.c"
/* Flag information-losing type conversion in argument lists */
@ -9,5 +9,7 @@ void
should_fail()
{
f(0x7fffffffffffffffLL); /* expect: 259 *//* expect: 295 */
/* expect+2: warning: argument #1 is converted from 'long long' to 'unsigned int' due to prototype [259] */
/* expect+1: warning: conversion of 'long long' to 'unsigned int' is out of range, arg #1 [295] */
f(0x7fffffffffffffffLL);
}

View File

@ -1,2 +1,2 @@
d_type_conv3.c(12): warning: argument #1 is converted from 'long long' to 'unsigned int' due to prototype [259]
d_type_conv3.c(12): warning: conversion of 'long long' to 'unsigned int' is out of range, arg #1 [295]
d_type_conv3.c(14): warning: argument #1 is converted from 'long long' to 'unsigned int' due to prototype [259]
d_type_conv3.c(14): warning: conversion of 'long long' to 'unsigned int' is out of range, arg #1 [295]

View File

@ -1,4 +1,4 @@
/* $NetBSD: decl_struct_member.c,v 1.13 2021/12/22 14:49:11 rillig Exp $ */
/* $NetBSD: decl_struct_member.c,v 1.14 2022/01/15 14:22:03 rillig Exp $ */
# 3 "decl_struct_member.c"
struct multi_attributes {
@ -44,7 +44,8 @@ struct goto {
* "is_struct_or_union(dcs->d_type->t_tspec)" at cgram.y:846
*/
struct {
char; /* expect: syntax error 'unnamed member' */
/* expect+1: error: syntax error 'unnamed member' [249] */
char;
};
struct cover_notype_struct_declarators {
@ -76,7 +77,8 @@ struct array_of_bit_fields {
* Before decl.c 1.188 from 2021-06-20, lint ran into a segmentation fault.
*/
struct {
char a(_)0 /* expect: syntax error '0' */
/* expect+1: error: syntax error '0' [249] */
char a(_)0
/*
* Before cgram.y 1.328 from 2021-07-15, lint ran into an assertion failure

View File

@ -2,7 +2,7 @@ decl_struct_member.c(34): error: syntax error 'goto' [249]
decl_struct_member.c(36): error: illegal type combination [4]
decl_struct_member.c(38): error: syntax error '}' [249]
decl_struct_member.c(38): warning: empty declaration [0]
decl_struct_member.c(47): error: syntax error 'unnamed member' [249]
decl_struct_member.c(72): warning: illegal bit-field type 'array[8] of unsigned int' [35]
decl_struct_member.c(79): error: syntax error '0' [249]
decl_struct_member.c(89): error: cannot recover from previous errors [224]
decl_struct_member.c(48): error: syntax error 'unnamed member' [249]
decl_struct_member.c(73): warning: illegal bit-field type 'array[8] of unsigned int' [35]
decl_struct_member.c(81): error: syntax error '0' [249]
decl_struct_member.c(91): error: cannot recover from previous errors [224]

View File

@ -1,4 +1,4 @@
/* $NetBSD: emit.c,v 1.9 2021/11/28 10:11:15 rillig Exp $ */
/* $NetBSD: emit.c,v 1.10 2022/01/15 14:22:03 rillig Exp $ */
# 3 "emit.c"
/*
@ -104,7 +104,8 @@ extern enum {
extern int declared_int;
int defined_int;
static int static_int; /* expect: unused */
/* expect+1: warning: static variable static_int unused [226] */
static int static_int;
/*
* Type qualifiers.
@ -124,7 +125,8 @@ extern /* implicit int */ return_implicit_int_unknown_parameters();
/* For function declarations, the keyword 'extern' is optional. */
extern void extern_return_void_no_parameters(void);
/* implicit extern */ void return_void_no_parameters(void);
static void static_return_void_no_parameters(void); /* expect: declared */
/* expect+1: warning: static function static_return_void_no_parameters declared but not defined [290] */
static void static_return_void_no_parameters(void);
void taking_int(int);
/* The 'const' parameter does not make a difference. */
@ -143,7 +145,8 @@ void taking_varargs(const char *, ...);
* is nevertheless recorded. There's probably a good reason for recording
* it.
*/
static int static_function(void); /* expect: declared */
/* expect+1: warning: static function static_function declared but not defined [290] */
static int static_function(void);
void my_printf(const char *, ...);
void my_scanf(const char *, ...);

View File

@ -1,3 +1,3 @@
emit.c(107): warning: static variable static_int unused [226]
emit.c(127): warning: static function static_return_void_no_parameters declared but not defined [290]
emit.c(146): warning: static function static_function declared but not defined [290]
emit.c(108): warning: static variable static_int unused [226]
emit.c(129): warning: static function static_return_void_no_parameters declared but not defined [290]
emit.c(149): warning: static function static_function declared but not defined [290]

View File

@ -35,50 +35,50 @@ Semit.c
97d0.97e21extern_anonymous_enumeT395.0.0
105d0.105e12declared_intI
106d0.106t11defined_intI
113d0.113e16extern_const_intcI
114d0.114e19extern_volatile_intvI
115d0.115e25extern_const_volatile_intcvI
121d0.121e30return_void_unknown_parametersFV
122d0.122e38return_implicit_int_unknown_parametersFI
125d0.125e32extern_return_void_no_parametersF0V
126d0.126e25return_void_no_parametersF0V
127d0.127es32static_return_void_no_parametersF0V
129d0.129e10taking_intF1IV
131d0.131e16taking_const_intF1cIV
132d0.132e22taking_int_double_boolF3IDBV
134d0.133e29taking_struct_union_enum_tagsF3sT110struct_taguT19union_tageT18enum_tagV
136d0.135e33taking_struct_union_enum_typedefsF3sT214struct_typedefuT213union_typedefeT212enum_typedefV
138d0.138e14taking_varargsF2PcCEV
146d0.146es15static_functionF0I
148d0.148e9my_printfF2PcCEV
149d0.149e8my_scanfF2PcCEV
162c0.162s2"%"i9my_printff2PcCPCV
163c0.163s2"%s"i9my_printff2PcCPCV
164c0.164s2"%%"i9my_printff2PcCPCV
165c0.165s2"%\\%\"%\'%\a%\b%\f%\n%\r%\t%\v%\177"i9my_printff2PcCPCV
160d0.160d14cover_outqcharF0V
171c0.171s2"%-3d%+3d% d%#x%03d%*.*s%6.2f%hd%ld%Ld%qd"i9my_printff2PcCPCV
172c0.172s2"%[-]%[--]%[---]%[]"i8my_scanff2PcCPCV
169d0.169d14cover_outfstrgF0V
181d0.181d17call_gcc_builtinsF2IPLV
201d0.201v0d15varargs_commentF1PcCV
207d0.207v0d17varargs_0_commentF1PcCV
213d0.213v3d17varargs_3_commentF4IIIPcCV
219d0.219d18printflike_commentF1PcCV
225d0.225d20printflike_0_commentF1PcCV
231d0.231v3P3d20printflike_3_commentF3IIPcCV
237d0.237v10P10d21printflike_10_commentF10IIIIIIIIIPcCV
245d0.245d17scanflike_commentF1PcCV
251d0.251d19scanflike_0_commentF1PcCV
257d0.257v3S3d19scanflike_3_commentF3IIPcCV
262d0.262dr13used_functionF0I
270c0.270i13used_functionf0I
271c0.271d13used_functionf0I
272c0.272u13used_functionf0I
268d0.268dri15inline_functionF0I
275d0.275e17declared_used_varI
276d0.276t16defined_used_varI
285u0.285x17declared_used_var
286u0.286x16defined_used_var
283d0.283d8use_varsF0V
302d0.302d8compoundsT134compound_expression_in_initializer
114d0.114e16extern_const_intcI
115d0.115e19extern_volatile_intvI
116d0.116e25extern_const_volatile_intcvI
122d0.122e30return_void_unknown_parametersFV
123d0.123e38return_implicit_int_unknown_parametersFI
126d0.126e32extern_return_void_no_parametersF0V
127d0.127e25return_void_no_parametersF0V
129d0.129es32static_return_void_no_parametersF0V
131d0.131e10taking_intF1IV
133d0.133e16taking_const_intF1cIV
134d0.134e22taking_int_double_boolF3IDBV
136d0.135e29taking_struct_union_enum_tagsF3sT110struct_taguT19union_tageT18enum_tagV
138d0.137e33taking_struct_union_enum_typedefsF3sT214struct_typedefuT213union_typedefeT212enum_typedefV
140d0.140e14taking_varargsF2PcCEV
149d0.149es15static_functionF0I
151d0.151e9my_printfF2PcCEV
152d0.152e8my_scanfF2PcCEV
165c0.165s2"%"i9my_printff2PcCPCV
166c0.166s2"%s"i9my_printff2PcCPCV
167c0.167s2"%%"i9my_printff2PcCPCV
168c0.168s2"%\\%\"%\'%\a%\b%\f%\n%\r%\t%\v%\177"i9my_printff2PcCPCV
163d0.163d14cover_outqcharF0V
174c0.174s2"%-3d%+3d% d%#x%03d%*.*s%6.2f%hd%ld%Ld%qd"i9my_printff2PcCPCV
175c0.175s2"%[-]%[--]%[---]%[]"i8my_scanff2PcCPCV
172d0.172d14cover_outfstrgF0V
184d0.184d17call_gcc_builtinsF2IPLV
204d0.204v0d15varargs_commentF1PcCV
210d0.210v0d17varargs_0_commentF1PcCV
216d0.216v3d17varargs_3_commentF4IIIPcCV
222d0.222d18printflike_commentF1PcCV
228d0.228d20printflike_0_commentF1PcCV
234d0.234v3P3d20printflike_3_commentF3IIPcCV
240d0.240v10P10d21printflike_10_commentF10IIIIIIIIIPcCV
248d0.248d17scanflike_commentF1PcCV
254d0.254d19scanflike_0_commentF1PcCV
260d0.260v3S3d19scanflike_3_commentF3IIPcCV
265d0.265dr13used_functionF0I
273c0.273i13used_functionf0I
274c0.274d13used_functionf0I
275c0.275u13used_functionf0I
271d0.271dri15inline_functionF0I
278d0.278e17declared_used_varI
279d0.279t16defined_used_varI
288u0.288x17declared_used_var
289u0.289x16defined_used_var
286d0.286d8use_varsF0V
305d0.305d8compoundsT134compound_expression_in_initializer

View File

@ -1,4 +1,4 @@
/* $NetBSD: expr_range.c,v 1.3 2021/07/05 19:43:29 rillig Exp $ */
/* $NetBSD: expr_range.c,v 1.4 2022/01/15 14:22:03 rillig Exp $ */
# 3 "expr_range.c"
/*
@ -27,7 +27,8 @@ example(unsigned x)
case 0:
println("0 is reachable");
break;
case 1: /* expect: statement not reached */
case 1:
/* expect-1: warning: statement not reached [193] */
println("1 is not reachable");
break;
case 2:
@ -36,7 +37,8 @@ example(unsigned x)
case 6:
println("6 is reachable");
break;
case 7: /* expect: statement not reached */
case 7:
/* expect-1: warning: statement not reached [193] */
println("7 is not reachable");
break;
}

View File

@ -1,2 +1,2 @@
expr_range.c(30): warning: statement not reached [193]
expr_range.c(39): warning: statement not reached [193]
expr_range.c(40): warning: statement not reached [193]

View File

@ -1,4 +1,4 @@
/* $NetBSD: feat_stacktrace.c,v 1.1 2021/04/08 22:18:27 rillig Exp $ */
/* $NetBSD: feat_stacktrace.c,v 1.2 2022/01/15 14:22:03 rillig Exp $ */
# 3 "feat_stacktrace.c"
/*
@ -23,7 +23,8 @@
* the main file as well.
*/
# 1 "common_int_types.h" 1 3 4
typedef int; /* expect: typedef declares no type name */
/* expect+1: typedef declares no type name [72] */
typedef int;
# 39 "common_int_types.h" 3 4
# 39 "/usr/include/amd64/int_types.h" 2 3 4
# 42 "/usr/include/amd64/types.h" 2 3 4

View File

@ -1,4 +1,4 @@
common_int_types.h(1): warning: typedef declares no type name [72]
common_int_types.h(2): warning: typedef declares no type name [72]
included from /usr/include/amd64/int_types.h(7)
included from /usr/include/amd64/types.h(41)
included from /usr/include/sys/types.h(43)

View File

@ -1,4 +1,4 @@
/* $NetBSD: gcc_attribute_aligned.c,v 1.1 2021/05/02 20:44:46 rillig Exp $ */
/* $NetBSD: gcc_attribute_aligned.c,v 1.2 2022/01/15 14:22:03 rillig Exp $ */
# 3 "gcc_attribute_aligned.c"
/*
@ -39,6 +39,7 @@ struct {
unsigned int sizeof_fpacc87: sizeof(struct fpacc87) == 10 ? 1 : -1;
/* expect+1: illegal bit-field size: 255 *//*FIXME*/
/* FIXME: @4 2 + @4 2 + @4 2 + @4 8 + @4 8 + @2 (8 * 10) == 108 */
/* expect+1: illegal bit-field size: 255 */
unsigned int sizeof_save87: sizeof(struct save87) == 108 ? 1 : -1;
};

View File

@ -1 +1 @@
gcc_attribute_aligned.c(43): error: illegal bit-field size: 255 [36]
gcc_attribute_aligned.c(44): error: illegal bit-field size: 255 [36]

View File

@ -1,4 +1,4 @@
/* $NetBSD: gcc_bit_field_types.c,v 1.5 2021/05/04 05:40:10 rillig Exp $ */
/* $NetBSD: gcc_bit_field_types.c,v 1.6 2022/01/15 14:22:03 rillig Exp $ */
# 3 "gcc_bit_field_types.c"
/*
@ -17,7 +17,8 @@ struct example {
unsigned long unsigned_long_flag: 1;
long long long_long_flag: 1;
unsigned long long unsigned_long_long_flag: 1;
double double_flag: 1; /* expect: illegal bit-field type 'double' */
/* expect+1: warning: illegal bit-field type 'double' [35] */
double double_flag: 1;
};
struct large_bit_field {

View File

@ -1 +1 @@
gcc_bit_field_types.c(20): warning: illegal bit-field type 'double' [35]
gcc_bit_field_types.c(21): warning: illegal bit-field type 'double' [35]

View File

@ -1,4 +1,4 @@
/* $NetBSD: lex_floating.c,v 1.1 2021/06/19 08:30:08 rillig Exp $ */
/* $NetBSD: lex_floating.c,v 1.2 2022/01/15 14:22:03 rillig Exp $ */
# 3 "lex_floating.c"
/*
@ -25,7 +25,8 @@ test_double(void)
{
// https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4396272
sinkd(2.2250738585072012e-308);
sinkd(1.23x); /* expect: syntax error 'x' */
/* expect+1: error: syntax error 'x' [249] */
sinkd(1.23x);
}
void

View File

@ -1 +1 @@
lex_floating.c(28): error: syntax error 'x' [249]
lex_floating.c(29): error: syntax error 'x' [249]

View File

@ -1,4 +1,4 @@
/* $NetBSD: op_colon.c,v 1.1 2021/04/02 17:25:04 rillig Exp $ */
/* $NetBSD: op_colon.c,v 1.2 2022/01/15 14:22:03 rillig Exp $ */
# 3 "op_colon.c"
/*
@ -14,22 +14,37 @@ test_merge_qualifiers(_Bool cond, int *p, const int *c, volatile int *v,
const volatile int *cv)
{
sink(cond ? p : p);
sink(cond ? p : c); /* expect: 'pointer to const int' */
sink(cond ? p : v); /* expect: 'pointer to volatile int' */
sink(cond ? p : cv); /* expect: 'pointer to const volatile int' */
/* expect+1: 'pointer to const int' */
sink(cond ? p : c);
/* expect+1: 'pointer to volatile int' */
sink(cond ? p : v);
/* expect+1: 'pointer to const volatile int' */
sink(cond ? p : cv);
sink(cond ? c : p); /* expect: 'pointer to const int' */
sink(cond ? c : c); /* expect: 'pointer to const int' */
sink(cond ? c : v); /* expect: 'pointer to const volatile int' */
sink(cond ? c : cv); /* expect: 'pointer to const volatile int' */
/* expect+1: 'pointer to const int' */
sink(cond ? c : p);
/* expect+1: 'pointer to const int' */
sink(cond ? c : c);
/* expect+1: 'pointer to const volatile int' */
sink(cond ? c : v);
/* expect+1: 'pointer to const volatile int' */
sink(cond ? c : cv);
sink(cond ? v : p); /* expect: 'pointer to volatile int' */
sink(cond ? v : c); /* expect: 'pointer to const volatile int' */
sink(cond ? v : v); /* expect: 'pointer to volatile int' */
sink(cond ? v : cv); /* expect: 'pointer to const volatile int' */
/* expect+1: 'pointer to volatile int' */
sink(cond ? v : p);
/* expect+1: 'pointer to const volatile int' */
sink(cond ? v : c);
/* expect+1: 'pointer to volatile int' */
sink(cond ? v : v);
/* expect+1: 'pointer to const volatile int' */
sink(cond ? v : cv);
sink(cond ? cv : p); /* expect: 'pointer to const volatile int' */
sink(cond ? cv : c); /* expect: 'pointer to const volatile int' */
sink(cond ? cv : v); /* expect: 'pointer to const volatile int' */
sink(cond ? cv : cv); /* expect: 'pointer to const volatile int' */
/* expect+1: 'pointer to const volatile int' */
sink(cond ? cv : p);
/* expect+1: 'pointer to const volatile int' */
sink(cond ? cv : c);
/* expect+1: 'pointer to const volatile int' */
sink(cond ? cv : v);
/* expect+1: 'pointer to const volatile int' */
sink(cond ? cv : cv);
}

View File

@ -1,15 +1,15 @@
op_colon.c(17): warning: converting 'pointer to const int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(18): warning: converting 'pointer to volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(19): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(21): warning: converting 'pointer to const int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(22): warning: converting 'pointer to const int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(23): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(24): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(26): warning: converting 'pointer to volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(27): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(28): warning: converting 'pointer to volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(18): warning: converting 'pointer to const int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(20): warning: converting 'pointer to volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(22): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(25): warning: converting 'pointer to const int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(27): warning: converting 'pointer to const int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(29): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(31): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(32): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(33): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(34): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(34): warning: converting 'pointer to volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(36): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(38): warning: converting 'pointer to volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(40): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(43): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(45): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(47): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]
op_colon.c(49): warning: converting 'pointer to const volatile int' to incompatible 'pointer to void' for argument 1 [153]

View File

@ -1,4 +1,4 @@
/* $NetBSD: stmt_for.c,v 1.1 2021/06/19 19:59:02 rillig Exp $ */
/* $NetBSD: stmt_for.c,v 1.2 2022/01/15 14:22:03 rillig Exp $ */
# 3 "stmt_for.c"
/*
@ -10,7 +10,8 @@
void
test(void)
{
for (0 0; /* expect: syntax error '0' */
/* expect+1: error: syntax error '0' [249] */
for (0 0;
}
/* expect+1: cannot recover from previous errors */

View File

@ -1,2 +1,2 @@
stmt_for.c(13): error: syntax error '0' [249]
stmt_for.c(17): error: cannot recover from previous errors [224]
stmt_for.c(14): error: syntax error '0' [249]
stmt_for.c(18): error: cannot recover from previous errors [224]