public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] build: Avoid length() GNU awk extension
@ 2022-03-09  7:31 Sebastian Huber
  2022-03-09  8:26 ` Corinna Vinschen
  2022-03-09  8:54 ` Mike Frysinger
  0 siblings, 2 replies; 6+ messages in thread
From: Sebastian Huber @ 2022-03-09  7:31 UTC (permalink / raw)
  To: newlib

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-09 10:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09  7:31 [PATCH] build: Avoid length() GNU awk extension Sebastian Huber
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

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).