git: a970610a3af6 - main - contrib/bc: upgrade to version 6.7.6
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 09 Jul 2024 05:52:22 UTC
The branch main has been updated by se:
URL: https://cgit.FreeBSD.org/src/commit/?id=a970610a3af63b3f4df5b69d91c6b4093a00ed8f
commit a970610a3af63b3f4df5b69d91c6b4093a00ed8f
Author: Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2024-07-09 05:49:27 +0000
Commit: Stefan Eßer <se@FreeBSD.org>
CommitDate: 2024-07-09 05:49:27 +0000
contrib/bc: upgrade to version 6.7.6
This update fixes a potential issue when flushing stdout on exit
fails: longjmp could use an uninitialized target address variable.
Most files are included in this commit due to a changed date in
the copyright note.
(cherry picked from commit 52a5ec1b178fd07651446c7e31b1512794a04dbf)
MFC after: 3 days
---
contrib/bc/LICENSE.md | 4 +-
contrib/bc/MEMORY_BUGS.md | 7 +
contrib/bc/Makefile.in | 2 +-
contrib/bc/NEWS.md | 7 +
contrib/bc/NOTICE.md | 2 +-
contrib/bc/README.md | 6 +-
contrib/bc/compile_flags.txt | 15 +
contrib/bc/configure.sh | 20 +-
contrib/bc/gen/bc_help.txt | 2 +-
contrib/bc/gen/dc_help.txt | 2 +-
contrib/bc/gen/lib.bc | 2 +-
contrib/bc/gen/lib2.bc | 2 +-
contrib/bc/gen/strgen.c | 4 +-
contrib/bc/gen/strgen.sh | 4 +-
contrib/bc/include/args.h | 2 +-
contrib/bc/include/bc.h | 21 +-
contrib/bc/include/bcl.h | 2 +-
contrib/bc/include/dc.h | 5 +-
contrib/bc/include/file.h | 26 +-
contrib/bc/include/history.h | 2 +-
contrib/bc/include/lang.h | 2 +-
contrib/bc/include/lex.h | 2 +-
contrib/bc/include/library.h | 2 +-
contrib/bc/include/num.h | 2 +-
contrib/bc/include/opt.h | 2 +-
contrib/bc/include/parse.h | 2 +-
contrib/bc/include/program.h | 2 +-
contrib/bc/include/rand.h | 7 +-
contrib/bc/include/read.h | 2 +-
contrib/bc/include/status.h | 6 +-
contrib/bc/include/vector.h | 2 +-
contrib/bc/include/version.h | 4 +-
contrib/bc/include/vm.h | 12 +-
contrib/bc/locales/de_DE.ISO8859-1.msg | 2 +-
contrib/bc/locales/de_DE.UTF-8.msg | 2 +-
contrib/bc/locales/en_US.msg | 2 +-
contrib/bc/locales/es_ES.ISO8859-1.msg | 2 +-
contrib/bc/locales/es_ES.UTF-8.msg | 2 +-
contrib/bc/locales/fr_FR.ISO8859-1.msg | 2 +-
contrib/bc/locales/fr_FR.UTF-8.msg | 2 +-
contrib/bc/locales/ja_JP.UTF-8.msg | 2 +-
contrib/bc/locales/ja_JP.eucJP.msg | 2 +-
contrib/bc/locales/nl_NL.ISO8859-1.msg | 2 +-
contrib/bc/locales/nl_NL.UTF-8.msg | 2 +-
contrib/bc/locales/pl_PL.ISO8859-2.msg | 2 +-
contrib/bc/locales/pl_PL.UTF-8.msg | 2 +-
contrib/bc/locales/pt_PT.ISO8859-1.msg | 2 +-
contrib/bc/locales/pt_PT.UTF-8.msg | 2 +-
contrib/bc/locales/ru_RU.CP1251.msg | 2 +-
contrib/bc/locales/ru_RU.CP866.msg | 2 +-
contrib/bc/locales/ru_RU.ISO8859-5.msg | 2 +-
contrib/bc/locales/ru_RU.KOI8-R.msg | 2 +-
contrib/bc/locales/ru_RU.UTF-8.msg | 2 +-
contrib/bc/locales/zh_CN.GB18030.msg | 2 +-
contrib/bc/locales/zh_CN.GB2312.msg | 2 +-
contrib/bc/locales/zh_CN.GBK.msg | 2 +-
contrib/bc/locales/zh_CN.UTF-8.msg | 2 +-
contrib/bc/locales/zh_CN.eucCN.msg | 2 +-
contrib/bc/manuals/bc/A.1 | 681 +++++++++++++++++----------------
contrib/bc/manuals/bc/A.1.md | 5 +-
contrib/bc/manuals/bc/E.1 | 482 +++++++++++------------
contrib/bc/manuals/bc/E.1.md | 5 +-
contrib/bc/manuals/bc/EH.1 | 474 ++++++++++++-----------
contrib/bc/manuals/bc/EH.1.md | 5 +-
contrib/bc/manuals/bc/EHN.1 | 474 ++++++++++++-----------
contrib/bc/manuals/bc/EHN.1.md | 5 +-
contrib/bc/manuals/bc/EN.1 | 482 +++++++++++------------
contrib/bc/manuals/bc/EN.1.md | 5 +-
contrib/bc/manuals/bc/H.1 | 673 ++++++++++++++++----------------
contrib/bc/manuals/bc/H.1.md | 5 +-
contrib/bc/manuals/bc/HN.1 | 673 ++++++++++++++++----------------
contrib/bc/manuals/bc/HN.1.md | 5 +-
contrib/bc/manuals/bc/N.1 | 681 +++++++++++++++++----------------
contrib/bc/manuals/bc/N.1.md | 5 +-
contrib/bc/manuals/bcl.3 | 95 ++---
contrib/bc/manuals/bcl.3.md | 2 +-
contrib/bc/manuals/dc/A.1 | 478 +++++++++++------------
contrib/bc/manuals/dc/A.1.md | 2 +-
contrib/bc/manuals/dc/E.1 | 376 +++++++++---------
contrib/bc/manuals/dc/E.1.md | 2 +-
contrib/bc/manuals/dc/EH.1 | 368 +++++++++---------
contrib/bc/manuals/dc/EH.1.md | 2 +-
contrib/bc/manuals/dc/EHN.1 | 368 +++++++++---------
contrib/bc/manuals/dc/EHN.1.md | 2 +-
contrib/bc/manuals/dc/EN.1 | 376 +++++++++---------
contrib/bc/manuals/dc/EN.1.md | 2 +-
contrib/bc/manuals/dc/H.1 | 470 ++++++++++++-----------
contrib/bc/manuals/dc/H.1.md | 2 +-
contrib/bc/manuals/dc/HN.1 | 470 ++++++++++++-----------
contrib/bc/manuals/dc/HN.1.md | 2 +-
contrib/bc/manuals/dc/N.1 | 478 +++++++++++------------
contrib/bc/manuals/dc/N.1.md | 2 +-
contrib/bc/scripts/exec-install.sh | 2 +-
contrib/bc/scripts/format.sh | 2 +-
contrib/bc/scripts/functions.sh | 2 +-
contrib/bc/scripts/karatsuba.py | 2 +-
contrib/bc/scripts/link.sh | 2 +-
contrib/bc/scripts/lint.sh | 2 +-
contrib/bc/scripts/locale_install.sh | 2 +-
contrib/bc/scripts/locale_uninstall.sh | 2 +-
contrib/bc/scripts/sqrt_frac_guess.bc | 2 +-
contrib/bc/scripts/sqrt_int_guess.bc | 2 +-
contrib/bc/scripts/sqrt_random.bc | 2 +-
contrib/bc/scripts/sqrt_random.sh | 2 +-
contrib/bc/src/args.c | 2 +-
contrib/bc/src/bc.c | 6 +-
contrib/bc/src/bc_lex.c | 2 +-
contrib/bc/src/bc_parse.c | 2 +-
contrib/bc/src/data.c | 4 +-
contrib/bc/src/dc.c | 6 +-
contrib/bc/src/dc_lex.c | 2 +-
contrib/bc/src/dc_parse.c | 2 +-
contrib/bc/src/file.c | 34 +-
contrib/bc/src/history.c | 2 +-
contrib/bc/src/lang.c | 2 +-
contrib/bc/src/lex.c | 2 +-
contrib/bc/src/library.c | 2 +-
contrib/bc/src/main.c | 16 +-
contrib/bc/src/num.c | 76 +++-
contrib/bc/src/opt.c | 2 +-
contrib/bc/src/parse.c | 2 +-
contrib/bc/src/program.c | 2 +-
contrib/bc/src/rand.c | 2 +-
contrib/bc/src/read.c | 2 +-
contrib/bc/src/vector.c | 2 +-
contrib/bc/src/vm.c | 62 ++-
contrib/bc/tests/all.sh | 2 +-
contrib/bc/tests/bc/timeconst.sh | 2 +-
contrib/bc/tests/bcl.c | 2 +-
contrib/bc/tests/dc/scripts/easter.sh | 2 +-
contrib/bc/tests/error.sh | 2 +-
contrib/bc/tests/errors.sh | 2 +-
contrib/bc/tests/history.py | 6 +-
contrib/bc/tests/history.sh | 2 +-
contrib/bc/tests/other.sh | 6 +-
contrib/bc/tests/read.sh | 2 +-
contrib/bc/tests/script.sh | 2 +-
contrib/bc/tests/scripts.sh | 2 +-
contrib/bc/tests/stdin.sh | 2 +-
contrib/bc/tests/test.sh | 2 +-
140 files changed, 4449 insertions(+), 4236 deletions(-)
diff --git a/contrib/bc/LICENSE.md b/contrib/bc/LICENSE.md
index 74441065df35..c8f6758e6d4b 100644
--- a/contrib/bc/LICENSE.md
+++ b/contrib/bc/LICENSE.md
@@ -1,6 +1,6 @@
# License
-Copyright (c) 2018-2023 Gavin D. Howard <gavin@gavinhoward.com>
+Copyright (c) 2018-2024 Gavin D. Howard <gavin@gavinhoward.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -60,7 +60,7 @@ The files `src/rand.c` and `include/rand.h` are under the following copyrights
and license:
Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors<br>
-Copyright (c) 2018-2023 Gavin D. Howard <gavin@gavinhoward.com>
+Copyright (c) 2018-2024 Gavin D. Howard <gavin@gavinhoward.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
diff --git a/contrib/bc/MEMORY_BUGS.md b/contrib/bc/MEMORY_BUGS.md
index 12e0b854e9d8..2e41ad3d75c9 100644
--- a/contrib/bc/MEMORY_BUGS.md
+++ b/contrib/bc/MEMORY_BUGS.md
@@ -23,6 +23,13 @@ existed in.
The first version without this bug is `6.0.2`.
+* In versions `3.0.0` until `6.7.5` (inclusive) of `bc` and `dc`, there is a
+ possible out-of-bounds read when there is an error flushing `stdout` on exit
+ because such an error would cause `bc` and `dc` to attempt to use a `jmp_buf`
+ when none exists.
+
+ The first version without this bug is `6.7.6`.
+
* In versions `5.0.0` until `6.0.4` (inclusive) of `bc`, there is an
out-of-bounds access if a non-local (non-`auto`) variable is set to a string
with `asciify()`, then the function is redefined with a use of the same
diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in
index e1309cd6d6b3..4adb76ddaa17 100644
--- a/contrib/bc/Makefile.in
+++ b/contrib/bc/Makefile.in
@@ -1,7 +1,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2024 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md
index 32e74de31231..95de7e5182c4 100644
--- a/contrib/bc/NEWS.md
+++ b/contrib/bc/NEWS.md
@@ -1,5 +1,12 @@
# News
+## 6.7.6
+
+This is a production release to fix one bug.
+
+The bug was that `bc` attempted to jump out when flushing `stdout` on exit, but
+there is no jump buf at that point.
+
## 6.7.5
This is a production release to fix one small bug.
diff --git a/contrib/bc/NOTICE.md b/contrib/bc/NOTICE.md
index c0d3ded5797a..35536b2c27d7 100644
--- a/contrib/bc/NOTICE.md
+++ b/contrib/bc/NOTICE.md
@@ -1,6 +1,6 @@
# Notice
-Copyright 2018-2023 Gavin D. Howard and contributors.
+Copyright 2018-2024 Gavin D. Howard and contributors.
## Contributors
diff --git a/contrib/bc/README.md b/contrib/bc/README.md
index 943ca89eee2c..696e6186b8bd 100644
--- a/contrib/bc/README.md
+++ b/contrib/bc/README.md
@@ -48,7 +48,7 @@ POSIX-compatible systems that are known to work:
* FreeBSD
* OpenBSD
* NetBSD
-* Mac OSX
+* macOS
* Solaris* (as long as the Solaris version supports POSIX 2008)
* AIX
* HP-UX* (except for history)
@@ -347,6 +347,8 @@ that is because it is more robust. See the [benchmarks][19].
Below is a non-comprehensive list of extensions that this `bc` and `dc` have
that all others do not.
+* **The `!` operator has higher precedence than the `!` operator in other `bc`
+ implementations.**
* An extended math library. (See [here][30] for more information.)
* A command-line prompt.
* Turning on and off digit clamping. (Digit clamping is about how to treat
@@ -427,7 +429,7 @@ Other projects based on this bc are:
* [FreeBSD `bc`][23]. While the `bc` in FreeBSD is kept up-to-date, it is better
to [report bugs there][24], as well as [submit patches][25], and the
maintainers of the package will contact me if necessary.
-* [Mac OSX `bc`][35]. Any bugs in that `bc` should be reported to me, but do
+* [macOS `bc`][35]. Any bugs in that `bc` should be reported to me, but do
expect bugs because the version is old.
* [Android Open Source `bc`][32]. Any bugs in that `bc` can be reported here.
diff --git a/contrib/bc/compile_flags.txt b/contrib/bc/compile_flags.txt
new file mode 100644
index 000000000000..7a08c87f3876
--- /dev/null
+++ b/contrib/bc/compile_flags.txt
@@ -0,0 +1,15 @@
+-Weverything
+-pedantic
+-Wno-unsafe-buffer-usage
+-D_POSIX_C_SOURCE=200809L
+-D_XOPEN_SOURCE=700
+-D_BSD_SOURCE
+-D_GNU_SOURCE
+-D_DEFAULT_SOURCE
+-Iinclude/
+-DBC_DEBUG=1
+-DBC_ENABLED=1
+-DDC_ENABLED=1
+-DBC_ENABLE_EXTRA_MATH=1
+-DBC_ENABLE_HISTORY=1
+-DBC_ENABLE_NLS=1
diff --git a/contrib/bc/configure.sh b/contrib/bc/configure.sh
index 9292f094bb17..43bb502ea817 100755
--- a/contrib/bc/configure.sh
+++ b/contrib/bc/configure.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2024 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -127,7 +127,7 @@ usage() {
printf ' If this option is given along with -e and -r, the last occurrence of\n'
printf ' all of the three is used.\n'
printf ' -k KARATSUBA_LEN, --karatsuba-len KARATSUBA_LEN\n'
- printf ' Set the karatsuba length to KARATSUBA_LEN (default is 64).\n'
+ printf ' Set the karatsuba length to KARATSUBA_LEN (default is 32).\n'
printf ' It is an error if KARATSUBA_LEN is not a number or is less than 16.\n'
printf ' -l, --install-all-locales\n'
printf ' Installs all locales, regardless of how many are on the system. This\n'
@@ -163,7 +163,7 @@ usage() {
printf ' Enable the use of libreadline/readline. This is meant for those users\n'
printf ' that want vi-like or Emacs-like behavior in history. This option is\n'
printf ' ignored if history is disabled. If this option is given along with -e\n'
- printf ' and -r, the last occurrence of all of the three is used.\n'
+ printf ' and -i, the last occurrence of all of the three is used.\n'
printf ' -s SETTING, --set-default-on SETTING\n'
printf ' Set the default named by SETTING to on. See below for possible values\n'
printf ' for SETTING. For multiple instances of the -s or -S for the the same\n'
@@ -1671,10 +1671,10 @@ else
CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700"
fi
-# Test Mac OSX. This is not in an if statement because regardless of whatever
-# the user says, we need to know if we are on Mac OSX. If we are, we have to set
+# Test macOS. This is not in an if statement because regardless of whatever the
+# user says, we need to know if we are on macOS. If we are, we have to set
# _DARWIN_C_SOURCE.
-printf 'Testing for Mac OSX...\n'
+printf 'Testing for macOS...\n'
flags="-DBC_TEST_APPLE -DBC_ENABLE_AFL=0"
"$CC" $CPPFLAGS $CFLAGS $flags "-I$scriptdir/include" -E "$scriptdir/src/vm.c" > /dev/null 2>&1
@@ -1682,15 +1682,15 @@ flags="-DBC_TEST_APPLE -DBC_ENABLE_AFL=0"
err="$?"
if [ "$err" -ne 0 ]; then
- printf 'On Mac OSX. Using _DARWIN_C_SOURCE.\n\n'
+ printf 'On macOS. Using _DARWIN_C_SOURCE.\n\n'
apple="-D_DARWIN_C_SOURCE"
else
- printf 'Not on Mac OSX.\n\n'
+ printf 'Not on macOS.\n\n'
apple=""
fi
-# We can't use the linker's strip flag on Mac OSX.
-if [ "$debug" -eq 0 ] && [ "$apple" == "" ] && [ "$strip_bin" -ne 0 ]; then
+# We can't use the linker's strip flag on macOS.
+if [ "$debug" -eq 0 ] && [ "$apple" = "" ] && [ "$strip_bin" -ne 0 ]; then
LDFLAGS="-s $LDFLAGS"
fi
diff --git a/contrib/bc/gen/bc_help.txt b/contrib/bc/gen/bc_help.txt
index c51ba186db15..489b54a185f1 100644
--- a/contrib/bc/gen/bc_help.txt
+++ b/contrib/bc/gen/bc_help.txt
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/gen/dc_help.txt b/contrib/bc/gen/dc_help.txt
index 7d9e7ec28d25..df4ede1583a2 100644
--- a/contrib/bc/gen/dc_help.txt
+++ b/contrib/bc/gen/dc_help.txt
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/gen/lib.bc b/contrib/bc/gen/lib.bc
index b12b23176790..0c9389b8510d 100644
--- a/contrib/bc/gen/lib.bc
+++ b/contrib/bc/gen/lib.bc
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/gen/lib2.bc b/contrib/bc/gen/lib2.bc
index df51d0c07a8d..d6d9f70fe063 100644
--- a/contrib/bc/gen/lib2.bc
+++ b/contrib/bc/gen/lib2.bc
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/gen/strgen.c b/contrib/bc/gen/strgen.c
index 2cb3ed9e8475..1394a05c4a76 100644
--- a/contrib/bc/gen/strgen.c
+++ b/contrib/bc/gen/strgen.c
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -68,7 +68,7 @@ static const char* const bc_gen_ex_end = "{{ end }}";
// This is exactly what it looks like. It just slaps a simple license header on
// the generated C source file.
static const char* const bc_gen_header =
- "// Copyright (c) 2018-2023 Gavin D. Howard and contributors.\n"
+ "// Copyright (c) 2018-2024 Gavin D. Howard and contributors.\n"
"// Licensed under the 2-clause BSD license.\n"
"// *** AUTOMATICALLY GENERATED FROM %s. DO NOT MODIFY. ***\n\n";
// clang-format on
diff --git a/contrib/bc/gen/strgen.sh b/contrib/bc/gen/strgen.sh
index 2b8927b5528e..8542bd40ee83 100755
--- a/contrib/bc/gen/strgen.sh
+++ b/contrib/bc/gen/strgen.sh
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
-# Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+# Copyright (c) 2018-2024 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -96,7 +96,7 @@ if [ -n "$remove_tabs" ]; then
fi
cat<<EOF
-// Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+// Copyright (c) 2018-2024 Gavin D. Howard and contributors.
// Licensed under the 2-clause BSD license.
// *** AUTOMATICALLY GENERATED FROM ${input}. DO NOT MODIFY. ***
diff --git a/contrib/bc/include/args.h b/contrib/bc/include/args.h
index 3174ba267590..f1e9f007bddf 100644
--- a/contrib/bc/include/args.h
+++ b/contrib/bc/include/args.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/bc.h b/contrib/bc/include/bc.h
index 17fd0b9d171f..b25df09a174e 100644
--- a/contrib/bc/include/bc.h
+++ b/contrib/bc/include/bc.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -48,8 +48,9 @@
/**
* The main function for bc. It just sets variables and passes its arguments
* through to @a bc_vm_boot().
+ * @return A status.
*/
-void
+BcStatus
bc_main(int argc, char* argv[]);
// These are references to the help text, the library text, and the "filename"
@@ -88,10 +89,8 @@ typedef struct BcLexKeyword
#define BC_LEX_KW_LEN(kw) ((size_t) ((kw)->data & ~(BC_LEX_CHAR_MSB(1))))
/// A macro to easily build a keyword entry. See bc_lex_kws in src/data.c.
-#define BC_LEX_KW_ENTRY(a, b, c) \
- { \
- .data = ((b) & ~(BC_LEX_CHAR_MSB(1))) | BC_LEX_CHAR_MSB(c), .name = a \
- }
+#define BC_LEX_KW_ENTRY(a, b, c) \
+ { .data = ((b) & ~(BC_LEX_CHAR_MSB(1))) | BC_LEX_CHAR_MSB(c), .name = a }
#if BC_ENABLE_EXTRA_MATH
@@ -234,7 +233,7 @@ bc_lex_token(BcLex* l);
* @param t The token to return operator data for.
* @return The operator data for @a t.
*/
-#define BC_PARSE_OP_DATA(t) bc_parse_ops[((t) -BC_LEX_OP_INC)]
+#define BC_PARSE_OP_DATA(t) bc_parse_ops[((t) - BC_LEX_OP_INC)]
/**
* Returns non-zero if operator @a op is left associative, zero otherwise.
@@ -341,7 +340,7 @@ bc_lex_token(BcLex* l);
* @param t The token to turn into an instruction.
* @return The token as an instruction.
*/
-#define BC_PARSE_TOKEN_INST(t) ((uchar) ((t) -BC_LEX_NEG + BC_INST_NEG))
+#define BC_PARSE_TOKEN_INST(t) ((uchar) ((t) - BC_LEX_NEG + BC_INST_NEG))
/**
* Returns true if the token is a bc keyword.
@@ -372,10 +371,8 @@ typedef struct BcParseNext
/// A macro to generate a BcParseNext literal from BcParseNext data. See
/// src/data.c for examples.
-#define BC_PARSE_NEXT(a, ...) \
- { \
- .len = (uchar) (a), BC_PARSE_NEXT_TOKENS(__VA_ARGS__) \
- }
+#define BC_PARSE_NEXT(a, ...) \
+ { .len = (uchar) (a), BC_PARSE_NEXT_TOKENS(__VA_ARGS__) }
/// A status returned by @a bc_parse_expr_err(). It can either return success or
/// an error indicating an empty expression.
diff --git a/contrib/bc/include/bcl.h b/contrib/bc/include/bcl.h
index d3a9f42cdcf8..8e762b694f4d 100644
--- a/contrib/bc/include/bcl.h
+++ b/contrib/bc/include/bcl.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/dc.h b/contrib/bc/include/dc.h
index 9a603c26d1a5..1328f1c63b38 100644
--- a/contrib/bc/include/dc.h
+++ b/contrib/bc/include/dc.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -45,8 +45,9 @@
/**
* The main function for dc. It just sets variables and passes its arguments
* through to @a bc_vm_boot().
+ * @return A status.
*/
-void
+BcStatus
dc_main(int argc, char* argv[]);
// A reference to the dc help text.
diff --git a/contrib/bc/include/file.h b/contrib/bc/include/file.h
index 95cfa861a734..86f368db11c6 100644
--- a/contrib/bc/include/file.h
+++ b/contrib/bc/include/file.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -54,6 +54,9 @@ typedef struct BcFile
// with the existing code as possible.
FILE* f;
+ // True if errors should be fatal, false otherwise.
+ bool errors_fatal;
+
} BcFile;
#else // BC_ENABLE_LINE_LIB
@@ -64,6 +67,9 @@ typedef struct BcFile
// The actual file descriptor.
int fd;
+ // True if errors should be fatal, false otherwise.
+ bool errors_fatal;
+
// The buffer for the file.
char* buf;
@@ -123,23 +129,25 @@ typedef enum BcFlushType
/**
* Initialize a file.
- * @param f The file to initialize.
- * @param file The stdio file.
+ * @param f The file to initialize.
+ * @param file The stdio file.
+ * @param errors_fatal True if errors should be fatal, false otherwise.
*/
void
-bc_file_init(BcFile* f, FILE* file);
+bc_file_init(BcFile* f, FILE* file, bool errors_fatal);
#else // BC_ENABLE_LINE_LIB
/**
* Initialize a file.
- * @param f The file to initialize.
- * @param fd The file descriptor.
- * @param buf The buffer for the file.
- * @param cap The capacity of the buffer.
+ * @param f The file to initialize.
+ * @param fd The file descriptor.
+ * @param buf The buffer for the file.
+ * @param cap The capacity of the buffer.
+ * @param errors_fatal True if errors should be fatal, false otherwise.
*/
void
-bc_file_init(BcFile* f, int fd, char* buf, size_t cap);
+bc_file_init(BcFile* f, int fd, char* buf, size_t cap, bool errors_fatal);
#endif // BC_ENABLE_LINE_LIB
diff --git a/contrib/bc/include/history.h b/contrib/bc/include/history.h
index 64402c4dffa1..460524bd7b87 100644
--- a/contrib/bc/include/history.h
+++ b/contrib/bc/include/history.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/lang.h b/contrib/bc/include/lang.h
index 97aeeaa98da8..6c8245139719 100644
--- a/contrib/bc/include/lang.h
+++ b/contrib/bc/include/lang.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/lex.h b/contrib/bc/include/lex.h
index ac9b7b6ea69c..d2be3c7526ef 100644
--- a/contrib/bc/include/lex.h
+++ b/contrib/bc/include/lex.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/library.h b/contrib/bc/include/library.h
index 1edd3757444c..9942705a5f36 100644
--- a/contrib/bc/include/library.h
+++ b/contrib/bc/include/library.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/num.h b/contrib/bc/include/num.h
index 6c9dee107f2f..6cead6eb3823 100644
--- a/contrib/bc/include/num.h
+++ b/contrib/bc/include/num.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/opt.h b/contrib/bc/include/opt.h
index 28d9d99a7856..e60328994d8c 100644
--- a/contrib/bc/include/opt.h
+++ b/contrib/bc/include/opt.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/parse.h b/contrib/bc/include/parse.h
index ece413e7bd74..7f0f8768b0db 100644
--- a/contrib/bc/include/parse.h
+++ b/contrib/bc/include/parse.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/program.h b/contrib/bc/include/program.h
index 1df753afad22..e16e5c079d7d 100644
--- a/contrib/bc/include/program.h
+++ b/contrib/bc/include/program.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/rand.h b/contrib/bc/include/rand.h
index e516295d7c5c..aee63b866cf6 100644
--- a/contrib/bc/include/rand.h
+++ b/contrib/bc/include/rand.h
@@ -13,7 +13,7 @@
* This code is under the following license:
*
* Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -241,10 +241,7 @@ typedef struct BcRandState
* @param l The low 64 bits.
* @return The constant built from @a h and @a l.
*/
-#define BC_RAND_CONSTANT(h, l) \
- { \
- .lo = (l), .hi = (h) \
- }
+#define BC_RAND_CONSTANT(h, l) { .lo = (l), .hi = (h) }
/**
* Truncates a PCG state to the number of bits in a random integer.
diff --git a/contrib/bc/include/read.h b/contrib/bc/include/read.h
index 867dcd7433a3..62e6897635a2 100644
--- a/contrib/bc/include/read.h
+++ b/contrib/bc/include/read.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/status.h b/contrib/bc/include/status.h
index 242514edb476..f579df8c649b 100644
--- a/contrib/bc/include/status.h
+++ b/contrib/bc/include/status.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -60,10 +60,10 @@
#endif // __FreeBSD__
#endif // BC_TEST_FREEBSD
-// This is used by configure.sh to test for Mac OSX.
+// This is used by configure.sh to test for macOS.
#ifdef BC_TEST_APPLE
#ifdef __APPLE__
-#error On Mac OSX without _DARWIN_C_SOURCE
+#error On macOS without _DARWIN_C_SOURCE
#endif // __APPLE__
#endif // BC_TEST_APPLE
diff --git a/contrib/bc/include/vector.h b/contrib/bc/include/vector.h
index b86be1424537..cad5fc2aa7c3 100644
--- a/contrib/bc/include/vector.h
+++ b/contrib/bc/include/vector.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/include/version.h b/contrib/bc/include/version.h
index e2576269345d..586691a6e7ef 100644
--- a/contrib/bc/include/version.h
+++ b/contrib/bc/include/version.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -37,6 +37,6 @@
#define BC_VERSION_H
/// The current version.
-#define VERSION 6.7.5
+#define VERSION 6.7.6
#endif // BC_VERSION_H
diff --git a/contrib/bc/include/vm.h b/contrib/bc/include/vm.h
index c56cc8e7370a..052c1d14c237 100644
--- a/contrib/bc/include/vm.h
+++ b/contrib/bc/include/vm.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+ * Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -493,7 +493,7 @@
#define BC_VM_SAFE_RESULT(r) ((r)->t >= BC_RESULT_TEMP)
/// The invalid locale catalog return value.
-#define BC_VM_INVALID_CATALOG ((nl_catd) -1)
+#define BC_VM_INVALID_CATALOG ((nl_catd) - 1)
/**
* Returns true if the *unsigned* multiplication overflows.
@@ -791,8 +791,9 @@ bc_vm_info(const char* const help);
* The entrance point for bc/dc together.
* @param argc The count of arguments.
* @param argv The argument array.
+ * @return A status.
*/
-void
+BcStatus
bc_vm_boot(int argc, char* argv[]);
/**
@@ -1045,8 +1046,9 @@ bc_vm_fatalError(BcErr e);
* A function to call at exit.
* @param status The exit status.
*/
-int
-bc_vm_atexit(int status);
+BcStatus
+bc_vm_atexit(BcStatus status);
+
#endif // BC_ENABLE_LIBRARY
/// A reference to the copyright header.
diff --git a/contrib/bc/locales/de_DE.ISO8859-1.msg b/contrib/bc/locales/de_DE.ISO8859-1.msg
index 858a3946e8f8..9700ab070b2c 100644
--- a/contrib/bc/locales/de_DE.ISO8859-1.msg
+++ b/contrib/bc/locales/de_DE.ISO8859-1.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/de_DE.UTF-8.msg b/contrib/bc/locales/de_DE.UTF-8.msg
index 25be4fd79cb9..7b918fc6d1cd 100644
--- a/contrib/bc/locales/de_DE.UTF-8.msg
+++ b/contrib/bc/locales/de_DE.UTF-8.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/en_US.msg b/contrib/bc/locales/en_US.msg
index 5610496d6e71..4afcbcd1f813 100644
--- a/contrib/bc/locales/en_US.msg
+++ b/contrib/bc/locales/en_US.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/es_ES.ISO8859-1.msg b/contrib/bc/locales/es_ES.ISO8859-1.msg
index 3bf70753559e..4d022d9bf664 100644
--- a/contrib/bc/locales/es_ES.ISO8859-1.msg
+++ b/contrib/bc/locales/es_ES.ISO8859-1.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/es_ES.UTF-8.msg b/contrib/bc/locales/es_ES.UTF-8.msg
index 0a5cf26d1621..364cff6ee57f 100644
--- a/contrib/bc/locales/es_ES.UTF-8.msg
+++ b/contrib/bc/locales/es_ES.UTF-8.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/fr_FR.ISO8859-1.msg b/contrib/bc/locales/fr_FR.ISO8859-1.msg
index f2e07e02b2dc..b4b39866c96e 100644
--- a/contrib/bc/locales/fr_FR.ISO8859-1.msg
+++ b/contrib/bc/locales/fr_FR.ISO8859-1.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/fr_FR.UTF-8.msg b/contrib/bc/locales/fr_FR.UTF-8.msg
index 1e9e900746a5..c3387e31ae9f 100644
--- a/contrib/bc/locales/fr_FR.UTF-8.msg
+++ b/contrib/bc/locales/fr_FR.UTF-8.msg
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
-$ Copyright (c) 2018-2023 Gavin D. Howard and contributors.
+$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
diff --git a/contrib/bc/locales/ja_JP.UTF-8.msg b/contrib/bc/locales/ja_JP.UTF-8.msg
index d871e9bf6ad2..21640eb9f1cb 100644
--- a/contrib/bc/locales/ja_JP.UTF-8.msg
+++ b/contrib/bc/locales/ja_JP.UTF-8.msg
@@ -1,7 +1,7 @@
*** 23594 LINES SKIPPED ***