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 lint: force each test to declare the exp...



details:   https://anonhg.NetBSD.org/src/rev/2bb336d237cf
branches:  trunk
changeset: 959653:2bb336d237cf
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Feb 21 09:07:58 2021 +0000

description:
lint: force each test to declare the expected diagnostics

By listing the expected diagnostics directly at the code that triggers
the diagnostics, it is easier to cross-check whether the diagnostics
make sense.

No functional change to lint itself.

diffstat:

 tests/usr.bin/xlint/check-expect.lua                   |   4 +-
 tests/usr.bin/xlint/lint1/d_c99_bool.c                 |  24 +++++++++---------
 tests/usr.bin/xlint/lint1/d_c99_init.c                 |   4 +-
 tests/usr.bin/xlint/lint1/d_c99_union_cast.c           |   4 +-
 tests/usr.bin/xlint/lint1/d_constant_conv1.c           |   4 +-
 tests/usr.bin/xlint/lint1/d_constant_conv2.c           |   4 +-
 tests/usr.bin/xlint/lint1/d_cvt_constant.c             |   8 +++--
 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_incorrect_array_size.c     |   4 +-
 tests/usr.bin/xlint/lint1/d_lint_assert.c              |   4 +-
 tests/usr.bin/xlint/lint1/d_long_double_int.c          |   4 +-
 tests/usr.bin/xlint/lint1/d_return_type.c              |   4 +-
 tests/usr.bin/xlint/lint1/d_struct_init_nested.c       |  12 ++++----
 tests/usr.bin/xlint/lint1/d_type_conv1.c               |   4 +-
 tests/usr.bin/xlint/lint1/d_type_conv2.c               |   4 +-
 tests/usr.bin/xlint/lint1/d_type_conv3.c               |   4 +-
 tests/usr.bin/xlint/lint1/msg_011.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_012.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_013.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_014.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_015.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_016.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_017.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_018.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_020.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_022.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_023.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_024.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_025.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_026.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_028.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_030.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_032.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_033.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_038.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_039.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_040.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_041.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_042.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_043.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_044.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_045.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_046.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_047.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_048.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_049.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_052.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_053.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_058.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_059.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_062.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_063.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_064.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_065.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_067.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_069.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_070.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_076.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_077.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_078.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_079.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_080.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_090.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_091.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_092.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_102.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_103.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_104.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_105.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_106.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_107.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_110.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_111.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_112.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_113.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_118.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_119.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_128.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_131.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_132.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_134.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_135.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_137.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_138.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_139.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_140.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_141.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_147.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_148.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_149.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_151.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_152.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_153.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_154.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_155.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_157.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_158.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_159.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_162.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_176.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_179.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_181.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_182.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_183.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_184.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_185.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_186.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_187.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_188.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_190.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_195.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_196.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_197.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_198.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_199.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_200.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_201.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_202.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_203.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_205.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_206.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_207.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_208.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_209.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_210.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_211.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_212.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_213.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_214.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_215.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_218.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_222.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_226.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_227.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_228.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_229.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_233.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_234.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_235.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_236.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_237.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_238.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_239.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_240.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_241.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_242.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_244.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_245.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_246.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_247.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_248.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_249.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_250.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_251.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_252.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_253.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_254.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_255.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_256.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_257.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_258.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_260.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_261.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_262.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_263.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_264.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_266.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_267.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_268.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_269.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_270.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_271.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_272.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_273.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_274.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_275.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_276.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_277.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_278.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_279.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_280.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_281.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_282.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_283.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_284.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_285.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_286.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_287.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_288.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_289.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_290.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_291.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_292.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_293.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_294.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_295.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_296.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_297.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_298.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_299.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_300.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_301.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_302.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_303.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_304.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_305.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_306.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_307.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_309.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_310.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_311.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_312.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_313.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_314.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_315.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_316.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_317.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_318.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_319.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_320.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_321.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_322.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_323.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_325.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_326.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_327.c                    |   4 +-
 tests/usr.bin/xlint/lint1/msg_328.c                    |   4 +-
 229 files changed, 479 insertions(+), 477 deletions(-)

diffs (truncated from 3111 to 300 lines):

diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/check-expect.lua
--- a/tests/usr.bin/xlint/check-expect.lua      Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/check-expect.lua      Sun Feb 21 09:07:58 2021 +0000
@@ -1,5 +1,5 @@
 #!  /usr/bin/lua
--- $NetBSD: check-expect.lua,v 1.3 2021/02/20 22:18:32 rillig Exp $
+-- $NetBSD: check-expect.lua,v 1.4 2021/02/21 09:07:58 rillig Exp $
 
 --[[
 
@@ -51,7 +51,7 @@
     end
   end
 
-  if seen_comment then return comments_by_line else return nil end
+  return comments_by_line
 end
 
 
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_c99_bool.c
--- a/tests/usr.bin/xlint/lint1/d_c99_bool.c    Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_bool.c    Sun Feb 21 09:07:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_c99_bool.c,v 1.5 2021/01/10 13:17:24 rillig Exp $    */
+/*     $NetBSD: d_c99_bool.c,v 1.6 2021/02/21 09:07:58 rillig Exp $    */
 # 3 "d_c99_bool.c"
 
 /*
@@ -12,19 +12,19 @@
 /* Below, each wrong assertion 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];
+int int_0_converts_to_true_[(_Bool)0 ? 1 : -1];                        /* expect: 20 */
 
-int int_1_converts_to_false[(_Bool)1 ? -1 : 1];
+int int_1_converts_to_false[(_Bool)1 ? -1 : 1];                        /* expect: 20 */
 int int_1_converts_to_true_[(_Bool)1 ? 1 : -1];
 
-int int_2_converts_to_false[(_Bool)2 ? -1 : 1];
+int int_2_converts_to_false[(_Bool)2 ? -1 : 1];                        /* expect: 20 */
 int int_2_converts_to_true_[(_Bool)2 ? 1 : -1];
 
-int int_256_converts_to_false[(_Bool)256 ? -1 : 1];
+int int_256_converts_to_false[(_Bool)256 ? -1 : 1];            /* expect: 20 */
 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];
+int null_pointer_converts_to_true_[(_Bool)(void *)0 ? 1 : -1]; /* expect: 20 */
 
 /*
  * XXX: lint does not treat the address of a global variable as a constant
@@ -38,23 +38,23 @@
 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];
+int double_minus_1_0_converts_to_false[(_Bool)-1.0 ? -1 : 1];  /* expect: 20 */
 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];
+int double_minus_0_5_converts_to_false[(_Bool)-0.5 ? -1 : 1];  /* expect: 20 */
 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];
+int double_minus_0_0_converts_to_true_[(_Bool)-0.0 ? 1 : -1];  /* expect: 20 */
 
 int double_0_0_converts_to_false[(_Bool)0.0 ? -1 : 1];
-int double_0_0_converts_to_true_[(_Bool)0.0 ? 1 : -1];
+int double_0_0_converts_to_true_[(_Bool)0.0 ? 1 : -1];         /* expect: 20 */
 
 /* 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];
+int double_0_5_converts_to_false[(_Bool)0.5 ? -1 : 1];         /* expect: 20 */
 int double_0_5_converts_to_true_[(_Bool)0.5 ? 1 : -1];
 
-int double_1_0_converts_to_false[(_Bool)1.0 ? -1 : 1];
+int double_1_0_converts_to_false[(_Bool)1.0 ? -1 : 1];         /* expect: 20 */
 int double_1_0_converts_to_true_[(_Bool)1.0 ? 1 : -1];
 
 _Bool
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_c99_init.c
--- a/tests/usr.bin/xlint/lint1/d_c99_init.c    Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_init.c    Sun Feb 21 09:07:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_c99_init.c,v 1.1 2021/02/21 08:05:51 rillig Exp $    */
+/*     $NetBSD: d_c99_init.c,v 1.2 2021/02/21 09:07:58 rillig Exp $    */
 # 3 "d_c99_init.c"
 
 /*
@@ -13,4 +13,4 @@
 // interpretation is "optionally enclosed in a single pair of braces".
 int scalar_without_braces = 3;
 int scalar_with_optional_braces = { 3 };
-int scalar_with_too_many_braces = {{ 3 }};
+int scalar_with_too_many_braces = {{ 3 }};     /* expect: 176 */
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_c99_union_cast.c
--- a/tests/usr.bin/xlint/lint1/d_c99_union_cast.c      Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_union_cast.c      Sun Feb 21 09:07:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_c99_union_cast.c,v 1.3 2021/01/31 14:57:28 rillig Exp $      */
+/*     $NetBSD: d_c99_union_cast.c,v 1.4 2021/02/21 09:07:58 rillig Exp $      */
 # 3 "d_c99_union_cast.c"
 
 /* union cast */
@@ -16,7 +16,7 @@
 void
 foo(void)
 {
-       struct bar *a;
+       struct bar *a;          /* expect: 192 */
 
        ((union foo)a).a;
 }
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_constant_conv1.c
--- a/tests/usr.bin/xlint/lint1/d_constant_conv1.c      Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_constant_conv1.c      Sun Feb 21 09:07:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_constant_conv1.c,v 1.2 2021/01/31 14:39:31 rillig Exp $      */
+/*     $NetBSD: d_constant_conv1.c,v 1.3 2021/02/21 09:07:58 rillig Exp $      */
 # 3 "d_constant_conv1.c"
 
 /* Flag information-losing constant conversion in argument lists */
@@ -8,5 +8,5 @@
 void
 should_fail()
 {
-       f(-1);
+       f(-1);                  /* expect: 296 */
 }
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_constant_conv2.c
--- a/tests/usr.bin/xlint/lint1/d_constant_conv2.c      Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_constant_conv2.c      Sun Feb 21 09:07:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_constant_conv2.c,v 1.2 2021/01/31 14:39:31 rillig Exp $      */
+/*     $NetBSD: d_constant_conv2.c,v 1.3 2021/02/21 09:07:58 rillig Exp $      */
 # 3 "d_constant_conv2.c"
 
 /* Flag information-losing constant conversion in argument lists */
@@ -8,5 +8,5 @@
 void
 should_fail()
 {
-       f(2.1);
+       f(2.1);                 /* expect: 259 */
 }
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_cvt_constant.c
--- a/tests/usr.bin/xlint/lint1/d_cvt_constant.c        Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_cvt_constant.c        Sun Feb 21 09:07:58 2021 +0000
@@ -1,12 +1,14 @@
-/*     $NetBSD: d_cvt_constant.c,v 1.3 2021/01/31 14:57:28 rillig Exp $        */
+/*     $NetBSD: d_cvt_constant.c,v 1.4 2021/02/21 09:07:58 rillig Exp $        */
 # 3 "d_cvt_constant.c"
 
 /* the second assignment assumes failed before */
 int
 main(void)
 {
-       double x = 1;
+       double x = 1;           /* expect: 191 */
        int foo = 0;
        if (foo)
                x = 1;
-}
+}                              /* expect: 217 */
+// FIXME: Since C99, main may fall off the bottom without returning a value.
+//  Therefore there should be no warning 217.
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c
--- a/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c    Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c    Sun Feb 21 09:07:58 2021 +0000
@@ -7,9 +7,9 @@
 
 void func(int a, int b, int c);
 
-void func(num, ptr, dbl, def)
+void func(num, ptr, dbl, def)  /* expect: 231, 231, 231, 231 */
     int num;
     char *ptr;
     double dbl;
-{
+{                              /* expect: 32, 51 */
 }
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_fold_test.c
--- a/tests/usr.bin/xlint/lint1/d_fold_test.c   Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_fold_test.c   Sun Feb 21 09:07:58 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; }
-void if_union(union u u)               { if (u) 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_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; }
-void for_struct(struct s s)            { for (;s;) return; }
-void do_while_struct(struct s s)       { do { return; } while (s); }
+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 */
 
 /* C99 6.5.15 does not require a scalar type, curiously. */
-int conditional_struct(struct s s)     { return s ? 1 : 2; }
+int conditional_struct(struct s s)     { return s ? 1 : 2; }   /* expect: 170, 214, 231 */
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_gcc_extension.c
--- a/tests/usr.bin/xlint/lint1/d_gcc_extension.c       Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_gcc_extension.c       Sun Feb 21 09:07:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_gcc_extension.c,v 1.3 2021/01/31 14:57:28 rillig Exp $       */
+/*     $NetBSD: d_gcc_extension.c,v 1.4 2021/02/21 09:07:58 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_));
+               !__builtin_isinf((x_)) && !__builtin_isnan((x_)); /* expect: 259, 259 */
        })))
                __logbw = 1;
 }
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_incorrect_array_size.c
--- a/tests/usr.bin/xlint/lint1/d_incorrect_array_size.c        Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_incorrect_array_size.c        Sun Feb 21 09:07:58 2021 +0000
@@ -1,6 +1,6 @@
-/*     $NetBSD: d_incorrect_array_size.c,v 1.2 2021/01/31 14:39:31 rillig Exp $        */
+/*     $NetBSD: d_incorrect_array_size.c,v 1.3 2021/02/21 09:07:58 rillig Exp $        */
 # 3 "d_incorrect_array_size.c"
 
 struct foo {
-       int a[-1];
+       int a[-1];              /* expect: 20 */
 };
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_lint_assert.c
--- a/tests/usr.bin/xlint/lint1/d_lint_assert.c Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_lint_assert.c Sun Feb 21 09:07:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_lint_assert.c,v 1.2 2021/01/10 18:13:43 rillig Exp $ */
+/*     $NetBSD: d_lint_assert.c,v 1.3 2021/02/21 09:07:58 rillig Exp $ */
 # 3 "d_lint_assert.c"
 
 /*
@@ -12,4 +12,4 @@
        // failed in check_global_variable at decl.c:3135
        // near d_lint_assert.c:14
        A = +++
-};
+};                             /* expect: 249 */
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_long_double_int.c
--- a/tests/usr.bin/xlint/lint1/d_long_double_int.c     Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_long_double_int.c     Sun Feb 21 09:07:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_long_double_int.c,v 1.3 2021/01/31 14:39:31 rillig Exp $     */
+/*     $NetBSD: d_long_double_int.c,v 1.4 2021/02/21 09:07:58 rillig Exp $     */
 # 3 "d_long_double_int.c"
 
 /* PR bin/39639: writing "long double" gave "long int" */
@@ -6,5 +6,5 @@
 int
 fail(long double *a, long int *b)
 {
-       return a == b;
+       return a == b;          /* expect: 124 */
 }
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_return_type.c
--- a/tests/usr.bin/xlint/lint1/d_return_type.c Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_return_type.c Sun Feb 21 09:07:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_return_type.c,v 1.2 2021/01/31 14:39:31 rillig Exp $ */
+/*     $NetBSD: d_return_type.c,v 1.3 2021/02/21 09:07:58 rillig Exp $ */
 # 3 "d_return_type.c"
 
 enum A {
@@ -12,5 +12,5 @@
 enum A
 func(enum B arg)
 {
-       return arg;
+       return arg;             /* expect: 211 */
 }
diff -r addb70dbeeae -r 2bb336d237cf tests/usr.bin/xlint/lint1/d_struct_init_nested.c
--- a/tests/usr.bin/xlint/lint1/d_struct_init_nested.c  Sun Feb 21 08:47:13 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_struct_init_nested.c  Sun Feb 21 09:07:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_struct_init_nested.c,v 1.3 2021/01/31 14:39:31 rillig Exp $  */
+/*     $NetBSD: d_struct_init_nested.c,v 1.4 2021/02/21 09:07:58 rillig Exp $  */
 # 3 "d_struct_init_nested.c"
 
 /*
@@ -32,9 +32,9 @@
        };
        struct Outer3Inner1 o3i1 = {
            O1C,
-           inner,



Home | Main Index | Thread Index | Old Index