Skip to content

Commit 0343acb

Browse files
committed
portability: don't use strtof
It is not available on HP-UX 11i. Reported by Larkin Nickle <[email protected]>. <https://lists.gnu.org/r/bug-bison/2021-09/msg00012.html> Gnulib provides no replacement, but anyway we should be using doubles, since difftime uses doubles. * bootstrap.conf: We want portability on stdtod. * src/counterexample.c: Use double, not float, for time measurements.
1 parent 5d9ccd5 commit 0343acb

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

bootstrap.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ gnulib_modules='
4545
realloc-posix
4646
relocatable-prog relocatable-script
4747
rename
48-
spawn-pipe stdbool stpcpy stpncpy strdup-posix strerror strverscmp
48+
spawn-pipe stdbool stpcpy stpncpy strdup-posix strerror strtod strverscmp
4949
sys_ioctl
5050
termios
5151
timevar

lib/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@
391391
/stripslash.c
392392
/strndup.c
393393
/strnlen.c
394+
/strtod.c
394395
/strverscmp.c
395396
/sys
396397
/sys_ioctl.in.h

m4/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@
216216
/strings_h.m4
217217
/strndup.m4
218218
/strnlen.m4
219+
/strtod.m4
219220
/strverscmp.m4
220221
/sys_ioctl_h.m4
221222
/sys_resource_h.m4

src/counterexample.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@
5757

5858
/** The time limit before printing an assurance message to the user to
5959
* indicate that the search is still running. */
60-
#define ASSURANCE_LIMIT 2.0f
60+
#define ASSURANCE_LIMIT 2.0
6161

6262
/* The time limit before giving up looking for unifying counterexample. */
63-
static float time_limit = 5.0f;
63+
static double time_limit = 5.0;
6464

65-
#define CUMULATIVE_TIME_LIMIT 120.0f
65+
#define CUMULATIVE_TIME_LIMIT 120.0
6666

6767
// This is the fastest way to get the tail node from the gl_list API.
6868
static gl_list_node_t
@@ -1164,7 +1164,7 @@ unifying_example (state_item_number itm1,
11641164
}
11651165
if (TIME_LIMIT_ENFORCED)
11661166
{
1167-
float time_passed = difftime (time (NULL), start);
1167+
double time_passed = difftime (time (NULL), start);
11681168
if (!assurance_printed && time_passed > ASSURANCE_LIMIT
11691169
&& stage3result)
11701170
{
@@ -1218,7 +1218,7 @@ counterexample_init (void)
12181218
if (cp)
12191219
{
12201220
char *end = NULL;
1221-
float v = strtof (cp, &end);
1221+
double v = strtod (cp, &end);
12221222
if (*end == '\0' && errno == 0)
12231223
time_limit = v;
12241224
}

0 commit comments

Comments
 (0)