Module Name: src
Committed By: rillig
Date: Sun Mar 7 17:12:42 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_035.exp
src/usr.bin/xlint/common: tyname.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_035.exp
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/xlint/common/tyname.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/xlint/lint1/msg_035.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_035.exp:1.8 src/tests/usr.bin/xlint/lint1/msg_035.exp:1.9
--- src/tests/usr.bin/xlint/lint1/msg_035.exp:1.8 Sun Feb 28 02:45:37 2021
+++ src/tests/usr.bin/xlint/lint1/msg_035.exp Sun Mar 7 17:12:42 2021
@@ -10,7 +10,7 @@ msg_035.c(50): zero size bit-field [37]
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]
Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.33 src/usr.bin/xlint/common/tyname.c:1.34
--- src/usr.bin/xlint/common/tyname.c:1.33 Sun Feb 28 02:37:04 2021
+++ src/usr.bin/xlint/common/tyname.c Sun Mar 7 17:12:41 2021
@@ -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 @@ type_name_of_enum(buffer *buf, const typ
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 @@ type_name_of_array(buffer *buf, const ty
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 *