mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 21:33:04 +00:00
maint: avoid "magic number exit".
* cfg.mk (local-checks-to-skip): No longer skip it. * bootstrap.conf (gnulib_modules): Add sysexits. * doc/bison.texinfo, etc/bench.pl.in, src/parse-gram.y, * src/system.h, tests/calc.at, tests/named-refs.at: Use assert where appropriate instead of "if (...) exit". Use symbolic exit status elsewhere.
This commit is contained in:
@@ -346,8 +346,7 @@ static int
|
||||
power (int base, int exponent)
|
||||
{
|
||||
int res = 1;
|
||||
if (exponent < 0)
|
||||
exit (3);
|
||||
assert (0 <= exponent);
|
||||
for (/* Niente */; exponent; --exponent)
|
||||
res *= base;
|
||||
return res;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# FIXME: Duplication with calc.at.
|
||||
AT_BANNER([[Named references tests.]])
|
||||
|
||||
AT_SETUP([Tutorial calculator])
|
||||
@@ -142,8 +143,7 @@ int yylex (void)
|
||||
static int power (int base, int exponent)
|
||||
{
|
||||
int res = 1;
|
||||
if (exponent < 0)
|
||||
exit (3);
|
||||
assert (0 <= exponent);
|
||||
for (/* Niente */; exponent; --exponent)
|
||||
res *= base;
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user