Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/usr.bin/xlint tests/lint: one comment per expected dia...
details: https://anonhg.NetBSD.org/src/rev/c517fa8d7297
branches: trunk
changeset: 982210:c517fa8d7297
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Apr 05 01:35:34 2021 +0000
description:
tests/lint: one comment per expected diagnostic
This makes it possible to check for diagnostics that contain commas.
diffstat:
tests/usr.bin/xlint/check-expect.lua | 14 +--
tests/usr.bin/xlint/lint1/d_c99_bool_strict.c | 62 +++++++++---------
tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c | 4 +-
tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c | 4 +-
tests/usr.bin/xlint/lint1/d_fold_test.c | 12 +-
tests/usr.bin/xlint/lint1/d_gcc_extension.c | 4 +-
tests/usr.bin/xlint/lint1/d_type_conv3.c | 4 +-
tests/usr.bin/xlint/lint1/msg_004.c | 4 +-
tests/usr.bin/xlint/lint1/msg_006.c | 4 +-
tests/usr.bin/xlint/lint1/msg_019.c | 6 +-
tests/usr.bin/xlint/lint1/msg_035.c | 6 +-
tests/usr.bin/xlint/lint1/msg_051.c | 4 +-
tests/usr.bin/xlint/lint1/msg_057.c | 6 +-
tests/usr.bin/xlint/lint1/msg_060.c | 4 +-
tests/usr.bin/xlint/lint1/msg_071.c | 4 +-
tests/usr.bin/xlint/lint1/msg_074.c | 4 +-
tests/usr.bin/xlint/lint1/msg_096.c | 4 +-
tests/usr.bin/xlint/lint1/msg_098.c | 4 +-
tests/usr.bin/xlint/lint1/msg_109.c | 4 +-
tests/usr.bin/xlint/lint1/msg_117.c | 6 +-
tests/usr.bin/xlint/lint1/msg_120.c | 6 +-
tests/usr.bin/xlint/lint1/msg_126.c | 6 +-
tests/usr.bin/xlint/lint1/msg_142.c | 4 +-
tests/usr.bin/xlint/lint1/msg_163.c | 4 +-
tests/usr.bin/xlint/lint1/msg_170.c | 4 +-
tests/usr.bin/xlint/lint1/msg_176.c | 4 +-
tests/usr.bin/xlint/lint1/msg_204.c | 14 ++--
tests/usr.bin/xlint/lint1/msg_224.c | 4 +-
tests/usr.bin/xlint/lint1/msg_239.c | 6 +-
tests/usr.bin/xlint/lint1/msg_308.c | 4 +-
tests/usr.bin/xlint/lint1/msg_330.c | 6 +-
tests/usr.bin/xlint/lint1/msg_331.c | 6 +-
tests/usr.bin/xlint/lint1/msg_332.c | 6 +-
tests/usr.bin/xlint/lint1/msg_336.c | 4 +-
tests/usr.bin/xlint/lint1/msg_337.c | 4 +-
tests/usr.bin/xlint/lint1/msg_338.c | 4 +-
tests/usr.bin/xlint/lint1/msg_339.c | 4 +-
37 files changed, 125 insertions(+), 129 deletions(-)
diffs (truncated from 793 to 300 lines):
diff -r 980d785b9c8e -r c517fa8d7297 tests/usr.bin/xlint/check-expect.lua
--- a/tests/usr.bin/xlint/check-expect.lua Mon Apr 05 01:24:50 2021 +0000
+++ b/tests/usr.bin/xlint/check-expect.lua Mon Apr 05 01:35:34 2021 +0000
@@ -1,5 +1,5 @@
#! /usr/bin/lua
--- $NetBSD: check-expect.lua,v 1.6 2021/02/28 01:20:54 rillig Exp $
+-- $NetBSD: check-expect.lua,v 1.7 2021/04/05 01:35:34 rillig Exp $
--[[
@@ -43,16 +43,12 @@
for lineno, line in ipairs(lines) do
- for offset, comments in line:gmatch("/%* expect([+%-]%d+): (.-) %*/") do
- for comment in comments:gmatch("[^,]+") do
- add_expectation(lineno + tonumber(offset), comment)
- end
+ for offset, comment in line:gmatch("/%* expect([+%-]%d+): (.-) %*/") do
+ add_expectation(lineno + tonumber(offset), comment)
end
- for comments in line:gmatch("/%* expect: (.-) %*/") do
- for comment in comments:gmatch("[^,]+") do
- add_expectation(lineno, comment)
- end
+ for comment in line:gmatch("/%* expect: (.-) %*/") do
+ add_expectation(lineno, comment)
end
local pp_lineno, pp_fname = line:match("^#%s*(%d+)%s+\"([^\"]+)\"")
diff -r 980d785b9c8e -r c517fa8d7297 tests/usr.bin/xlint/lint1/d_c99_bool_strict.c
--- a/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c Mon Apr 05 01:24:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c Mon Apr 05 01:35:34 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: d_c99_bool_strict.c,v 1.27 2021/03/23 23:12:21 rillig Exp $ */
+/* $NetBSD: d_c99_bool_strict.c,v 1.28 2021/04/05 01:35:34 rillig Exp $ */
# 3 "d_c99_bool_strict.c"
/*
@@ -166,7 +166,7 @@
* 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, 331 */
+ Q2 = (13 > 12 ? 1 : 7) ? 100 : 101, /* expect: 161 *//* expect: 331 */
BINAND_BOOL = __lint_false & __lint_true, /* expect: 55 */
BINAND_INT = 0 & 1,
@@ -177,11 +177,11 @@
BINOR_BOOL = __lint_false | __lint_true, /* expect: 55 */
BINOR_INT = 0 | 1,
- LOGOR_BOOL = __lint_false || __lint_true, /* expect: 161, 55 */
- LOGOR_INT = 0 || 1, /* expect: 331, 332 */
+ LOGOR_BOOL = __lint_false || __lint_true, /* expect: 161 *//* expect: 55 */
+ LOGOR_INT = 0 || 1, /* expect: 331 *//* expect: 332 */
- LOGAND_BOOL = __lint_false && __lint_true, /* expect: 161, 55 */
- LOGAND_INT = 0 && 1, /* expect: 331, 332 */
+ LOGAND_BOOL = __lint_false && __lint_true, /* expect: 161 *//* expect: 55 */
+ LOGAND_INT = 0 && 1, /* expect: 331 *//* expect: 332 */
};
/*
@@ -298,13 +298,13 @@
take_arguments(b, i, p);
/* Implicitly converting bool to other scalar types. */
- take_arguments(b, b, b); /* expect: 334, 334 */
+ take_arguments(b, b, b); /* expect: 334 *//* expect: 334 */
/* Implicitly converting int to bool (arg #1). */
- take_arguments(i, i, i); /* expect: 334, 154 */
+ take_arguments(i, i, i); /* expect: 334 *//* expect: 154 */
/* Implicitly converting pointer to bool (arg #1). */
- take_arguments(p, p, p); /* expect: 334, 154 */
+ take_arguments(p, p, p); /* expect: 334 *//* expect: 154 */
/* Passing bool as vararg. */
take_arguments(b, i, p, b, i, p); /* TODO: expect: arg#4 */
@@ -416,8 +416,8 @@
b = !b;
b = !!!b;
- b = !__lint_false; /* expect: 161, 239 */
- b = !__lint_true; /* expect: 161, 239 */
+ b = !__lint_false; /* expect: 161 *//* expect: 239 */
+ b = !__lint_true; /* expect: 161 *//* expect: 239 */
int i = 0;
@@ -500,8 +500,8 @@
* scalar to bool.
*/
b = !i; /* expect: 330 */
- b = i && i; /* expect: 331, 332 */
- b = i || i; /* expect: 331, 332 */
+ b = i && i; /* expect: 331 *//* expect: 332 */
+ b = i || i; /* expect: 331 *//* expect: 332 */
b = b && 0; /* expect: 332 */
b = 0 && b; /* expect: 331 */
@@ -523,18 +523,18 @@
b = +b; /* expect: 335 */
b = -b; /* expect: 335 */
- b = b * b; /* expect: 336, 337 */
- b = b / b; /* expect: 336, 337 */
- b = b % b; /* expect: 336, 337 */
- b = b + b; /* expect: 336, 337 */
- b = b - b; /* expect: 336, 337 */
- b = b << b; /* expect: 336, 337 */
- b = b >> b; /* expect: 336, 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 */
+ b = b >> b; /* expect: 336 *//* expect: 337 */
- b = b < b; /* expect: 336, 337 */
- b = b <= b; /* expect: 336, 337 */
- b = b > b; /* expect: 336, 337 */
- b = b >= b; /* expect: 336, 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;
b = b != b;
@@ -546,13 +546,13 @@
b = b ? b : b;
b = b;
- b *= b; /* expect: 336, 337 */
- b /= b; /* expect: 336, 337 */
- b %= b; /* expect: 336, 337 */
- b += b; /* expect: 336, 337 */
- b -= b; /* expect: 336, 337 */
- b <<= b; /* expect: 336, 337 */
- b >>= b; /* expect: 336, 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 */
+ b >>= b; /* expect: 336 *//* expect: 337 */
b &= b;
b ^= b;
b |= b;
diff -r 980d785b9c8e -r c517fa8d7297 tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c
--- a/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c Mon Apr 05 01:24:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_bool_strict_syshdr.c Mon Apr 05 01:35:34 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: d_c99_bool_strict_syshdr.c,v 1.8 2021/01/24 09:18:42 rillig Exp $ */
+/* $NetBSD: d_c99_bool_strict_syshdr.c,v 1.9 2021/04/05 01:35:34 rillig Exp $ */
# 3 "d_c99_bool_strict_syshdr.c"
/*
@@ -172,7 +172,7 @@
_Bool
str_equal_bad(const char *s1, const char *s2)
{
- return !strcmp(s1, s2); /* expect: 330, 214 */
+ return !strcmp(s1, s2); /* expect: 330 *//* expect: 214 */
}
_Bool
diff -r 980d785b9c8e -r c517fa8d7297 tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c
--- a/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c Mon Apr 05 01:24:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c Mon Apr 05 01:35:34 2021 +0000
@@ -7,9 +7,9 @@
void func(int a, int b, int c);
-void func(num, ptr, dbl, def) /* expect: 231, 231, 231, 231 */
+void func(num, ptr, dbl, def) /* expect: 231 *//* expect: 231 *//* expect: 231 *//* expect: 231 */
int num;
char *ptr;
double dbl;
-{ /* expect: 32, 51 */
+{ /* expect: 32 *//* expect: 51 */
}
diff -r 980d785b9c8e -r c517fa8d7297 tests/usr.bin/xlint/lint1/d_fold_test.c
--- a/tests/usr.bin/xlint/lint1/d_fold_test.c Mon Apr 05 01:24:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_fold_test.c Mon Apr 05 01:35:34 2021 +0000
@@ -56,15 +56,15 @@
/* 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, 231 */
-void if_union(union u u) { if (u) return; } /* expect: 204, 231 */
+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 */
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, 231 */
-void for_struct(struct s s) { for (;s;) return; } /* expect: 204, 223, 231 */
-void do_while_struct(struct s s) { do { return; } while (s); } /* expect: 204, 231 */
+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 */
/* C99 6.5.15 does not require a scalar type, curiously. */
-int conditional_struct(struct s s) { return s ? 1 : 2; } /* expect: 170, 214, 231 */
+int conditional_struct(struct s s) { return s ? 1 : 2; } /* expect: 170 *//* expect: 214 *//* expect: 231 */
diff -r 980d785b9c8e -r c517fa8d7297 tests/usr.bin/xlint/lint1/d_gcc_extension.c
--- a/tests/usr.bin/xlint/lint1/d_gcc_extension.c Mon Apr 05 01:24:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_gcc_extension.c Mon Apr 05 01:35:34 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: d_gcc_extension.c,v 1.4 2021/02/21 09:07:58 rillig Exp $ */
+/* $NetBSD: d_gcc_extension.c,v 1.5 2021/04/05 01:35:34 rillig Exp $ */
# 3 "d_gcc_extension.c"
/* extension */
@@ -8,7 +8,7 @@
double __logbw = 1;
if (__extension__(({
__typeof((__logbw)) x_ = (__logbw);
- !__builtin_isinf((x_)) && !__builtin_isnan((x_)); /* expect: 259, 259 */
+ !__builtin_isinf((x_)) && !__builtin_isnan((x_)); /* expect: 259 *//* expect: 259 */
})))
__logbw = 1;
}
diff -r 980d785b9c8e -r c517fa8d7297 tests/usr.bin/xlint/lint1/d_type_conv3.c
--- a/tests/usr.bin/xlint/lint1/d_type_conv3.c Mon Apr 05 01:24:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_type_conv3.c Mon Apr 05 01:35:34 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: d_type_conv3.c,v 1.3 2021/02/21 09:07:58 rillig Exp $ */
+/* $NetBSD: d_type_conv3.c,v 1.4 2021/04/05 01:35:34 rillig Exp $ */
# 3 "d_type_conv3.c"
/* Flag information-losing type conversion in argument lists */
@@ -9,5 +9,5 @@
should_fail()
{
- f(0x7fffffffffffffffLL); /* expect: 259, 295 */
+ f(0x7fffffffffffffffLL); /* expect: 259 *//* expect: 295 */
}
diff -r 980d785b9c8e -r c517fa8d7297 tests/usr.bin/xlint/lint1/msg_004.c
--- a/tests/usr.bin/xlint/lint1/msg_004.c Mon Apr 05 01:24:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_004.c Mon Apr 05 01:35:34 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_004.c,v 1.3 2021/01/31 11:12:07 rillig Exp $ */
+/* $NetBSD: msg_004.c,v 1.4 2021/04/05 01:35:34 rillig Exp $ */
# 3 "msg_004.c"
// Test for message: illegal type combination [4]
@@ -10,7 +10,7 @@
double ok_double;
float _Complex ok_float_complex;
-int _Complex illegal_int_complex; /* expect: 4, 308 */
+int _Complex illegal_int_complex; /* expect: 4 *//* expect: 308 */
char enum {
CHAR
diff -r 980d785b9c8e -r c517fa8d7297 tests/usr.bin/xlint/lint1/msg_006.c
--- a/tests/usr.bin/xlint/lint1/msg_006.c Mon Apr 05 01:24:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_006.c Mon Apr 05 01:35:34 2021 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: msg_006.c,v 1.3 2021/01/31 11:12:07 rillig Exp $ */
+/* $NetBSD: msg_006.c,v 1.4 2021/04/05 01:35:34 rillig Exp $ */
# 3 "msg_006.c"
// Test for message: use 'double' instead of 'long float' [6]
-long float x; /* expect: 6, 4 */
+long float x; /* expect: 6 *//* expect: 4 */
double x;
diff -r 980d785b9c8e -r c517fa8d7297 tests/usr.bin/xlint/lint1/msg_019.c
--- a/tests/usr.bin/xlint/lint1/msg_019.c Mon Apr 05 01:24:50 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_019.c Mon Apr 05 01:35:34 2021 +0000
@@ -1,14 +1,14 @@
-/* $NetBSD: msg_019.c,v 1.3 2021/01/31 11:23:01 rillig Exp $ */
+/* $NetBSD: msg_019.c,v 1.4 2021/04/05 01:35:34 rillig Exp $ */
# 3 "msg_019.c"
// Test for message: void type for '%s' [19]
void global_variable; /* expect: 19 */
-static void unit_variable; /* expect: 19, 226 */
+static void unit_variable; /* expect: 19 *//* expect: 226 */
void
-function(void parameter) /* expect: 61, 231 */
+function(void parameter) /* expect: 61 *//* expect: 231 */
{
void local_variable; /* expect: 19 */
}
diff -r 980d785b9c8e -r c517fa8d7297 tests/usr.bin/xlint/lint1/msg_035.c
Home |
Main Index |
Thread Index |
Old Index