From b21de4e7b32f868a23bdc5507898d36cbe146164 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 12 Nov 2013 22:12:08 -0500 Subject: [PATCH] ecpg: Split off mmfatal() from mmerror() This allows decorating mmfatal() with noreturn compiler hints, leading to better diagnostics. --- src/interfaces/ecpg/preproc/descriptor.c | 4 +- src/interfaces/ecpg/preproc/ecpg.header | 47 ++++++++++++++++-------- src/interfaces/ecpg/preproc/ecpg.trailer | 2 +- src/interfaces/ecpg/preproc/extern.h | 6 +-- src/interfaces/ecpg/preproc/nls.mk | 4 +- src/interfaces/ecpg/preproc/pgc.l | 42 ++++++++++----------- src/interfaces/ecpg/preproc/type.c | 14 +++---- src/interfaces/ecpg/preproc/type.h | 2 +- src/interfaces/ecpg/preproc/variable.c | 36 +++++++++--------- 9 files changed, 85 insertions(+), 72 deletions(-) diff --git a/src/interfaces/ecpg/preproc/descriptor.c b/src/interfaces/ecpg/preproc/descriptor.c index 115cb17ddc..053a7afda8 100644 --- a/src/interfaces/ecpg/preproc/descriptor.c +++ b/src/interfaces/ecpg/preproc/descriptor.c @@ -274,7 +274,7 @@ output_set_descr(char *desc_name, char *index) case ECPGd_di_precision: case ECPGd_precision: case ECPGd_scale: - mmerror(PARSE_ERROR, ET_FATAL, "descriptor item \"%s\" is not implemented", + mmfatal(PARSE_ERROR, "descriptor item \"%s\" is not implemented", descriptor_item_name(results->value)); break; @@ -284,7 +284,7 @@ output_set_descr(char *desc_name, char *index) case ECPGd_octet: case ECPGd_ret_length: case ECPGd_ret_octet: - mmerror(PARSE_ERROR, ET_FATAL, "descriptor item \"%s\" cannot be set", + mmfatal(PARSE_ERROR, "descriptor item \"%s\" cannot be set", descriptor_item_name(results->value)); break; diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header index 88d9cf53c0..71b11f41e0 100644 --- a/src/interfaces/ecpg/preproc/ecpg.header +++ b/src/interfaces/ecpg/preproc/ecpg.header @@ -64,11 +64,9 @@ struct ECPGtype ecpg_query = {ECPGt_char_variable, NULL, NULL, NULL, {NULL}, 0}; /* * Handle parsing errors and warnings */ -void -mmerror(int error_code, enum errortype type, const char *error, ...) +static void __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 0))) +vmmerror(int error_code, enum errortype type, const char *error, va_list ap) { - va_list ap; - /* internationalize the error message string */ error = _(error); @@ -80,14 +78,11 @@ mmerror(int error_code, enum errortype type, const char *error, ...) fprintf(stderr, _("WARNING: ")); break; case ET_ERROR: - case ET_FATAL: fprintf(stderr, _("ERROR: ")); break; } - va_start(ap, error); vfprintf(stderr, error, ap); - va_end(ap); fprintf(stderr, "\n"); @@ -98,18 +93,38 @@ mmerror(int error_code, enum errortype type, const char *error, ...) case ET_ERROR: ret_value = error_code; break; - case ET_FATAL: - if (yyin) - fclose(yyin); - if (yyout) - fclose(yyout); - - if (strcmp(output_filename, "-") != 0 && unlink(output_filename) != 0) - fprintf(stderr, _("could not remove output file \"%s\"\n"), output_filename); - exit(error_code); } } +void +mmerror(int error_code, enum errortype type, const char *error, ...) +{ + va_list ap; + + va_start(ap, error); + vmmerror(error_code, type, error, ap); + va_end(ap); +} + +void +mmfatal(int error_code, const char *error, ...) +{ + va_list ap; + + va_start(ap, error); + vmmerror(error_code, ET_ERROR, error, ap); + va_end(ap); + + if (yyin) + fclose(yyin); + if (yyout) + fclose(yyout); + + if (strcmp(output_filename, "-") != 0 && unlink(output_filename) != 0) + fprintf(stderr, _("could not remove output file \"%s\"\n"), output_filename); + exit(error_code); +} + /* * string concatenation */ diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer b/src/interfaces/ecpg/preproc/ecpg.trailer index 58155ab660..342b7bc4d4 100644 --- a/src/interfaces/ecpg/preproc/ecpg.trailer +++ b/src/interfaces/ecpg/preproc/ecpg.trailer @@ -1687,7 +1687,7 @@ cvariable: CVARIABLE { case '[': if (brace) - mmerror(PARSE_ERROR, ET_FATAL, "multidimensional arrays for simple data types are not supported"); + mmfatal(PARSE_ERROR, "multidimensional arrays for simple data types are not supported"); brace_open++; break; case ']': diff --git a/src/interfaces/ecpg/preproc/extern.h b/src/interfaces/ecpg/preproc/extern.h index ccf5548f57..3bbb6a4473 100644 --- a/src/interfaces/ecpg/preproc/extern.h +++ b/src/interfaces/ecpg/preproc/extern.h @@ -73,10 +73,8 @@ extern int base_yylex(void); extern void base_yyerror(const char *); extern void *mm_alloc(size_t), *mm_realloc(void *, size_t); extern char *mm_strdup(const char *); -extern void -mmerror(int, enum errortype, const char *,...) -/* This extension allows gcc to check the format string */ -__attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4))); +extern void mmerror(int errorcode, enum errortype type, const char *error, ...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4))); +extern void mmfatal(int errorcode, const char *error, ...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3),noreturn)); extern void output_get_descr_header(char *); extern void output_get_descr(char *, char *); extern void output_set_descr_header(char *); diff --git a/src/interfaces/ecpg/preproc/nls.mk b/src/interfaces/ecpg/preproc/nls.mk index 38725a1658..91297a2323 100644 --- a/src/interfaces/ecpg/preproc/nls.mk +++ b/src/interfaces/ecpg/preproc/nls.mk @@ -2,5 +2,5 @@ CATALOG_NAME = ecpg AVAIL_LANGUAGES = cs de es fr it ja ko pl pt_BR ru tr zh_CN zh_TW GETTEXT_FILES = descriptor.c ecpg.c pgc.c preproc.c type.c variable.c -GETTEXT_TRIGGERS = mmerror:3 -GETTEXT_FLAGS = mmerror:3:c-format +GETTEXT_TRIGGERS = mmerror:3 mmfatal:2 +GETTEXT_FLAGS = mmerror:3:c-format mmfatal:2:c-format diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index 55b44ee286..24936ea935 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -400,7 +400,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. {op_chars} { ECHO; } \*+ { ECHO; } -<> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated /* comment"); } +<> { mmfatal(PARSE_ERROR, "unterminated /* comment"); } {xbstart} { token_start = yytext; @@ -422,7 +422,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. {xbinside} { addlit(yytext, yyleng); } {quotecontinue} | {quotecontinue} { /* ignore */ } -<> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated bit string literal"); } +<> { mmfatal(PARSE_ERROR, "unterminated bit string literal"); } {xhstart} { token_start = yytext; @@ -438,7 +438,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. return XCONST; } -<> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated hexadecimal string literal"); } +<> { mmfatal(PARSE_ERROR, "unterminated hexadecimal string literal"); } {xnstart} { /* National character. * Transfer it as-is to the backend. @@ -516,7 +516,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. /* This is only needed for \ just before EOF */ addlitchar(yytext[0]); } -<> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated quoted string"); } +<> { mmfatal(PARSE_ERROR, "unterminated quoted string"); } {dolqfailed} { /* throw back all but the initial "$" */ yyless(1); @@ -592,7 +592,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. } {xddouble} { addlitchar('"'); } {xdinside} { addlit(yytext, yyleng); } -<> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated quoted identifier"); } +<> { mmfatal(PARSE_ERROR, "unterminated quoted identifier"); } {xdstart} { state_before = YYSTATE; BEGIN(xdc); @@ -938,7 +938,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. BEGIN(C); } {other}|\n { - mmerror(PARSE_ERROR, ET_FATAL, "missing identifier in EXEC SQL UNDEF command"); + mmfatal(PARSE_ERROR, "missing identifier in EXEC SQL UNDEF command"); yyterminate(); } {exec_sql}{include}{space}* { BEGIN(incl); } @@ -984,10 +984,10 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. } {exec_sql}{elif}{space}* { /* pop stack */ if ( preproc_tos == 0 ) { - mmerror(PARSE_ERROR, ET_FATAL, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\""); + mmfatal(PARSE_ERROR, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\""); } else if ( stacked_if_value[preproc_tos].else_branch ) - mmerror(PARSE_ERROR, ET_FATAL, "missing \"EXEC SQL ENDIF;\""); + mmfatal(PARSE_ERROR, "missing \"EXEC SQL ENDIF;\""); else preproc_tos--; @@ -998,9 +998,9 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. if (INFORMIX_MODE) { if (preproc_tos == 0) - mmerror(PARSE_ERROR, ET_FATAL, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\""); + mmfatal(PARSE_ERROR, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\""); else if (stacked_if_value[preproc_tos].else_branch) - mmerror(PARSE_ERROR, ET_FATAL, "missing \"EXEC SQL ENDIF;\""); + mmfatal(PARSE_ERROR, "missing \"EXEC SQL ENDIF;\""); else preproc_tos--; @@ -1016,7 +1016,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. {exec_sql}{else}{space}*";" { /* only exec sql endif pops the stack, so take care of duplicated 'else' */ if (stacked_if_value[preproc_tos].else_branch) - mmerror(PARSE_ERROR, ET_FATAL, "more than one EXEC SQL ELSE"); + mmfatal(PARSE_ERROR, "more than one EXEC SQL ELSE"); else { stacked_if_value[preproc_tos].else_branch = TRUE; @@ -1035,7 +1035,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. if (INFORMIX_MODE) { if (stacked_if_value[preproc_tos].else_branch) - mmerror(PARSE_ERROR, ET_FATAL, "more than one EXEC SQL ELSE"); + mmfatal(PARSE_ERROR, "more than one EXEC SQL ELSE"); else { stacked_if_value[preproc_tos].else_branch = TRUE; @@ -1057,7 +1057,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. } {exec_sql}{endif}{space}*";" { if (preproc_tos == 0) - mmerror(PARSE_ERROR, ET_FATAL, "unmatched EXEC SQL ENDIF"); + mmfatal(PARSE_ERROR, "unmatched EXEC SQL ENDIF"); else preproc_tos--; @@ -1071,7 +1071,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. if (INFORMIX_MODE) { if (preproc_tos == 0) - mmerror(PARSE_ERROR, ET_FATAL, "unmatched EXEC SQL ENDIF"); + mmfatal(PARSE_ERROR, "unmatched EXEC SQL ENDIF"); else preproc_tos--; @@ -1091,7 +1091,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. {identifier}{space}*";" { if (preproc_tos >= MAX_NESTED_IF-1) - mmerror(PARSE_ERROR, ET_FATAL, "too many nested EXEC SQL IFDEF conditions"); + mmfatal(PARSE_ERROR, "too many nested EXEC SQL IFDEF conditions"); else { struct _defines *defptr; @@ -1124,7 +1124,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. } {other}|\n { - mmerror(PARSE_ERROR, ET_FATAL, "missing identifier in EXEC SQL IFDEF command"); + mmfatal(PARSE_ERROR, "missing identifier in EXEC SQL IFDEF command"); yyterminate(); } {identifier} { @@ -1133,7 +1133,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. startlit(); } {other}|\n { - mmerror(PARSE_ERROR, ET_FATAL, "missing identifier in EXEC SQL DEFINE command"); + mmfatal(PARSE_ERROR, "missing identifier in EXEC SQL DEFINE command"); yyterminate(); } {space}*";" { @@ -1166,7 +1166,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. {dquote}{xdinside}{dquote}{space}*";"? { parse_include(); } [^;\<\>\"]+";" { parse_include(); } {other}|\n { - mmerror(PARSE_ERROR, ET_FATAL, "syntax error in EXEC SQL INCLUDE command"); + mmfatal(PARSE_ERROR, "syntax error in EXEC SQL INCLUDE command"); yyterminate(); } @@ -1176,7 +1176,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. if ( preproc_tos > 0 ) { preproc_tos = 0; - mmerror(PARSE_ERROR, ET_FATAL, "missing \"EXEC SQL ENDIF;\""); + mmfatal(PARSE_ERROR, "missing \"EXEC SQL ENDIF;\""); } yyterminate(); } @@ -1215,7 +1215,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*. } } -{other}|\n { mmerror(PARSE_ERROR, ET_FATAL, "internal error: unreachable state; please report this to "); } +{other}|\n { mmfatal(PARSE_ERROR, "internal error: unreachable state; please report this to "); } %% void lex_init(void) @@ -1362,7 +1362,7 @@ parse_include(void) } } if (!yyin) - mmerror(NO_INCLUDE_FILE, ET_FATAL, "could not open include file \"%s\" on line %d", yytext, yylineno); + mmfatal(NO_INCLUDE_FILE, "could not open include file \"%s\" on line %d", yytext, yylineno); input_filename = mm_strdup(inc_file); yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE )); diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c index 5f0b20e2b1..28184b9f44 100644 --- a/src/interfaces/ecpg/preproc/type.c +++ b/src/interfaces/ecpg/preproc/type.c @@ -15,7 +15,7 @@ mm_alloc(size_t size) void *ptr = malloc(size); if (ptr == NULL) - mmerror(OUT_OF_MEMORY, ET_FATAL, "out of memory"); + mmfatal(OUT_OF_MEMORY, "out of memory"); return ptr; } @@ -27,7 +27,7 @@ mm_strdup(const char *string) char *new = strdup(string); if (new == NULL) - mmerror(OUT_OF_MEMORY, ET_FATAL, "out of memory"); + mmfatal(OUT_OF_MEMORY, "out of memory"); return new; } @@ -282,7 +282,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra { case ECPGt_array: if (indicator_set && ind_type->type != ECPGt_array) - mmerror(INDICATOR_NOT_ARRAY, ET_FATAL, "indicator for array/pointer has to be array/pointer"); + mmfatal(INDICATOR_NOT_ARRAY, "indicator for array/pointer has to be array/pointer"); switch (type->u.element->type) { case ECPGt_array: @@ -319,7 +319,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra break; case ECPGt_struct: if (indicator_set && ind_type->type != ECPGt_struct) - mmerror(INDICATOR_NOT_STRUCT, ET_FATAL, "indicator for struct has to be a struct"); + mmfatal(INDICATOR_NOT_STRUCT, "indicator for struct has to be a struct"); ECPGdump_a_struct(o, name, ind_name, mm_strdup("1"), type, ind_type, prefix, ind_prefix); break; @@ -328,7 +328,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra break; case ECPGt_char_variable: if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array)) - mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "indicator for simple data type has to be simple"); + mmfatal(INDICATOR_NOT_SIMPLE, "indicator for simple data type has to be simple"); ECPGdump_a_simple(o, name, type->type, mm_strdup("1"), (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : mm_strdup("1"), struct_sizeof, prefix, 0); if (ind_type != NULL) @@ -336,7 +336,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra break; case ECPGt_descriptor: if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array)) - mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "indicator for simple data type has to be simple"); + mmfatal(INDICATOR_NOT_SIMPLE, "indicator for simple data type has to be simple"); ECPGdump_a_simple(o, name, type->type, NULL, mm_strdup("-1"), NULL, prefix, 0); if (ind_type != NULL) @@ -344,7 +344,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra break; default: if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array)) - mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "indicator for simple data type has to be simple"); + mmfatal(INDICATOR_NOT_SIMPLE, "indicator for simple data type has to be simple"); ECPGdump_a_simple(o, name, type->type, type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : mm_strdup("-1"), struct_sizeof, prefix, type->counter); if (ind_type != NULL) diff --git a/src/interfaces/ecpg/preproc/type.h b/src/interfaces/ecpg/preproc/type.h index b7768fd661..cd0d1da8c4 100644 --- a/src/interfaces/ecpg/preproc/type.h +++ b/src/interfaces/ecpg/preproc/type.h @@ -186,7 +186,7 @@ struct assignment enum errortype { - ET_WARNING, ET_ERROR, ET_FATAL + ET_WARNING, ET_ERROR }; struct fetch_desc diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c index 6ff574bbd9..cc923a797b 100644 --- a/src/interfaces/ecpg/preproc/variable.c +++ b/src/interfaces/ecpg/preproc/variable.c @@ -86,7 +86,7 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member * members, in case '\0': /* found the end, but this time it has to be * an array element */ if (members->type->type != ECPGt_array) - mmerror(PARSE_ERROR, ET_FATAL, "incorrectly formed variable \"%s\"", name); + mmfatal(PARSE_ERROR, "incorrectly formed variable \"%s\"", name); switch (members->type->u.element->type) { @@ -113,7 +113,7 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member * members, in return (find_struct_member(name, end, members->type->u.members, brace_level)); break; default: - mmerror(PARSE_ERROR, ET_FATAL, "incorrectly formed variable \"%s\"", name); + mmfatal(PARSE_ERROR, "incorrectly formed variable \"%s\"", name); break; } } @@ -136,10 +136,10 @@ find_struct(char *name, char *next, char *end) if (c == '-') { if (p->type->type != ECPGt_array) - mmerror(PARSE_ERROR, ET_FATAL, "variable \"%s\" is not a pointer", name); + mmfatal(PARSE_ERROR, "variable \"%s\" is not a pointer", name); if (p->type->u.element->type != ECPGt_struct && p->type->u.element->type != ECPGt_union) - mmerror(PARSE_ERROR, ET_FATAL, "variable \"%s\" is not a pointer to a structure or a union", name); + mmfatal(PARSE_ERROR, "variable \"%s\" is not a pointer to a structure or a union", name); /* restore the name, we will need it later */ *next = c; @@ -151,7 +151,7 @@ find_struct(char *name, char *next, char *end) if (next == end) { if (p->type->type != ECPGt_struct && p->type->type != ECPGt_union) - mmerror(PARSE_ERROR, ET_FATAL, "variable \"%s\" is neither a structure nor a union", name); + mmfatal(PARSE_ERROR, "variable \"%s\" is neither a structure nor a union", name); /* restore the name, we will need it later */ *next = c; @@ -161,10 +161,10 @@ find_struct(char *name, char *next, char *end) else { if (p->type->type != ECPGt_array) - mmerror(PARSE_ERROR, ET_FATAL, "variable \"%s\" is not an array", name); + mmfatal(PARSE_ERROR, "variable \"%s\" is not an array", name); if (p->type->u.element->type != ECPGt_struct && p->type->u.element->type != ECPGt_union) - mmerror(PARSE_ERROR, ET_FATAL, "variable \"%s\" is not a pointer to a structure or a union", name); + mmfatal(PARSE_ERROR, "variable \"%s\" is not a pointer to a structure or a union", name); /* restore the name, we will need it later */ *next = c; @@ -230,7 +230,7 @@ find_variable(char *name) *next = '\0'; p = find_simple(name); if (p == NULL) - mmerror(PARSE_ERROR, ET_FATAL, "variable \"%s\" is not declared", name); + mmfatal(PARSE_ERROR, "variable \"%s\" is not declared", name); *next = c; switch (p->type->u.element->type) @@ -252,7 +252,7 @@ find_variable(char *name) p = find_simple(name); if (p == NULL) - mmerror(PARSE_ERROR, ET_FATAL, "variable \"%s\" is not declared", name); + mmfatal(PARSE_ERROR, "variable \"%s\" is not declared", name); return (p); } @@ -497,7 +497,7 @@ get_typedef(char *name) for (this = types; this && strcmp(this->name, name) != 0; this = this->next); if (!this) - mmerror(PARSE_ERROR, ET_FATAL, "unrecognized data type name \"%s\"", name); + mmfatal(PARSE_ERROR, "unrecognized data type name \"%s\"", name); return (this); } @@ -508,7 +508,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty if (atoi(type_index) >= 0) { if (atoi(*length) >= 0) - mmerror(PARSE_ERROR, ET_FATAL, "multidimensional arrays are not supported"); + mmfatal(PARSE_ERROR, "multidimensional arrays are not supported"); *length = type_index; } @@ -516,7 +516,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty if (atoi(type_dimension) >= 0) { if (atoi(*dimension) >= 0 && atoi(*length) >= 0) - mmerror(PARSE_ERROR, ET_FATAL, "multidimensional arrays are not supported"); + mmfatal(PARSE_ERROR, "multidimensional arrays are not supported"); if (atoi(*dimension) >= 0) *length = *dimension; @@ -525,18 +525,18 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty } if (pointer_len > 2) - mmerror(PARSE_ERROR, ET_FATAL, ngettext("multilevel pointers (more than 2 levels) are not supported; found %d level", + mmfatal(PARSE_ERROR, ngettext("multilevel pointers (more than 2 levels) are not supported; found %d level", "multilevel pointers (more than 2 levels) are not supported; found %d levels", pointer_len), pointer_len); if (pointer_len > 1 && type_enum != ECPGt_char && type_enum != ECPGt_unsigned_char && type_enum != ECPGt_string) - mmerror(PARSE_ERROR, ET_FATAL, "pointer to pointer is not supported for this data type"); + mmfatal(PARSE_ERROR, "pointer to pointer is not supported for this data type"); if (pointer_len > 1 && (atoi(*length) >= 0 || atoi(*dimension) >= 0)) - mmerror(PARSE_ERROR, ET_FATAL, "multidimensional arrays are not supported"); + mmfatal(PARSE_ERROR, "multidimensional arrays are not supported"); if (atoi(*length) >= 0 && atoi(*dimension) >= 0 && pointer_len) - mmerror(PARSE_ERROR, ET_FATAL, "multidimensional arrays are not supported"); + mmfatal(PARSE_ERROR, "multidimensional arrays are not supported"); switch (type_enum) { @@ -550,7 +550,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty } if (atoi(*length) >= 0) - mmerror(PARSE_ERROR, ET_FATAL, "multidimensional arrays for structures are not supported"); + mmfatal(PARSE_ERROR, "multidimensional arrays for structures are not supported"); break; case ECPGt_varchar: @@ -611,7 +611,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty } if (atoi(*length) >= 0) - mmerror(PARSE_ERROR, ET_FATAL, "multidimensional arrays for simple data types are not supported"); + mmfatal(PARSE_ERROR, "multidimensional arrays for simple data types are not supported"); break; } -- 2.40.0