Re: [PATCH] build: Avoid length() GNU awk extension

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Mar  9 08:31, Sebastian Huber wrote:
> 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

LGTM

Thanks,
Corinna
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.