From c6466ed0f7b5b26a3f7774bb65f229ef46abdf62 Mon Sep 17 00:00:00 2001 From: rillig Date: Sat, 30 Mar 2024 16:47:44 +0000 Subject: [PATCH] lint: reword messages about array subscripts to sound more natural --- tests/usr.bin/xlint/lint1/d_c99_init.c | 8 ++-- tests/usr.bin/xlint/lint1/msg_167.c | 6 +-- tests/usr.bin/xlint/lint1/msg_168.c | 8 ++-- .../usr.bin/xlint/lint1/platform_ilp32_int.c | 46 +++++++++---------- .../usr.bin/xlint/lint1/platform_ilp32_long.c | 46 +++++++++---------- tests/usr.bin/xlint/lint1/platform_lp64.c | 46 +++++++++---------- usr.bin/xlint/lint1/err.c | 8 ++-- usr.bin/xlint/lint1/init.c | 8 ++-- usr.bin/xlint/lint1/tree.c | 10 ++-- 9 files changed, 93 insertions(+), 93 deletions(-) diff --git a/tests/usr.bin/xlint/lint1/d_c99_init.c b/tests/usr.bin/xlint/lint1/d_c99_init.c index 3779e1397619..893c8502b823 100644 --- a/tests/usr.bin/xlint/lint1/d_c99_init.c +++ b/tests/usr.bin/xlint/lint1/d_c99_init.c @@ -1,4 +1,4 @@ -/* $NetBSD: d_c99_init.c,v 1.47 2024/01/28 08:17:27 rillig Exp $ */ +/* $NetBSD: d_c99_init.c,v 1.48 2024/03/30 16:47:45 rillig Exp $ */ # 3 "d_c99_init.c" /* @@ -238,11 +238,11 @@ struct geometry geometry = { .pentagons[0].points[4].x = 1, .points[0][0][0] = { 0, 0 }, .points[2][4][1] = {301, 302 }, - /* expect+1: error: array subscript cannot be > 2: 3 [168] */ + /* expect+1: error: array subscript 3 cannot be > 2 [168] */ .points[3][0][0] = {3001, 3002 }, - /* expect+1: error: array subscript cannot be > 4: 5 [168] */ + /* expect+1: error: array subscript 5 cannot be > 4 [168] */ .points[0][5][0] = {501, 502 }, - /* expect+1: error: array subscript cannot be > 1: 2 [168] */ + /* expect+1: error: array subscript 2 cannot be > 1 [168] */ .points[0][0][2] = {21, 22 }, }; diff --git a/tests/usr.bin/xlint/lint1/msg_167.c b/tests/usr.bin/xlint/lint1/msg_167.c index 035635d766f5..ed2b48f4bcdc 100644 --- a/tests/usr.bin/xlint/lint1/msg_167.c +++ b/tests/usr.bin/xlint/lint1/msg_167.c @@ -1,7 +1,7 @@ -/* $NetBSD: msg_167.c,v 1.6 2024/03/27 19:28:20 rillig Exp $ */ +/* $NetBSD: msg_167.c,v 1.7 2024/03/30 16:47:45 rillig Exp $ */ # 3 "msg_167.c" -// Test for message: array subscript cannot be negative: %jd [167] +// Test for message: array subscript %jd cannot be negative [167] /* lint1-extra-flags: -X 351 */ @@ -10,7 +10,7 @@ example(int *ptr) { int arr[6]; - /* expect+1: warning: array subscript cannot be negative: -3 [167] */ + /* expect+1: warning: array subscript -3 cannot be negative [167] */ arr[-3] = 13; /* diff --git a/tests/usr.bin/xlint/lint1/msg_168.c b/tests/usr.bin/xlint/lint1/msg_168.c index b707d3f261f7..fdd672307c1d 100644 --- a/tests/usr.bin/xlint/lint1/msg_168.c +++ b/tests/usr.bin/xlint/lint1/msg_168.c @@ -1,7 +1,7 @@ -/* $NetBSD: msg_168.c,v 1.11 2024/03/27 19:28:20 rillig Exp $ */ +/* $NetBSD: msg_168.c,v 1.12 2024/03/30 16:47:45 rillig Exp $ */ # 3 "msg_168.c" -// Test for message: array subscript cannot be > %d: %jd [168] +// Test for message: array subscript %jd cannot be > %d [168] /* lint1-extra-flags: -X 351 */ @@ -27,7 +27,7 @@ example(void) print_string(buf + 21); /* undefined behavior, not detected */ print_char(buf[19]); - /* expect+1: warning: array subscript cannot be > 19: 20 [168] */ + /* expect+1: warning: array subscript 20 cannot be > 19 [168] */ print_char(buf[20]); } @@ -41,7 +41,7 @@ array_with_c99_initializer(void) }; print_string(to_roman['9']); - /* expect+1: warning: array subscript cannot be > 57: 58 [168] */ + /* expect+1: warning: array subscript 58 cannot be > 57 [168] */ print_string(to_roman[':']); } diff --git a/tests/usr.bin/xlint/lint1/platform_ilp32_int.c b/tests/usr.bin/xlint/lint1/platform_ilp32_int.c index 76ddde4073f5..8ac45bbea0d5 100644 --- a/tests/usr.bin/xlint/lint1/platform_ilp32_int.c +++ b/tests/usr.bin/xlint/lint1/platform_ilp32_int.c @@ -1,4 +1,4 @@ -/* $NetBSD: platform_ilp32_int.c,v 1.6 2024/03/10 19:45:14 rillig Exp $ */ +/* $NetBSD: platform_ilp32_int.c,v 1.7 2024/03/30 16:47:45 rillig Exp $ */ # 3 "platform_ilp32_int.c" /* @@ -37,69 +37,69 @@ void array_index(void) { - /* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */ + /* expect+1: warning: array subscript 16777215 cannot be > 19 [168] */ u8 += u8_buf[0x00ffffff]; - /* expect+1: warning: array subscript cannot be > 19: 2147483647 [168] */ + /* expect+1: warning: array subscript 2147483647 cannot be > 19 [168] */ u8 += u8_buf[0x7fffffff]; /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */ + /* expect+1: warning: array subscript -2147483648 cannot be negative [167] */ u8 += u8_buf[2147483648]; /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */ + /* expect+1: warning: array subscript -2147483648 cannot be negative [167] */ u8 += u8_buf[0x80000000]; /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u8 += u8_buf[0xffffffff]; /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */ + /* expect+1: warning: array subscript -2147483648 cannot be negative [167] */ u8 += u8_buf[0x80000000]; /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u8 += u8_buf[0xffffffff]; /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u8 += u8_buf[0x00ffffffffffffff]; - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u8 += u8_buf[0xffffffffffffffff]; - /* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */ + /* expect+1: warning: array subscript 16777215 cannot be > 19 [168] */ u64 += u64_buf[0x00ffffff]; /* expect+2: warning: '2147483647 * 8' overflows 'int' [141] */ - /* expect+1: warning: array subscript cannot be > 19: 268435455 [168] */ + /* expect+1: warning: array subscript 268435455 cannot be > 19 [168] */ u64 += u64_buf[0x7fffffff]; /* expect+3: warning: conversion of 'long long' to 'int' is out of range [119] */ /* expect+2: warning: '-2147483648 * 8' overflows 'int' [141] */ - /* expect+1: warning: array subscript cannot be negative: -268435456 [167] */ + /* expect+1: warning: array subscript -268435456 cannot be negative [167] */ u64 += u64_buf[2147483648]; /* expect+3: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ /* expect+2: warning: '-2147483648 * 8' overflows 'int' [141] */ - /* expect+1: warning: array subscript cannot be negative: -268435456 [167] */ + /* expect+1: warning: array subscript -268435456 cannot be negative [167] */ u64 += u64_buf[0x80000000]; /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0xffffffff]; /* expect+3: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ /* expect+2: warning: '-2147483648 * 8' overflows 'int' [141] */ - /* expect+1: warning: array subscript cannot be negative: -268435456 [167] */ + /* expect+1: warning: array subscript -268435456 cannot be negative [167] */ u64 += u64_buf[0x80000000]; /* expect+2: warning: conversion of 'unsigned int' to 'int' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0xffffffff]; /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0x00ffffffffffffff]; /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0x0fffffffffffffff]; /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0x1fffffffffffffff]; /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0x3fffffffffffffff]; /* expect+2: warning: conversion of 'long long' to 'int' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0x7fffffffffffffff]; - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0xffffffffffffffff]; } diff --git a/tests/usr.bin/xlint/lint1/platform_ilp32_long.c b/tests/usr.bin/xlint/lint1/platform_ilp32_long.c index 0cd4127b867c..c83f53e178fd 100644 --- a/tests/usr.bin/xlint/lint1/platform_ilp32_long.c +++ b/tests/usr.bin/xlint/lint1/platform_ilp32_long.c @@ -1,4 +1,4 @@ -/* $NetBSD: platform_ilp32_long.c,v 1.8 2024/03/10 19:45:14 rillig Exp $ */ +/* $NetBSD: platform_ilp32_long.c,v 1.9 2024/03/30 16:47:45 rillig Exp $ */ # 3 "platform_ilp32_long.c" /* @@ -46,69 +46,69 @@ void array_index(void) { - /* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */ + /* expect+1: warning: array subscript 16777215 cannot be > 19 [168] */ u8 += u8_buf[0x00ffffff]; - /* expect+1: warning: array subscript cannot be > 19: 2147483647 [168] */ + /* expect+1: warning: array subscript 2147483647 cannot be > 19 [168] */ u8 += u8_buf[0x7fffffff]; /* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */ + /* expect+1: warning: array subscript -2147483648 cannot be negative [167] */ u8 += u8_buf[2147483648]; /* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */ + /* expect+1: warning: array subscript -2147483648 cannot be negative [167] */ u8 += u8_buf[0x80000000]; /* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u8 += u8_buf[0xffffffff]; /* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -2147483648 [167] */ + /* expect+1: warning: array subscript -2147483648 cannot be negative [167] */ u8 += u8_buf[0x80000000]; /* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u8 += u8_buf[0xffffffff]; /* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u8 += u8_buf[0x00ffffffffffffff]; - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u8 += u8_buf[0xffffffffffffffff]; - /* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */ + /* expect+1: warning: array subscript 16777215 cannot be > 19 [168] */ u64 += u64_buf[0x00ffffff]; /* expect+2: warning: '2147483647 * 8' overflows 'long' [141] */ - /* expect+1: warning: array subscript cannot be > 19: 268435455 [168] */ + /* expect+1: warning: array subscript 268435455 cannot be > 19 [168] */ u64 += u64_buf[0x7fffffff]; /* expect+3: warning: conversion of 'long long' to 'long' is out of range [119] */ /* expect+2: warning: '-2147483648 * 8' overflows 'long' [141] */ - /* expect+1: warning: array subscript cannot be negative: -268435456 [167] */ + /* expect+1: warning: array subscript -268435456 cannot be negative [167] */ u64 += u64_buf[2147483648]; /* expect+3: warning: conversion of 'unsigned int' to 'long' is out of range [119] */ /* expect+2: warning: '-2147483648 * 8' overflows 'long' [141] */ - /* expect+1: warning: array subscript cannot be negative: -268435456 [167] */ + /* expect+1: warning: array subscript -268435456 cannot be negative [167] */ u64 += u64_buf[0x80000000]; /* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0xffffffff]; /* expect+3: warning: conversion of 'unsigned int' to 'long' is out of range [119] */ /* expect+2: warning: '-2147483648 * 8' overflows 'long' [141] */ - /* expect+1: warning: array subscript cannot be negative: -268435456 [167] */ + /* expect+1: warning: array subscript -268435456 cannot be negative [167] */ u64 += u64_buf[0x80000000]; /* expect+2: warning: conversion of 'unsigned int' to 'long' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0xffffffff]; /* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0x00ffffffffffffff]; /* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0x0fffffffffffffff]; /* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0x1fffffffffffffff]; /* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0x3fffffffffffffff]; /* expect+2: warning: conversion of 'long long' to 'long' is out of range [119] */ - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0x7fffffffffffffff]; - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0xffffffffffffffff]; } diff --git a/tests/usr.bin/xlint/lint1/platform_lp64.c b/tests/usr.bin/xlint/lint1/platform_lp64.c index 98b1f0efbf85..6777cd44d345 100644 --- a/tests/usr.bin/xlint/lint1/platform_lp64.c +++ b/tests/usr.bin/xlint/lint1/platform_lp64.c @@ -1,4 +1,4 @@ -/* $NetBSD: platform_lp64.c,v 1.12 2024/03/10 19:45:14 rillig Exp $ */ +/* $NetBSD: platform_lp64.c,v 1.13 2024/03/30 16:47:45 rillig Exp $ */ # 3 "platform_lp64.c" /* @@ -54,52 +54,52 @@ void array_index(void) { - /* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */ + /* expect+1: warning: array subscript 16777215 cannot be > 19 [168] */ u8 += u8_buf[0x00ffffff]; - /* expect+1: warning: array subscript cannot be > 19: 2147483647 [168] */ + /* expect+1: warning: array subscript 2147483647 cannot be > 19 [168] */ u8 += u8_buf[0x7fffffff]; - /* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */ + /* expect+1: warning: array subscript 2147483648 cannot be > 19 [168] */ u8 += u8_buf[2147483648]; - /* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */ + /* expect+1: warning: array subscript 2147483648 cannot be > 19 [168] */ u8 += u8_buf[0x80000000]; - /* expect+1: warning: array subscript cannot be > 19: 4294967295 [168] */ + /* expect+1: warning: array subscript 4294967295 cannot be > 19 [168] */ u8 += u8_buf[0xffffffff]; - /* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */ + /* expect+1: warning: array subscript 2147483648 cannot be > 19 [168] */ u8 += u8_buf[0x80000000]; - /* expect+1: warning: array subscript cannot be > 19: 4294967295 [168] */ + /* expect+1: warning: array subscript 4294967295 cannot be > 19 [168] */ u8 += u8_buf[0xffffffff]; - /* expect+1: warning: array subscript cannot be > 19: 72057594037927935 [168] */ + /* expect+1: warning: array subscript 72057594037927935 cannot be > 19 [168] */ u8 += u8_buf[0x00ffffffffffffff]; - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u8 += u8_buf[0xffffffffffffffff]; - /* expect+1: warning: array subscript cannot be > 19: 16777215 [168] */ + /* expect+1: warning: array subscript 16777215 cannot be > 19 [168] */ u64 += u64_buf[0x00ffffff]; - /* expect+1: warning: array subscript cannot be > 19: 2147483647 [168] */ + /* expect+1: warning: array subscript 2147483647 cannot be > 19 [168] */ u64 += u64_buf[0x7fffffff]; - /* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */ + /* expect+1: warning: array subscript 2147483648 cannot be > 19 [168] */ u64 += u64_buf[2147483648]; - /* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */ + /* expect+1: warning: array subscript 2147483648 cannot be > 19 [168] */ u64 += u64_buf[0x80000000]; - /* expect+1: warning: array subscript cannot be > 19: 4294967295 [168] */ + /* expect+1: warning: array subscript 4294967295 cannot be > 19 [168] */ u64 += u64_buf[0xffffffff]; - /* expect+1: warning: array subscript cannot be > 19: 2147483648 [168] */ + /* expect+1: warning: array subscript 2147483648 cannot be > 19 [168] */ u64 += u64_buf[0x80000000]; - /* expect+1: warning: array subscript cannot be > 19: 4294967295 [168] */ + /* expect+1: warning: array subscript 4294967295 cannot be > 19 [168] */ u64 += u64_buf[0xffffffff]; - /* expect+1: warning: array subscript cannot be > 19: 72057594037927935 [168] */ + /* expect+1: warning: array subscript 72057594037927935 cannot be > 19 [168] */ u64 += u64_buf[0x00ffffffffffffff]; - /* expect+1: warning: array subscript cannot be > 19: 1152921504606846975 [168] */ + /* expect+1: warning: array subscript 1152921504606846975 cannot be > 19 [168] */ u64 += u64_buf[0x0fffffffffffffff]; /* expect+2: warning: '2305843009213693951 * 8' overflows 'long' [141] */ - /* expect+1: warning: array subscript cannot be > 19: 1152921504606846975 [168] */ + /* expect+1: warning: array subscript 1152921504606846975 cannot be > 19 [168] */ u64 += u64_buf[0x1fffffffffffffff]; /* expect+2: warning: '4611686018427387903 * 8' overflows 'long' [141] */ - /* expect+1: warning: array subscript cannot be > 19: 1152921504606846975 [168] */ + /* expect+1: warning: array subscript 1152921504606846975 cannot be > 19 [168] */ u64 += u64_buf[0x3fffffffffffffff]; /* expect+2: warning: '9223372036854775807 * 8' overflows 'long' [141] */ - /* expect+1: warning: array subscript cannot be > 19: 1152921504606846975 [168] */ + /* expect+1: warning: array subscript 1152921504606846975 cannot be > 19 [168] */ u64 += u64_buf[0x7fffffffffffffff]; - /* expect+1: warning: array subscript cannot be negative: -1 [167] */ + /* expect+1: warning: array subscript -1 cannot be negative [167] */ u64 += u64_buf[0xffffffffffffffff]; } diff --git a/usr.bin/xlint/lint1/err.c b/usr.bin/xlint/lint1/err.c index 3393a95d17d1..18683afd9c4a 100644 --- a/usr.bin/xlint/lint1/err.c +++ b/usr.bin/xlint/lint1/err.c @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.236 2024/03/29 07:35:45 rillig Exp $ */ +/* $NetBSD: err.c,v 1.237 2024/03/30 16:47:44 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: err.c,v 1.236 2024/03/29 07:35:45 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.237 2024/03/30 16:47:44 rillig Exp $"); #endif #include @@ -222,8 +222,8 @@ static const char *const msgs[] = { "assignment of negative constant to unsigned type", // 164 "constant truncated by assignment", // 165 "precision lost in bit-field assignment", // 166 - "array subscript cannot be negative: %jd", // 167 - "array subscript cannot be > %d: %jd", // 168 + "array subscript %jd cannot be negative", // 167 + "array subscript %jd cannot be > %d", // 168 "precedence confusion possible: parenthesize!", // 169 "first operand of '?' must have scalar type", // 170 "cannot assign to '%s' from '%s'", // 171 diff --git a/usr.bin/xlint/lint1/init.c b/usr.bin/xlint/lint1/init.c index 6117015cc7af..04736f56017c 100644 --- a/usr.bin/xlint/lint1/init.c +++ b/usr.bin/xlint/lint1/init.c @@ -1,4 +1,4 @@ -/* $NetBSD: init.c,v 1.266 2024/03/29 08:35:32 rillig Exp $ */ +/* $NetBSD: init.c,v 1.267 2024/03/30 16:47:44 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -38,7 +38,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: init.c,v 1.266 2024/03/29 08:35:32 rillig Exp $"); +__RCSID("$NetBSD: init.c,v 1.267 2024/03/30 16:47:44 rillig Exp $"); #endif #include @@ -801,8 +801,8 @@ initialization_add_designator_subscript(initialization *in, size_t subscript) } if (!tp->t_incomplete_array && subscript >= (size_t)tp->u.dimension) { - /* array subscript cannot be > %d: %jd */ - error(168, tp->u.dimension - 1, (intmax_t)subscript); + /* array subscript %jd cannot be > %d */ + error(168, (intmax_t)subscript, tp->u.dimension - 1); subscript = 0; /* suppress further errors */ } diff --git a/usr.bin/xlint/lint1/tree.c b/usr.bin/xlint/lint1/tree.c index 9de554dd06bc..d84dcba5fad1 100644 --- a/usr.bin/xlint/lint1/tree.c +++ b/usr.bin/xlint/lint1/tree.c @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.629 2024/03/29 08:35:32 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.630 2024/03/30 16:47:44 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.629 2024/03/29 08:35:32 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.630 2024/03/30 16:47:44 rillig Exp $"); #endif #include @@ -4435,11 +4435,11 @@ proceed:; int dim = arr->tn_type->u.dimension + (taking_address ? 1 : 0); if (!is_uinteger(idx->tn_type->t_tspec) && con < 0) - /* array subscript cannot be negative: %jd */ + /* array subscript %jd cannot be negative */ warning(167, (intmax_t)con); else if (dim > 0 && (uint64_t)con >= (uint64_t)dim) - /* array subscript cannot be > %d: %jd */ - warning(168, dim - 1, (intmax_t)con); + /* array subscript %jd cannot be > %d */ + warning(168, (uintmax_t)con, dim - 1); } static void