From patchwork Tue Dec 30 09:50:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 424601 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C363E1400DD for ; Tue, 30 Dec 2014 20:59:55 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:resent-from:resent-date:resent-message-id :resent-to:date:from:to:cc:subject:message-id:mime-version :content-type; q=dns; s=default; b=LR/K3RFJIMaI3yMDM7hxcVnXQJFgd i9kEe03+d4WpbYlJD03lNPqo4tmRfStof+Uk2iTOMbllxQV1992w4kxouYTlu8Lb PMUtsg03Y6dAkSO04r27DzqCYGOBbT2gmhqXcHdHgF6/Cl64KOHrcutY+068GFbd 1NpybkZGvu759Y= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:resent-from:resent-date:resent-message-id :resent-to:date:from:to:cc:subject:message-id:mime-version :content-type; s=default; bh=ZWX33+VEW5qM4T04WdqtM32o2Qw=; b=Vvs DJ29dBlKxn0Qmy/rp1p/xdfTFwXf/xirR9h8yza4emhdWWDDR1wLQGFK03Y8v9H4 IV1jUqReDl6bQKNEP25HuONLy6ijDi6+87O9w1B4dA+G5H+hMCWhLXN4Yuq884lK RRP0J2lWXtw/q0+kAtdlHIcM7QkZd1/rH6ashQPk= Received: (qmail 28240 invoked by alias); 30 Dec 2014 09:59:47 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 28231 invoked by uid 89); 30 Dec 2014 09:59:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.9 required=5.0 tests=AWL, BAYES_00, NO_DNS_FOR_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 X-HELO: homiemail-a56.g.dreamhost.com Resent-From: Siddhesh Poyarekar Resent-Date: Tue, 30 Dec 2014 15:25:17 +0530 Resent-Message-ID: <20141230095517.GA14654@Devel.siddhesh.in> Resent-To: libc-alpha@sourceware.org Date: Tue, 30 Dec 2014 15:20:50 +0530 From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Cc: Chris Metcalf Subject: [PATCH] Use one-dimension arrays in gen-posix-conf-vars.awk Message-ID: <20141230095050.GA22064@Devel.siddhesh.in> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) True multi-dimensional arrays were introduced in awk 4.0 and we support awk versions as early as 3.12. Use a single subscript of the form prefix_conf instead of two dimensions to work around this limitation. We also need one additional array of just the conf names subscripted by the prefix_conf to print the names for the specifications. Siddhesh * scripts/gen-posix-conf-vars.awk: Don't use multi-dimensional arrays. --- scripts/gen-posix-conf-vars.awk | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/scripts/gen-posix-conf-vars.awk b/scripts/gen-posix-conf-vars.awk index 007cd74..9630b56 100644 --- a/scripts/gen-posix-conf-vars.awk +++ b/scripts/gen-posix-conf-vars.awk @@ -42,36 +42,36 @@ $1 == "}" { # CONFSTR: A configuration string # SYSCONF: A numeric value # SPEC: A specification - sc_prefixes[prefix][$1] = sc_prefix - conf[prefix][$1] = type + c = sprintf("%s_%s", prefix, $1) + sc_prefixes[c] = sc_prefix + prefix_conf[c] = type + conf[c] = $1 } END { print "/* AUTOGENERATED by gen-posix-conf-vars.awk. DO NOT EDIT. */\n" # Generate macros that specify if a sysconf macro is defined and/or set. - for (p in conf) { - for (c in conf[p]) { - printf "#ifndef _%s_%s\n", p, c - printf "# define CONF_DEF_%s_%s CONF_DEF_UNDEFINED\n", p, c - # CONFSTR have string values and they are not set or unset. - if (conf[p][c] != "CONFSTR") { - printf "#else\n" - printf "# if _%s_%s > 0\n", p, c - printf "# define CONF_DEF_%s_%s CONF_DEF_DEFINED_SET\n", p, c - printf "# else\n" - printf "# define CONF_DEF_%s_%s CONF_DEF_DEFINED_UNSET\n", p, c - printf "# endif\n" - } - printf "#endif\n\n" + for (c in prefix_conf) { + printf "#ifndef _%s\n", c + printf "# define CONF_DEF_%s CONF_DEF_UNDEFINED\n", c + # CONFSTR have string values and they are not set or unset. + if (prefix_conf[c] != "CONFSTR") { + printf "#else\n" + printf "# if _%s > 0\n", c + printf "# define CONF_DEF_%s CONF_DEF_DEFINED_SET\n", c + printf "# else\n" + printf "# define CONF_DEF_%s CONF_DEF_DEFINED_UNSET\n", c + printf "# endif\n" + } + printf "#endif\n\n" - # Build a name -> sysconf number associative array to print a C array at - # the end. - if (conf[p][c] == "SPEC") { - name = sprintf ("%s_%s", p, c) - num = sprintf ("%s_%s", sc_prefixes[p][c], c) - spec[name] = num - } + # Build a name -> sysconf number associative array to print a C array at + # the end. + if (prefix_conf[c] == "SPEC") { + name = sprintf ("%s", c) + num = sprintf ("%s_%s", sc_prefixes[c], conf[c]) + spec[name] = num } }