Module Name:    src
Committed By:   rillig
Date:           Wed Jun 14 10:29:52 UTC 2023

Modified Files:
        src/tests/usr.bin/indent: lsym_preprocessing.c
        src/usr.bin/indent: indent.c

Log Message:
indent: use correct preprocessing directive in error message


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/indent/lsym_preprocessing.c
cvs rdiff -u -r1.360 -r1.361 src/usr.bin/indent/indent.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_preprocessing.c
diff -u src/tests/usr.bin/indent/lsym_preprocessing.c:1.11 src/tests/usr.bin/indent/lsym_preprocessing.c:1.12
--- src/tests/usr.bin/indent/lsym_preprocessing.c:1.11	Wed Jun 14 10:26:00 2023
+++ src/tests/usr.bin/indent/lsym_preprocessing.c	Wed Jun 14 10:29:52 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_preprocessing.c,v 1.11 2023/06/14 10:26:00 rillig Exp $ */
+/* $NetBSD: lsym_preprocessing.c,v 1.12 2023/06/14 10:29:52 rillig Exp $ */
 
 /*
  * Tests for the token lsym_preprocessing, which represents a '#' that starts
@@ -296,8 +296,7 @@ int before;
 //indent run
 error: Standard Input:1: Unmatched #else
 error: Standard Input:2: Unmatched #elif
-// $ TODO: '#elifdef' instead of '#elif'
-error: Standard Input:3: Unmatched #elif
+error: Standard Input:3: Unmatched #elifdef
 error: Standard Input:4: Unmatched #endif
 #else
 #elif 0

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.360 src/usr.bin/indent/indent.c:1.361
--- src/usr.bin/indent/indent.c:1.360	Wed Jun 14 10:26:00 2023
+++ src/usr.bin/indent/indent.c	Wed Jun 14 10:29:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.360 2023/06/14 10:26:00 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.361 2023/06/14 10:29:52 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: indent.c,v 1.360 2023/06/14 10:26:00 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.361 2023/06/14 10:29:52 rillig Exp $");
 
 #include <sys/param.h>
 #include <err.h>
@@ -469,8 +469,7 @@ process_preprocessing(void)
 
 	} else if (dir_len >= 2 && memcmp(dir, "el", 2) == 0) {
 		if (ifdef.len == 0)
-			diag(1, dir[2] == 'i'
-			    ? "Unmatched #elif" : "Unmatched #else");
+			diag(1, "Unmatched #%.*s", (int)dir_len, dir);
 		else
 			ps = ifdef.item[ifdef.len - 1];
 

Reply via email to