Replace all exit() with SWIG_exit()
For consistent cleanup on error
This commit is contained in:
parent
b36ae64185
commit
2cf075558c
11 changed files with 24 additions and 24 deletions
|
|
@ -1779,7 +1779,7 @@ declaration : swig_directive { $$ = $1; }
|
|||
} else {
|
||||
Swig_error(cparse_file, cparse_line, "Syntax error in input(1).\n");
|
||||
}
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
/* Out of class constructor/destructor declarations */
|
||||
| c_constructor_decl {
|
||||
|
|
@ -3359,7 +3359,7 @@ c_decl_tail : SEMI {
|
|||
} else {
|
||||
Swig_error(cparse_file, cparse_line, "Syntax error - possibly a missing semicolon.\n");
|
||||
}
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
@ -3649,7 +3649,7 @@ c_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end {
|
|||
}
|
||||
if (err) {
|
||||
Swig_error(cparse_file,cparse_line,"Syntax error in input(2).\n");
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
|
@ -4632,7 +4632,7 @@ cpp_members : cpp_member cpp_members {
|
|||
int start_line = cparse_line;
|
||||
skip_decl();
|
||||
Swig_error(cparse_file,start_line,"Syntax error in input(3).\n");
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
} cpp_members {
|
||||
$$ = $3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ public:
|
|||
if (goops) {
|
||||
if (linkage != GUILE_LSTYLE_PASSIVE && linkage != GUILE_LSTYLE_MODULE) {
|
||||
Printf(stderr, "guile: GOOPS support requires passive or module linkage\n");
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1223,7 +1223,7 @@ public:
|
|||
/* FIXME: How should this be handled? The rest of SWIG just seems
|
||||
* to not bother checking for malloc failing! */
|
||||
fprintf(stderr, "Malloc failed!\n");
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
for (i = 0; i < max_num_of_arguments; ++i) {
|
||||
arg_names[i] = NULL;
|
||||
|
|
@ -1235,7 +1235,7 @@ public:
|
|||
/* FIXME: How should this be handled? The rest of SWIG just seems
|
||||
* to not bother checking for malloc failing! */
|
||||
fprintf(stderr, "Malloc failed!\n");
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
for (i = 0; i < max_num_of_arguments; ++i) {
|
||||
arg_values[i] = NULL;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
#include "cparse.h"
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include "pydoc.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
|
|
|||
|
|
@ -371,7 +371,6 @@ struct TargetLanguageModule {
|
|||
int SWIG_main(int argc, char *argv[], const TargetLanguageModule *tlm);
|
||||
void emit_parameter_variables(ParmList *l, Wrapper *f);
|
||||
void emit_return_variable(Node *n, SwigType *rt, Wrapper *f);
|
||||
void SWIG_exit(int); /* use EXIT_{SUCCESS,FAILURE} */
|
||||
void SWIG_config_file(const_String_or_char_ptr );
|
||||
const String *SWIG_output_directory();
|
||||
void SWIG_config_cppext(const char *ext);
|
||||
|
|
|
|||
|
|
@ -961,7 +961,7 @@ class TypePass:private Dispatcher {
|
|||
if (Getattr(c, "sym:overloaded") != checkoverloaded) {
|
||||
Printf(stdout, "sym:overloaded error c:%p checkoverloaded:%p\n", c, checkoverloaded);
|
||||
Swig_print_node(c);
|
||||
exit (1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
String *decl = Strcmp(nodeType(c), "using") == 0 ? NewString("------") : Getattr(c, "decl");
|
||||
|
|
@ -969,7 +969,7 @@ class TypePass:private Dispatcher {
|
|||
if (!Getattr(c, "sym:overloaded")) {
|
||||
Printf(stdout, "sym:overloaded error.....%p\n", c);
|
||||
Swig_print_node(c);
|
||||
exit (1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
c = Getattr(c, "sym:nextSibling");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
* sure there are no unmarked options.
|
||||
*
|
||||
* TODO:
|
||||
* - This module needs to be modified so that it doesn't call exit().
|
||||
* Should have cleaner error handling in general.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
|
@ -88,11 +87,11 @@ void Swig_check_options(int check_input) {
|
|||
}
|
||||
if (error) {
|
||||
Printf(stderr, "Use 'swig -help' for available options.\n");
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
if (check_input && marked[numargs - 1]) {
|
||||
Printf(stderr, "Must specify an input file. Use -help for available options.\n");
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -105,5 +104,5 @@ void Swig_check_options(int check_input) {
|
|||
void Swig_arg_error(void) {
|
||||
Printf(stderr, "SWIG : Unable to parse command line options.\n");
|
||||
Printf(stderr, "Use 'swig -help' for available options.\n");
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1177,7 +1177,7 @@ String *Swig_string_command(String *s) {
|
|||
pclose(fp);
|
||||
} else {
|
||||
Swig_error("SWIG", Getline(s), "Command encoder fails attempting '%s'.\n", s);
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1327,7 +1327,8 @@ static int split_regex_pattern_subst(String *s, String **pattern, String **subst
|
|||
|
||||
err_out:
|
||||
Swig_error("SWIG", Getline(s), "Invalid regex substitution: '%s'.\n", s);
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This function copies len characters from src to dst, possibly applying case conversions to them: if convertCase is 1, to upper case and if it is -1, to lower
|
||||
|
|
@ -1449,7 +1450,7 @@ String *Swig_string_regex(String *s) {
|
|||
if (!compiled_pat) {
|
||||
Swig_error("SWIG", Getline(s), "PCRE compilation failed: '%s' in '%s':%i.\n",
|
||||
pcre_error, Char(pattern), pcre_errorpos);
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
rc = pcre_exec(compiled_pat, NULL, input, (int)strlen(input), 0, 0, captures, 30);
|
||||
if (rc >= 0) {
|
||||
|
|
@ -1457,7 +1458,7 @@ String *Swig_string_regex(String *s) {
|
|||
} else if (rc != PCRE_ERROR_NOMATCH) {
|
||||
Swig_error("SWIG", Getline(s), "PCRE execution failed: error %d while matching \"%s\" using \"%s\".\n",
|
||||
rc, Char(pattern), input);
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1475,7 +1476,8 @@ String *Swig_pcre_version(void) {
|
|||
|
||||
String *Swig_string_regex(String *s) {
|
||||
Swig_error("SWIG", Getline(s), "PCRE regex support not enabled in this SWIG build.\n");
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
String *Swig_pcre_version(void) {
|
||||
|
|
|
|||
|
|
@ -1105,7 +1105,7 @@ static int name_regexmatch_value(Node *n, String *pattern, String *s) {
|
|||
Swig_error("SWIG", Getline(n),
|
||||
"Invalid regex \"%s\": compilation failed at %d: %s\n",
|
||||
Char(pattern), errpos, err);
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
rc = pcre_exec(compiled_pat, NULL, Char(s), Len(s), 0, 0, NULL, 0);
|
||||
|
|
@ -1118,7 +1118,7 @@ static int name_regexmatch_value(Node *n, String *pattern, String *s) {
|
|||
Swig_error("SWIG", Getline(n),
|
||||
"Matching \"%s\" against regex \"%s\" failed: %d\n",
|
||||
Char(s), Char(pattern), rc);
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
@ -1131,7 +1131,7 @@ static int name_regexmatch_value(Node *n, String *pattern, String *s) {
|
|||
(void)s;
|
||||
Swig_error("SWIG", Getline(n),
|
||||
"PCRE regex matching is not available in this SWIG build.\n");
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
#endif /* HAVE_PCRE/!HAVE_PCRE */
|
||||
|
|
|
|||
|
|
@ -833,7 +833,7 @@ static int look(Scanner *s) {
|
|||
return SWIG_TOKEN_MODEQUAL;
|
||||
} else if (c == '}') {
|
||||
Swig_error(cparse_file, cparse_line, "Syntax error. Extraneous '%%}'\n");
|
||||
exit(1);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
} else {
|
||||
retract(s, 1);
|
||||
return SWIG_TOKEN_PERCENT;
|
||||
|
|
|
|||
|
|
@ -438,6 +438,7 @@ extern int ParmList_is_compactdefargs(ParmList *p);
|
|||
extern void Language_replace_special_variables(String *method, String *tm, Parm *parm);
|
||||
extern void Swig_print(DOH *object, int count);
|
||||
extern void Swig_print_with_location(DOH *object, int count);
|
||||
extern void SWIG_exit(int exit_code);
|
||||
|
||||
|
||||
/* -- template init -- */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue