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/d5118a9fe5e3
branches:  trunk
changeset: 952884:d5118a9fe5e3
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 24c52baa76e8 -r d5118a9fe5e3 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