Module Name:    src
Committed By:   rillig
Date:           Sun Jun 25 19:29:57 UTC 2023

Modified Files:
        src/tests/usr.bin/indent: lsym_storage_class.c
        src/usr.bin/indent: lexi.c

Log Message:
indent: treat 'complex' and 'imaginary' as type modifiers, not as types


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/lsym_storage_class.c
cvs rdiff -u -r1.234 -r1.235 src/usr.bin/indent/lexi.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/indent/lsym_storage_class.c
diff -u src/tests/usr.bin/indent/lsym_storage_class.c:1.5 src/tests/usr.bin/indent/lsym_storage_class.c:1.6
--- src/tests/usr.bin/indent/lsym_storage_class.c:1.5	Sun Jun  4 11:45:00 2023
+++ src/tests/usr.bin/indent/lsym_storage_class.c	Sun Jun 25 19:29:57 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_storage_class.c,v 1.5 2023/06/04 11:45:00 rillig Exp $ */
+/* $NetBSD: lsym_storage_class.c,v 1.6 2023/06/25 19:29:57 rillig Exp $ */
 
 /*
  * Tests for the token lsym_modifier (formerly named lsym_storage_class), which
@@ -7,9 +7,16 @@
  */
 
 //indent input
-static int definition_with_internal_linkage;
-extern int declaration_with_external_linkage;
-int definition_with_external_linkage;
+static int	definition_with_internal_linkage;
+extern int	declaration_with_external_linkage;
+int		definition_with_external_linkage;
+_Complex double	cd;
+_Imaginary double id;
+complex double	cd;
+imaginary double id;
+// The token after a modifier (in this case 'dc') is always interpreted as a
+// type name, therefore it is not indented by 16 but by a single space.
+double complex dc;
 //indent end
 
-//indent run-equals-input -di0
+//indent run-equals-input

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.234 src/usr.bin/indent/lexi.c:1.235
--- src/usr.bin/indent/lexi.c:1.234	Sun Jun 25 19:19:42 2023
+++ src/usr.bin/indent/lexi.c	Sun Jun 25 19:29:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.234 2023/06/25 19:19:42 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.235 2023/06/25 19:29:57 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: lexi.c,v 1.234 2023/06/25 19:19:42 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.235 2023/06/25 19:29:57 rillig Exp $");
 
 #include <stdlib.h>
 #include <string.h>
@@ -51,14 +51,14 @@ static const struct keyword {
 	lexer_symbol lsym;
 } keywords[] = {
 	{"_Bool", lsym_type},
-	{"_Complex", lsym_type},
-	{"_Imaginary", lsym_type},
+	{"_Complex", lsym_modifier},
+	{"_Imaginary", lsym_modifier},
 	{"auto", lsym_modifier},
 	{"bool", lsym_type},
 	{"break", lsym_word},
 	{"case", lsym_case},
 	{"char", lsym_type},
-	{"complex", lsym_type},
+	{"complex", lsym_modifier},
 	{"const", lsym_modifier},
 	{"continue", lsym_word},
 	{"default", lsym_default},
@@ -71,7 +71,7 @@ static const struct keyword {
 	{"for", lsym_for},
 	{"goto", lsym_word},
 	{"if", lsym_if},
-	{"imaginary", lsym_type},
+	{"imaginary", lsym_modifier},
 	{"inline", lsym_modifier},
 	{"int", lsym_type},
 	{"long", lsym_type},

Reply via email to