Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint1 lint: document an assumption that has tu...



details:   https://anonhg.NetBSD.org/src/rev/a91a51c8af74
branches:  trunk
changeset: 959621:a91a51c8af74
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Feb 20 17:12:00 2021 +0000

description:
lint: document an assumption that has turned wrong with C99

diffstat:

 usr.bin/xlint/lint1/init.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r a83594e74830 -r a91a51c8af74 usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c        Sat Feb 20 16:55:32 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c        Sat Feb 20 17:12:00 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.70 2021/02/20 16:34:57 rillig Exp $ */
+/*     $NetBSD: init.c,v 1.71 2021/02/20 17:12:00 rillig Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.70 2021/02/20 16:34:57 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.71 2021/02/20 17:12:00 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -172,7 +172,7 @@
        namlist_t *nam = xcalloc(1, sizeof (namlist_t));
        nam->n_name = sb->sb_name;
 
-       debug_step("%s: %s %p", __func__, nam->n_name, nam);
+       debug_step("%s: '%s' %p", __func__, nam->n_name, nam);
 
        if (namedmem == NULL) {
                /*
@@ -567,7 +567,14 @@
                error(181);
        }
 
-       /* Make sure an entry with a scalar type is at the top of the stack. */
+       /*
+        * Make sure an entry with a scalar type is at the top of the stack.
+        *
+        * FIXME: Since C99 an initializer for an object with automatic
+        *  storage need not be a constant expression anymore.  It is
+        *  perfectly fine to initialize a struct with a struct expression,
+        *  see d_struct_init_nested.c for a demonstration.
+        */
        if (!initerr)
                initstack_check_too_many();
        while (!initerr) {



Home | Main Index | Thread Index | Old Index