Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/common lint: in the name of an array type, lis...



details:   https://anonhg.NetBSD.org/src/rev/1858d21a1ece
branches:  trunk
changeset: 1019347:1858d21a1ece
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 07 17:12:41 2021 +0000

description:
lint: in the name of an array type, list the dimension first

before: array of unsigned int[4]
now:    array[4] of unsigned int

Listing the array dimension first keeps it in contact with the keyword
'array'.  This reduces confusion, especially for nested arrays.

diffstat:

 tests/usr.bin/xlint/lint1/msg_035.exp |  2 +-
 usr.bin/xlint/common/tyname.c         |  8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diffs (48 lines):

diff -r f0ef6c004e1c -r 1858d21a1ece tests/usr.bin/xlint/lint1/msg_035.exp
--- a/tests/usr.bin/xlint/lint1/msg_035.exp     Sun Mar 07 16:40:20 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_035.exp     Sun Mar 07 17:12:41 2021 +0000
@@ -10,7 +10,7 @@
 msg_035.c(51): warning: illegal bit-field type 'struct typedef example_struct' [35]
 msg_035.c(52): warning: illegal bit-field type 'union typedef example_union' [35]
 msg_035.c(54): warning: illegal bit-field type 'pointer to void' [35]
-msg_035.c(55): warning: illegal bit-field type 'array of unsigned int[4]' [35]
+msg_035.c(55): warning: illegal bit-field type 'array[4] of unsigned int' [35]
 msg_035.c(56): warning: illegal bit-field type 'function(int, pointer to const char) returning void' [35]
 msg_035.c(57): invalid type for _Complex [308]
 msg_035.c(57): warning: illegal bit-field type 'double _Complex' [35]
diff -r f0ef6c004e1c -r 1858d21a1ece usr.bin/xlint/common/tyname.c
--- a/usr.bin/xlint/common/tyname.c     Sun Mar 07 16:40:20 2021 +0000
+++ b/usr.bin/xlint/common/tyname.c     Sun Mar 07 17:12:41 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tyname.c,v 1.33 2021/02/28 02:37:04 rillig Exp $       */
+/*     $NetBSD: tyname.c,v 1.34 2021/03/07 17:12:41 rillig Exp $       */
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.33 2021/02/28 02:37:04 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.34 2021/03/07 17:12:41 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -317,8 +317,6 @@
 static void
 type_name_of_array(buffer *buf, const type_t *tp)
 {
-       buf_add(buf, " of ");
-       buf_add(buf, type_name(tp->t_subt));
        buf_add(buf, "[");
 #ifdef t_str /* lint1 */
        if (tp->t_incomplete_array)
@@ -329,6 +327,8 @@
        buf_add_int(buf, tp->t_dim);
 #endif
        buf_add(buf, "]");
+       buf_add(buf, " of ");
+       buf_add(buf, type_name(tp->t_subt));
 }
 
 const char *



Home | Main Index | Thread Index | Old Index