* 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.
javaexec-script ldexpl maintainer-makefile malloc-gnu mbschr mbsrchr
mbswidth obstack perror pipe-posix quote quotearg realloc-posix
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
+ sysexits
unistd unistd-safer unlocked-io update-copyright unsetenv verify
warnings xalloc xalloc-die xstrndup
sc_prohibit_atoi_atof \
sc_prohibit_doubled_word \
sc_prohibit_empty_lines_at_EOF \
- sc_prohibit_magic_number_exit \
sc_prohibit_strcmp
# The local directory containing the checked-out copy of gnulib used in
else if (!(yyin = fopen (file.c_str (), "r")))
@{
error (std::string ("cannot open ") + file + ": " + strerror(errno));
- exit (1);
+ exit (EXIT_FAILURE);
@}
@}
{
yyin = fopen (file, "r");
if (!yyin)
- exit (2);
+ {
+ perror ("fopen");
+ exit (EXIT_FAILURE);
+ }
/* One token only. */
yylex ();
if (fclose (yyin) != 0)
- exit (3);
+ {
+ perror ("fclose");
+ exit (EXIT_FAILURE);
+ }
return 0;
}
static int
power (int base, int exponent)
{
+ assert (0 <= exponent);
int res = 1;
- if (exponent < 0)
- exit (3);
for (/* Niente */; exponent; --exponent)
res *= base;
return res;
/closeout.h
/fpending.c
/fpending.h
+/sysexits.in.h
/xalloc.m4
/xsize.m4
/xstrndup.m4
+/sysexits.m4
{
complain_at (*loc, "require bison %s, but have %s",
version, PACKAGE_VERSION);
- exit (63);
+ exit (EX_CONFIG);
}
}
typedef size_t uintptr_t;
#endif
+#include <sysexits.h>
/*---------.
| Gnulib. |
power (int base, int exponent)
{
int res = 1;
- if (exponent < 0)
- exit (3);
+ assert (0 <= exponent);
for (/* Niente */; exponent; --exponent)
res *= base;
return res;
# 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])
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;