bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* regex.c needs ULONG_WIDTH, not in standard limits.h
@ 2020-01-24  7:46 Arnold Robbins
  2020-01-24  8:34 ` Paul Eggert
  0 siblings, 1 reply; 3+ messages in thread
From: Arnold Robbins @ 2020-01-24  7:46 UTC (permalink / raw)
  To: bug-gnulib

Hi.

I just pulled a new copy of regex.c and tried to drop it into gawk. It
fails with ULONG_WIDTH undeclared.

It seems to be in Gnulib's limits.h replacement, but I'm not using that,
I rely on the standard limits.h.

Can this be fixed, or the change that uses it be reverted, please?

Thanks,

Arnold


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

* Re: regex.c needs ULONG_WIDTH, not in standard limits.h
  2020-01-24  7:46 regex.c needs ULONG_WIDTH, not in standard limits.h Arnold Robbins
@ 2020-01-24  8:34 ` Paul Eggert
  2020-01-24  8:47   ` arnold
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggert @ 2020-01-24  8:34 UTC (permalink / raw)
  To: Arnold Robbins; +Cc: bug-gnulib

[-- Attachment #1: Type: text/plain, Size: 255 bytes --]

Actually ULONG_WIDTH is part of C standard limits.h. However, not every platform 
conforms to the current standard. The Gnulib stdlib-h module works around this 
portability issue, but unfortunately Awk is not using stdlib-h so I installed 
the attached.

[-- Attachment #2: 0001-regex-port-to-Gawk-on-nonstandard-platforms.patch --]
[-- Type: text/x-patch, Size: 1590 bytes --]

From 07546bc557de0304154227aa709b581b1a4a19d4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri, 24 Jan 2020 00:32:32 -0800
Subject: [PATCH] regex: port to Gawk on nonstandard platforms

* lib/regex_internal.h (ULONG_WIDTH): Define if not already defined.
This is useful for Gawk, which does not use the Gnulib stdlib-h
module.  Problem reported by Arnold Robbins in:
https://lists.gnu.org/r/bug-gnulib/2020-01/msg00138.html
---
 ChangeLog            | 8 ++++++++
 lib/regex_internal.h | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 2336126b0..3b4d32dc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+	regex: port to Gawk on nonstandard platforms
+	* lib/regex_internal.h (ULONG_WIDTH): Define if not already defined.
+	This is useful for Gawk, which does not use the Gnulib stdlib-h
+	module.  Problem reported by Arnold Robbins in:
+	https://lists.gnu.org/r/bug-gnulib/2020-01/msg00138.html
+
 2020-01-21  Paul Eggert  <eggert@cs.ucla.edu>
 
 	regex: fix bug with >=16 subexpressions
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 13e15e21e..6d436fde1 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -141,6 +141,9 @@
 #ifndef SSIZE_MAX
 # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
 #endif
+#ifndef ULONG_WIDTH
+# define ULONG_WIDTH (CHAR_BIT * sizeof (unsigned long int))
+#endif
 
 /* The type of indexes into strings.  This is signed, not size_t,
    since the API requires indexes to fit in regoff_t anyway, and using
-- 
2.17.1


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

* Re: regex.c needs ULONG_WIDTH, not in standard limits.h
  2020-01-24  8:34 ` Paul Eggert
@ 2020-01-24  8:47   ` arnold
  0 siblings, 0 replies; 3+ messages in thread
From: arnold @ 2020-01-24  8:47 UTC (permalink / raw)
  To: eggert, arnold; +Cc: bug-gnulib

Paul Eggert <eggert@cs.ucla.edu> wrote:

> Actually ULONG_WIDTH is part of C standard limits.h. However, not every
> platform conforms to the current standard. The Gnulib stdlib-h module
> works around this portability issue, but unfortunately Awk is not using
> stdlib-h so I installed the attached.

THANK YOU for the quick turnaround time on the fix.  I appreciate it.

Arnold


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

end of thread, other threads:[~2020-01-24  8:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-24  7:46 regex.c needs ULONG_WIDTH, not in standard limits.h Arnold Robbins
2020-01-24  8:34 ` Paul Eggert
2020-01-24  8:47   ` arnold

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