public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: newlib@sourceware.org
Subject: [PATCH] build: Avoid length() GNU awk extension
Date: Wed,  9 Mar 2022 08:31:05 +0100	[thread overview]
Message-ID: <20220309073105.129187-1-sebastian.huber@embedded-brains.de> (raw)

Other awk implementations such as mawk do not support the length() function.
---
 newlib/Makefile.am | 4 ++--
 newlib/Makefile.in | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/newlib/Makefile.am b/newlib/Makefile.am
index ba0a3822f..81719660c 100644
--- a/newlib/Makefile.am
+++ b/newlib/Makefile.am
@@ -93,8 +93,8 @@ CLEANFILES += libg.a
 ## https://sourceware.org/PR28917
 AWK_UNIQUE_OBJS = $(AWK) '{ \
   for (i = NF; i > 0; --i) { \
-    split($$i, parts, "/"); \
-    name = parts[length(parts)]; \
+    count = split($$i, parts, "/"); \
+    name = parts[count]; \
     if (!(name in seen)) { \
       objs[i] = $$i; \
       seen[name] = 1; \
diff --git a/newlib/Makefile.in b/newlib/Makefile.in
index e0deacb61..7de777879 100644
--- a/newlib/Makefile.in
+++ b/newlib/Makefile.in
@@ -1380,8 +1380,8 @@ toollib_LIBRARIES = libm.a \
 toollib_DATA = $(CRT0) $(CRT1)
 AWK_UNIQUE_OBJS = $(AWK) '{ \
   for (i = NF; i > 0; --i) { \
-    split($$i, parts, "/"); \
-    name = parts[length(parts)]; \
+    count = split($$i, parts, "/"); \
+    name = parts[count]; \
     if (!(name in seen)) { \
       objs[i] = $$i; \
       seen[name] = 1; \
-- 
2.34.1


             reply	other threads:[~2022-03-09  7:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-09  7:31 Sebastian Huber [this message]
2022-03-09  8:26 ` Corinna Vinschen
2022-03-09  8:54 ` Mike Frysinger
2022-03-09  9:02   ` Sebastian Huber
2022-03-09  9:10   ` Mike Frysinger
2022-03-09 10:03     ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220309073105.129187-1-sebastian.huber@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).