# New Ticket Created by Mark Glines
# Please include the string: [perl #43805]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43805 >
C89 apparently added EXIT_SUCCESS and EXIT_FAILURE, because VMS has a
different idea of what constitutes "success". Anyway, splint warns
about it.
Builds fine on linux/x86, and test results are unchanged.
Mark
Index: src/ops/debug.ops
===================================================================
--- src/ops/debug.ops (revision 19783)
+++ src/ops/debug.ops (working copy)
@@ -102,7 +102,7 @@
PDB_run_command(interp,command);
}
/* RT#42378 this is not ok */
- exit(0);
+ exit(EXIT_SUCCESS);
}
interp->pdb->cur_opcode = (opcode_t *)cur_opcode + 1;
PDB_set_break(interp,NULL);
Index: src/gc/resources.c
===================================================================
--- src/gc/resources.c (revision 19783)
+++ src/gc/resources.c (working copy)
@@ -101,7 +101,7 @@
if (!new_block) {
fprintf(stderr, "out of mem allocsize = %d\n", (int)alloc_size);
- exit(1);
+ exit(EXIT_FAILURE);
}
new_block->free = alloc_size;
@@ -208,7 +208,7 @@
if (pool->top_block->free < size) {
fprintf(stderr, "out of mem\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
}
}
Index: src/bignum.c
===================================================================
--- src/bignum.c (revision 19783)
+++ src/bignum.c (working copy)
@@ -706,7 +706,7 @@
void
BN_exception(PINTD_ BN_EXCEPTIONS exception, const char* message) {
printf("Exception %d %s\n", exception, message);
- exit(0);
+ exit(EXIT_SUCCESS);
}
/*
Index: src/pdump.c
===================================================================
--- src/pdump.c (revision 19783)
+++ src/pdump.c (working copy)
@@ -172,7 +172,7 @@
"the platform's native\n");
printf("\t binary format for better efficiency on reading "
"non native PBCs\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
static struct longopt_opt_decl options[] = {
@@ -256,19 +256,19 @@
pack = (opcode_t*) mem_sys_allocate(size);
if (!pack) {
printf("out of mem\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
PackFile_pack(interp, interp->code->base.pf, pack);
if (strcmp(file, "-") == 0)
fp = stdout;
else if ((fp = fopen(file, "wb")) == 0) {
printf("Couldn't open %s\n", file);
- exit(1);
+ exit(EXIT_FAILURE);
}
if ((1 != fwrite(pack, size, 1, fp))) {
printf("Couldn't write %s\n", file);
- exit(1);
+ exit(EXIT_FAILURE);
}
fclose(fp);
mem_sys_free(pack);
Index: src/exceptions.c
===================================================================
--- src/exceptions.c (revision 19783)
+++ src/exceptions.c (working copy)
@@ -94,7 +94,7 @@
# define dumpcore() \
fprintf(stderr, "Sorry, coredump is not yet implemented " \
"for this platform.\n\n"); \
- exit(1);
+ exit(EXIT_FAILURE);
#endif
/*
Index: src/io/io_unix.c
===================================================================
--- src/io/io_unix.c (revision 19783)
+++ src/io/io_unix.c (working copy)
@@ -1031,7 +1031,7 @@
close(STDIN_FILENO);
close(fds[1]);
if (dup(fds[0]) != STDIN_FILENO) {
- exit(0);
+ exit(EXIT_SUCCESS);
}
}
else {
@@ -1042,7 +1042,7 @@
if (dup(fds[0]) != STDIN_FILENO || dup(fds[1]) != STDOUT_FILENO
|| dup(fds[1]) != STDERR_FILENO)
{
- exit(0);
+ exit(EXIT_SUCCESS);
}
}
/*
@@ -1059,7 +1059,7 @@
execv(cmd, argv); /* XXX use execvp ? */
/* Will never reach this unless exec fails. */
perror("execvp");
- exit(1);
+ exit(EXIT_FAILURE);
}
perror("fork");
Index: compilers/imcc/instructions.c
===================================================================
--- compilers/imcc/instructions.c (revision 19783)
+++ compilers/imcc/instructions.c (working copy)
@@ -564,7 +564,7 @@
default:
fprintf(stderr, "unhandled: opsize (%d), op %s, fmt %s\n",
ins->opsize, ins->op, ins->fmt);
- exit(1);
+ exit(EXIT_FAILURE);
break;
}
return len;
Index: compilers/imcc/imclexer.c
===================================================================
--- compilers/imcc/imclexer.c (revision 19783)
+++ compilers/imcc/imclexer.c (working copy)
@@ -5300,7 +5300,7 @@
if (!interp) {
fprintf(stderr, "Argh, interp not found\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
yy_delete_buffer(YY_CURRENT_BUFFER,yyscanner);
Index: compilers/imcc/main.c
===================================================================
--- compilers/imcc/main.c (revision 19783)
+++ compilers/imcc/main.c (working copy)
@@ -240,7 +240,7 @@
extern int yydebug;
if (*argc == 1) {
usage(stderr);
- exit(0);
+ exit(EXIT_SUCCESS);
}
run_pbc = 1;
@@ -313,7 +313,7 @@
break;
case OPT_RUNTIME_PREFIX:
printf("%s\n", Parrot_get_runtime_prefix(interp, NULL));
- exit(0);
+ exit(EXIT_SUCCESS);
break;
case 'V':
Parrot_version(interp);
@@ -750,7 +750,7 @@
IMCC_TRY(IMCC_INFO(interp)->jump_buf,
IMCC_INFO(interp)->error_code) {
if (yyparse(yyscanner, interp))
- exit(1);
+ exit(EXIT_FAILURE);
imc_compile_all_units(interp);
}
Index: compilers/imcc/parser_util.c
===================================================================
--- compilers/imcc/parser_util.c (revision 19783)
+++ compilers/imcc/parser_util.c (working copy)
@@ -1245,7 +1245,7 @@
if (!ch) {
/* no fatal here, else we get recursion */
fprintf(stderr, "illegal format at %s\n", cp);
- exit(1);
+ exit(EXIT_FAILURE);
}
/* ok, we have a valid format char */
++fmt;
Index: compilers/pirc/src/pirmain.c
===================================================================
--- compilers/pirc/src/pirmain.c (revision 19783)
+++ compilers/pirc/src/pirmain.c (working copy)
@@ -128,7 +128,7 @@
default:
fprintf(stderr, "Unknown option: '%c'\n", opt);
print_help();
- exit(1);
+ exit(EXIT_FAILURE);
}
/* get next commandline argument */
argv++;
@@ -138,7 +138,7 @@
if (argv[0] == NULL) {
fprintf(stderr, "No file specified. Try -h for help.\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* create a vtable based on the desired output */
@@ -166,7 +166,7 @@
break;
default:
fprintf(stderr, "Unknown output type specified\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* create a new parser, specifying the file name and the vtable */
Index: compilers/pirc/src/pastout.c
===================================================================
--- compilers/pirc/src/pastout.c (revision 19783)
+++ compilers/pirc/src/pastout.c (working copy)
@@ -283,7 +283,7 @@
vtable->data = (emit_data *)malloc(sizeof(emit_data));
if (vtable->data == NULL) {
fprintf(stderr, "Failed to allocate memory for vtable data\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
vtable->data->indent = 0;
vtable->data->outputfile = outputfile;
Index: compilers/pirc/src/jsonout.c
===================================================================
--- compilers/pirc/src/jsonout.c (revision 19783)
+++ compilers/pirc/src/jsonout.c (working copy)
@@ -405,7 +405,7 @@
vtable->data = (emit_data *)malloc(sizeof(emit_data));
if (vtable->data == NULL) {
fprintf(stderr, "Failed to allocate memory for vtable data\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
vtable->data->indent = 0;
vtable->data->outputfile = outputfile;
Index: compilers/pirc/src/pirparser.c
===================================================================
--- compilers/pirc/src/pirparser.c (revision 19783)
+++ compilers/pirc/src/pirparser.c (working copy)
@@ -128,7 +128,7 @@
p->heredoc_ids = NULL;
free(p);
p = NULL;
- exit(0);
+ exit(EXIT_SUCCESS);
}
@@ -166,7 +166,7 @@
if (p == NULL) {
fprintf(stderr, "no parser");
- exit(1);
+ exit(EXIT_FAILURE);
}
p->lexer = new_lexer(filename);
p->curtoken = next_token(p->lexer);
Index: compilers/pirc/src/pirout.c
===================================================================
--- compilers/pirc/src/pirout.c (revision 19783)
+++ compilers/pirc/src/pirout.c (working copy)
@@ -278,7 +278,7 @@
vtable->data = (emit_data *)malloc(sizeof(emit_data));
if (vtable->data == NULL) {
fprintf(stderr, "Failed to allocate memory for vtable data\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
vtable->data->outputfile = outputfile;
Index: compilers/pirc/src/pirvtable.c
===================================================================
--- compilers/pirc/src/pirvtable.c (revision 19783)
+++ compilers/pirc/src/pirvtable.c (working copy)
@@ -63,7 +63,7 @@
if (vtable == NULL) {
fprintf(stderr, "Failed to allocate memory for vtable!\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* set all entries to 'default' by default. This way, another output module
Index: compilers/pirc/src/pirutil.c
===================================================================
--- compilers/pirc/src/pirutil.c (revision 19783)
+++ compilers/pirc/src/pirutil.c (working copy)
@@ -61,7 +61,7 @@
if (file == NULL) {
fprintf(stderr, "Failed to open file '%s' in mode '%s'\nTerminating\n", filename, mode);
- exit(1);
+ exit(EXIT_FAILURE);
}
return file;
Index: compilers/pirc/src/pirlexer.c
===================================================================
--- compilers/pirc/src/pirlexer.c (revision 19783)
+++ compilers/pirc/src/pirlexer.c (working copy)
@@ -614,7 +614,7 @@
if (filebuff == NULL) {
fprintf(stderr, "Error in read_file(): failed to allocate memory for file buffer\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
filebuff->filename = clone_string(filename);
@@ -632,7 +632,7 @@
if (filebuff->buffer == NULL) {
fprintf(stderr, "Error in read_file(): failed to allocate memory for file contents\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* initialize other fields */
@@ -925,7 +925,7 @@
lexer_state *lexer = (lexer_state *)malloc(sizeof(lexer_state));
if (lexer == NULL) {
fprintf(stderr, "Error in new_lexer(): failed to allocate memory for lexer\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
lexer->token_chars = (char *)calloc(MAX_ID_LENGTH, sizeof(char));
@@ -1626,7 +1626,7 @@
if (lexer->curfile->curchar >= lexer->curfile->buffer+lexer->curfile->filesize) {
printf("FATAL: end of file passed!\n");
}
- exit(1);
+ exit(EXIT_FAILURE);
}
}
Index: t/pmc/bignum.t
===================================================================
--- t/pmc/bignum.t (revision 19783)
+++ t/pmc/bignum.t (working copy)
@@ -197,7 +197,7 @@
case 5 : context.rounding = ROUND_FLOOR;
break;
default : printf("Unknown rounding %i\n", round);
- exit(1);
+ exit(EXIT_FAILURE);
}
one = BN_from_string(lef, &context);
@@ -230,7 +230,7 @@
break;
default : printf("No operation of type %i\n", oper);
- exit(0);
+ exit(EXIT_SUCCESS);
}
BN_to_scientific_string(result, &output);
Index: t/src/compiler.t
===================================================================
--- t/src/compiler.t (revision 19783)
+++ t/src/compiler.t (working copy)
@@ -55,7 +55,7 @@
comp = VTABLE_get_pmc_keyed_str(interp, compreg, pir);
if (PMC_IS_NULL(comp) || !VTABLE_defined(interp, comp)) {
PIO_eprintf(interp, "Pir compiler not loaded");
- exit(1);
+ exit(EXIT_FAILURE);
}
/*
* compile source
@@ -64,7 +64,7 @@
if (PMC_IS_NULL(prog) || !VTABLE_defined(interp, prog)) {
PIO_eprintf(interp, "Pir compiler returned no prog");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* keep eval PMC alive */
dod_register_pmc(interp, prog);
@@ -138,7 +138,7 @@
comp = VTABLE_get_pmc_keyed_str(interp, compreg, pir);
if (PMC_IS_NULL(comp) || !VTABLE_defined(interp, comp)) {
PIO_eprintf(interp, "Pir compiler not loaded");
- exit(1);
+ exit(EXIT_FAILURE);
}
/*
@@ -148,7 +148,7 @@
if (PMC_IS_NULL(prog) || !VTABLE_defined(interp, prog)) {
PIO_eprintf(interp, "Pir compiler returned no prog");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* keep eval PMC alive */
dod_register_pmc(interp, prog);
@@ -213,7 +213,7 @@
if (PMC_IS_NULL(prog) || !VTABLE_defined(interp, prog)) {
PIO_eprintf(interp, "Pir compiler returned no prog");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* keep eval PMC alive */
dod_register_pmc(interp, prog);
@@ -249,7 +249,7 @@
comp = VTABLE_get_pmc_keyed_str(interp, compreg, pir);
if (PMC_IS_NULL(comp) || !VTABLE_defined(interp, comp)) {
PIO_eprintf(interp, "Pir compiler not loaded");
- exit(1);
+ exit(EXIT_FAILURE);
}
compile_run(interp, c_src, pir, argc, argv);
compile_run(interp, c2_src, pir, argc, argv);
Index: config/gen/cpu/i386/memcpy_mmx_in.c
===================================================================
--- config/gen/cpu/i386/memcpy_mmx_in.c (revision 19783)
+++ config/gen/cpu/i386/memcpy_mmx_in.c (working copy)
@@ -73,7 +73,7 @@
for (i = 0; i < n; ++i) {
if (d[i] != (i & 0xff)) {
printf("error s[%d] = %d d = %d\n", i, s[i], d[i]);
- exit(1);
+ exit(EXIT_FAILURE);
}
}
puts("ok");
Index: config/gen/cpu/i386/memcpy_sse.c
===================================================================
--- config/gen/cpu/i386/memcpy_sse.c (revision 19783)
+++ config/gen/cpu/i386/memcpy_sse.c (working copy)
@@ -79,7 +79,7 @@
for (i = 0; i < n; ++i)
if (d[i] != (i & 0xff)) {
printf("error s[%d] = %d d = %d\n", i, s[i], d[i]);
- exit(1);
+ exit(EXIT_FAILURE);
}
puts("ok");
return 0;
Index: config/gen/cpu/i386/memcpy_sse_in.c
===================================================================
--- config/gen/cpu/i386/memcpy_sse_in.c (revision 19783)
+++ config/gen/cpu/i386/memcpy_sse_in.c (working copy)
@@ -64,7 +64,7 @@
for (i = 0; i < n; ++i)
if (d[i] != (i & 0xff)) {
printf("error s[%d] = %d d = %d\n", i, s[i], d[i]);
- exit(1);
+ exit(EXIT_FAILURE);
}
puts("ok");
return 0;
Index: config/gen/cpu/i386/memcpy_mmx.c
===================================================================
--- config/gen/cpu/i386/memcpy_mmx.c (revision 19783)
+++ config/gen/cpu/i386/memcpy_mmx.c (working copy)
@@ -88,7 +88,7 @@
for (i = 0; i < n; ++i)
if (d[i] != (i & 0xff)) {
printf("error s[%d] = %d d = %d\n", i, s[i], d[i]);
- exit(1);
+ exit(EXIT_FAILURE);
}
puts("ok");
return 0;
Index: languages/cola/sym.c
===================================================================
--- languages/cola/sym.c (revision 19783)
+++ languages/cola/sym.c (working copy)
@@ -647,7 +647,7 @@
if ((t = lookup_symbol_scope(table, name, scope)) != NULL) {
printf("error (line %ld): identifier %s previously declared in this scope, line %d.\n", line, name, t->line);
abort();
- exit(0);
+ exit(EXIT_SUCCESS);
}
return t;
}
Index: languages/cola/gen.c
===================================================================
--- languages/cola/gen.c (revision 19783)
+++ languages/cola/gen.c (working copy)
@@ -42,11 +42,11 @@
break;
default:
printf("Unknown AST statement type [%d].\n", p->asttype);
- exit(0);
+ exit(EXIT_SUCCESS);
}
else {
printf("Unknown AST kind or type at top level.\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
}
}
@@ -147,7 +147,7 @@
case ASTT_BREAK:
if (get_cur_primary_block() == NULL) {
printf("break statement not within loop or switch\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
printf("\tgoto %s\n", get_cur_primary_block()->end_label);
break;
@@ -155,7 +155,7 @@
if ((b = get_cur_primary_block()) == NULL
|| (b->asttype != ASTT_FOR && b->asttype != ASTT_WHILE)) {
printf("continue statement not within a loop\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
if (b->asttype == ASTT_WHILE)
printf("\tgoto %s\n", b->start_label);
@@ -169,13 +169,13 @@
case ASTT_RETURN:
if (cur_method == NULL) {
printf("return statement not within a method\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
if (cur_method->sym->type != t_void) {
if (p->arg1 == NULL) {
printf("ERROR: Method '%s' must return a value.\n",
cur_method->sym->name);
- exit(0);
+ exit(EXIT_SUCCESS);
}
if (!eval_expr(p->arg1))
gen_expr(p->arg1, NULL, cur_method->sym->type);
@@ -328,7 +328,7 @@
}
printf("#gen_assign: Internal error, unsupported assignment.\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
#if DEBUG
@@ -383,7 +383,7 @@
/* Expression has no operands */
if (p->arg1 == NULL && p->arg2 == NULL) {
printf("#gen_expr: no operands\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
/* Expression is a method call */
@@ -432,7 +432,7 @@
printf("%s:\n", tl3);
if (!p->arg1->targ || !p->arg2->targ) {
fprintf(stderr, "Error: ternary conditionals must generate rvalues to be a statement.\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
return;
}
@@ -459,11 +459,11 @@
#endif
if (type2 != t_int32) {
fprintf(stderr, "Array subscript expression must be type integer.\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
if (type1 != t_string) {
fprintf(stderr, "Index operators not yet implemented for non-string types.\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
if (p->targ == NULL)
p->targ = new_temp(type1);
@@ -577,7 +577,7 @@
gen_expr(p, NULL, NULL);
if (!p->targ) {
fprintf(stderr, "Internal compiler error: argument expression didn't generate an rvalue\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
if (p->next) {
gen_arg_list_expr(p->next);
@@ -597,7 +597,7 @@
printf("%s", NAME(p->targ));
else {
fprintf(stderr, "Internal compiler error: argument expression didn't generate an rvalue\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
if (p->next) {
printf(", ");
@@ -636,7 +636,7 @@
/* If caller wants a return value, method can't be void. */
fprintf(stderr, "ERROR: void function [%s] does not return a value.\n",
p->arg1->targ->name);
- exit(0);
+ exit(EXIT_SUCCESS);
}
}
else {
@@ -658,12 +658,12 @@
if (!p->Attr.Conditional.condition
|| p->Attr.Conditional.condition->kind != KIND_EXPR) {
fprintf(stderr, "gen_if: Null or invalid CONDITION node\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
if (!p->arg1) {
fprintf(stderr, "gen_if: Null THEN node\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
/* If Then Else */
@@ -792,7 +792,7 @@
case ASTT_COMPARISON:
if (!p->arg1 || !p->arg2) {
printf("#gen_boolean(comparison): Need 2 operands\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
if (!eval_expr(p->arg1))
gen_expr(p->arg1, NULL, NULL);
@@ -811,7 +811,7 @@
return;
default:
printf("#gen_boolean: Unknown boolean AST type(%d).\n", p->arg1->asttype);
- exit(0);
+ exit(EXIT_SUCCESS);
}
}
@@ -827,7 +827,7 @@
*t1 = t_float;
else {
printf("Can't coerce types (int, %s)\n", type_name(*t2));
- exit(0);
+ exit(EXIT_SUCCESS);
}
}
else if (*t1 == t_float) {
@@ -835,13 +835,13 @@
*t2 = t_float;
else {
printf("Can't coerce types (float, %s)\n", type_name(*t2));
- exit(0);
+ exit(EXIT_SUCCESS);
}
}
else {
printf("Unsupported type coercion requested (%s, %s).\n",
(*t1)->sym->name, (*t2)->sym->name);
- exit(0);
+ exit(EXIT_SUCCESS);
}
}
@@ -880,7 +880,7 @@
case LEFT_SHIFT: return "<<";
case RIGHT_SHIFT: return ">>";
default: printf("Invalid operator %d\n", operator);
- exit(0);
+ exit(EXIT_SUCCESS);
}
}
@@ -894,7 +894,7 @@
case LOGICAL_GTE: return '<';
}
printf("op_inverse: Invalid logical operator %d\n", operator);
- exit(0);
+ exit(EXIT_SUCCESS);
}
char * new_itemp() {
Index: languages/cola/type.c
===================================================================
--- languages/cola/type.c (revision 19783)
+++ languages/cola/type.c (working copy)
@@ -173,7 +173,7 @@
t = lookup_symbol(s->name);
if (!t) {
fprintf(stderr, "Error: identifier [%s] undeclared.\n", s->name);
- exit(0);
+ exit(EXIT_SUCCESS);
}
if (s != t) {
@@ -204,7 +204,7 @@
else {
fprintf(stderr, "Error: identifier [%s] has unknown type [%s].\n",
s->name, s->typename->name);
- exit(0);
+ exit(EXIT_SUCCESS);
}
}
Index: languages/cola/semant.c
===================================================================
--- languages/cola/semant.c (revision 19783)
+++ languages/cola/semant.c (working copy)
@@ -165,7 +165,7 @@
build_expr(c->arg2);
if (c->arg1->type != c->arg2->type) {
fprintf(stderr, "Error: expression types not equivalent in ternary expression\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
c->typename = c->arg1->typename;
c->type = c->arg1->type;
Index: languages/cola/parser.c
===================================================================
--- languages/cola/parser.c (revision 19783)
+++ languages/cola/parser.c (working copy)
@@ -1858,7 +1858,7 @@
Symbol *n, *t, *last = current_namespace;
if(lookup_type_symbol((yyvsp[(2) - (2)].sym))) {
printf("Error, redefinition of [%s]\n", (yyvsp[(2) - (2)].sym)->name);
- exit(0);
+ exit(EXIT_SUCCESS);
}
for(n = split(".", (yyvsp[(2) - (2)].sym)->name); n; n = n->tnext) {
n->kind = (yyvsp[(2) - (2)].sym)->kind;
@@ -2279,7 +2279,7 @@
{
(yyval.ast) = NULL;
printf("GOTO not supported yet.\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
break;
@@ -2352,7 +2352,7 @@
{
if((yyvsp[(3) - (9)].ast) == NULL) {
printf("for_statement: NULL init statement\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
(yyval.ast) = new_for((yyvsp[(3) - (9)].ast), (yyvsp[(5) - (9)].ast), (yyvsp[(7) - (9)].ast), (yyvsp[(9) - (9)].ast));
}
@@ -2530,7 +2530,7 @@
{
if((yyvsp[(1) - (4)].ast)->asttype != ASTT_IDENTIFIER) {
fprintf(stderr, "Error (line %d), method call must be a simple name or member access.\n", line);
- exit(0);
+ exit(EXIT_SUCCESS);
}
(yyval.ast) = new_expr(ASTT_METHOD_CALL, (yyvsp[(1) - (4)].ast), (yyvsp[(3) - (4)].ast));
#if DEBUG
@@ -2937,12 +2937,12 @@
if(argc > 1) {
if(!(yyin = fopen(argv[1], "r"))) {
printf( "Error reading source file %s.\n", argv[1] );
- exit(0);
+ exit(EXIT_SUCCESS);
}
}
else {
printf( "No source file specified.\n" );
- exit(0);
+ exit(EXIT_SUCCESS);
}
line = 1;
@@ -3008,7 +3008,7 @@
*/
fprintf(stderr, "(error) line %ld: %s\n", line, s );
fprintf(stderr, "Didn't create output asm.\n" );
- exit(0);
+ exit(EXIT_SUCCESS);
}
Index: examples/c/nanoparrot.c
===================================================================
--- examples/c/nanoparrot.c (revision 19783)
+++ examples/c/nanoparrot.c (working copy)
@@ -149,7 +149,7 @@
# define NEXT continue;
# define DONE return;
# define ENDDISPATCH default : printf("illegal instruction"); \
- exit(1); \
+ exit(EXIT_FAILURE) \
}}
# else /* CGOTO */
@@ -199,7 +199,7 @@
NEXT
CASE(MAX)
printf("illegal opcode\n");
- exit(1);
+ exit(EXIT_FAILURE);
NEXT
ENDDISPATCH
ENDRUN