Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/share/misc share/misc/style: lint no longer needs CONSTCOND ...
details: https://anonhg.NetBSD.org/src/rev/ad74e2a9566f
branches: trunk
changeset: 363415:ad74e2a9566f
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Mar 10 23:39:12 2022 +0000
description:
share/misc/style: lint no longer needs CONSTCOND in do-while-loops
Since usr.bin/xlint/lint1/tree.c 1.202 from 2021-01-31, lint recognizes
the common idiom 'do { ... } while (0)' and no longer complains about
its constant condition; see tests/usr.bin/xlint/lint1/msg_161.c.
diffstat:
share/misc/style | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diffs (38 lines):
diff -r 989f98d7d797 -r ad74e2a9566f share/misc/style
--- a/share/misc/style Thu Mar 10 22:45:23 2022 +0000
+++ b/share/misc/style Thu Mar 10 23:39:12 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: style,v 1.63 2022/03/10 22:45:23 rillig Exp $ */
+/* $NetBSD: style,v 1.64 2022/03/10 23:39:12 rillig Exp $ */
/*
* The revision control tag appears first, with a blank line after it.
@@ -30,7 +30,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: style,v 1.63 2022/03/10 22:45:23 rillig Exp $");
+__RCSID("$NetBSD: style,v 1.64 2022/03/10 23:39:12 rillig Exp $");
/*
* VERY important single-line comments look like this.
@@ -135,15 +135,15 @@
* If they are an inline expansion of a function, the function is defined
* all in lowercase, the macro has the same name all in uppercase.
* If the macro is an expression, wrap the expression in parenthesis.
- * If the macro is more than a single statement, use ``do { ... } while (0)'',
- * so that a trailing semicolon works. Right-justify the backslashes; it
- * makes it easier to read. The CONSTCOND comment is to satisfy lint(1).
+ * If the macro is more than a single statement, use ``do { ... } while (0)''
+ * or ``do { ... } while (false)'', so that a trailing semicolon works.
+ * Right-justify the backslashes; it makes it easier to read.
*/
#define MACRO(v, w, x, y) \
do { \
v = (x) + (y); \
w = (y) + 2; \
-} while (/* CONSTCOND */ 0)
+} while (0)
#define DOUBLE(x) ((x) * 2)
Home |
Main Index |
Thread Index |
Old Index