Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make Fix build; gcc does not like VLA's, so hard cod...



details:   https://anonhg.NetBSD.org/src/rev/9808afd579a1
branches:  trunk
changeset: 936923:9808afd579a1
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Aug 09 02:53:21 2020 +0000

description:
Fix build; gcc does not like VLA's, so hard code the boundary
Use c99 initializers

diffstat:

 usr.bin/make/enum.h |   6 ++++--
 usr.bin/make/var.c  |  32 +++++++++++++++++++++-----------
 2 files changed, 25 insertions(+), 13 deletions(-)

diffs (108 lines):

diff -r 492d473f53fa -r 9808afd579a1 usr.bin/make/enum.h
--- a/usr.bin/make/enum.h       Sun Aug 09 02:49:38 2020 +0000
+++ b/usr.bin/make/enum.h       Sun Aug 09 02:53:21 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: enum.h,v 1.2 2020/08/08 14:43:28 rillig Exp $  */
+/*     $NetBSD: enum.h,v 1.3 2020/08/09 02:53:21 christos Exp $        */
 
 /*
  Copyright (c) 2020 Roland Illig <rillig%NetBSD.org@localhost>
@@ -59,8 +59,10 @@
        #v1 ENUM__SEP ENUM__JOIN_6(v2, v3, v4, v5, v6, v7)
 
 #define ENUM__RTTI(typnam, specs, joined) \
-       static const EnumToStringSpec typnam ## _ ## ToStringSpecs[] = specs; \
+       static const EnumToStringSpec typnam ## _ ## ToStringSpecs[] = specs; 
+#if 0
        static const size_t typnam ## _ ## ToStringSize = sizeof joined
+#endif
 
 #define ENUM__SPEC(v) { v, #v }
 
diff -r 492d473f53fa -r 9808afd579a1 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Aug 09 02:49:38 2020 +0000
+++ b/usr.bin/make/var.c        Sun Aug 09 02:53:21 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.434 2020/08/08 19:13:39 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.435 2020/08/09 02:53:21 christos Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.434 2020/08/08 19:13:39 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.435 2020/08/09 02:53:21 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.434 2020/08/08 19:13:39 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.435 2020/08/09 02:53:21 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2979,6 +2979,7 @@
 #endif
 
 /* Apply any modifiers (such as :Mpattern or :@var@loop@ or :Q or ::=value). */
+
 static char *
 ApplyModifiers(
     const char **pp,           /* the parsing position, updated upon return */
@@ -2991,9 +2992,18 @@
     void ** const freePtr      /* free this after using the return value */
 ) {
     ApplyModifiersState st = {
-       startc, endc, v, ctxt, eflags,
-       val, NULL, '\0', ' ', FALSE
-    };
+       .startc = startc,
+       .endc = endc,
+       .v = v,
+       .ctxt = ctxt,
+       .eflags = eflags,
+       .val = val,
+       .newVal = NULL,
+       .missing_delim = '\0',
+       .sep = ' ',
+       .oneBigWord = FALSE
+    }
+    ;
     const char *p;
     const char *mod;
     ApplyModifierResult res;
@@ -3054,8 +3064,8 @@
        mod = p;
 
        if (DEBUG(VAR)) {
-           char vflags_str[VarFlags_ToStringSize];
-           char eflags_str[VarEvalFlags_ToStringSize];
+           char vflags_str[2048];
+           char eflags_str[2048];
            Boolean is_single_char = mod[0] != '\0' &&
                (mod[1] == endc || mod[1] == ':');
 
@@ -3201,8 +3211,8 @@
            goto bad_modifier;
 
        if (DEBUG(VAR)) {
-           char eflags_str[VarEvalFlags_ToStringSize];
-           char vflags_str[VarFlags_ToStringSize];
+           char eflags_str[2048];
+           char vflags_str[2048];
            const char *q = st.newVal == var_Error ? "" : "\"";
            const char *newVal = st.newVal == var_Error ? "error" : st.newVal;
 
@@ -3338,7 +3348,7 @@
     const char *extramodifiers;
     Var *v;
     char *nstr;
-    char eflags_str[VarEvalFlags_ToStringSize];
+    char eflags_str[2048];
 
     VAR_DEBUG("%s: %s with %s\n", __func__, str,
              Enum_ToString(eflags_str, sizeof eflags_str, eflags,



Home | Main Index | Thread Index | Old Index