diff options
author | Paul Smith <psmith@gnu.org> | 2021-11-28 09:50:10 -0500 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2021-11-28 14:27:10 -0500 |
commit | 116767901f9fc22f837f2830dbd42ad57d70fcb1 (patch) | |
tree | 3e91c2650200daa969ed6db87e74af2a3472cd31 /tests/run_make_tests.pl | |
parent | 71eb0a80384617b553546228648f1f1926f43977 (diff) | |
download | make-git-116767901f9fc22f837f2830dbd42ad57d70fcb1.tar.gz |
Convert word, wordlist, and intcmp functions to use long long
Modify make functions that parse integer values to use long long
values instead of long: on Windows long is the same as int (4 bytes)
and we don't want behavior to differ between different platforms.
* bootstrap.conf: Change strtol module to strtoll module.
* src/function.c (parse_numeric): Use strtoll() and return long long.
(func_word): Use long long.
(func_wordlist): Use long long. Verify second argument is >= 0.
(func_intcmp): Use long long.
* src/config.ami.template: Don't define HAVE_STRTOLL.
* src/config-vms.template: Define HAVE_STRTOLL.
* src/config.W32.template: Define HAVE_STRTOLL.
* tests/run_make_tests.pl: Set $ERR_out_of_range to the proper string.
* tests/scripts/functions/word: Rework to use the new style and avoid
TAB characters. Verify trailing whitespace is ignored. Add a test
for a negative second argument to wordlist. Add tests for max signed
integer values. Use $ERR_out_of_range for the error string.
* tests/scripts/functions/intcmp: Add tests for min and max signed
integer values. Use $ERR_out_of_range for the error string.
Diffstat (limited to 'tests/run_make_tests.pl')
-rw-r--r-- | tests/run_make_tests.pl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl index cc46af1f..ebf202a2 100644 --- a/tests/run_make_tests.pl +++ b/tests/run_make_tests.pl @@ -108,6 +108,7 @@ $ERR_read_only_file = undef; $ERR_unreadable_file = undef; $ERR_nonexe_file = undef; $ERR_exe_dir = undef; +$ERR_out_of_range = undef; { use locale; @@ -118,6 +119,12 @@ $ERR_exe_dir = undef; # Windows has POSIX locale, but only LC_ALL not LC_MESSAGES $loc = POSIX::setlocale(&POSIX::LC_ALL); POSIX::setlocale(&POSIX::LC_ALL, 'C'); + + # See set_defaults() as this doesn't work right on Windows :( + $! = &POSIX::ERANGE; + $ERR_out_of_range = "$!"; + } else { + $ERR_out_of_range = 'Numerical result out of range'; } if (open(my $F, '<', 'file.none')) { @@ -457,6 +464,10 @@ sub set_defaults $scriptsuffix = '.com'; } else { $scriptsuffix = '.bat'; + + # Frustratingly, Perl reports the wrong strerror string for ERANGE. + # It's weird because Python gets it right. Not sure what's going on. + $ERR_out_of_range = 'Result too large'; } } |