Commit b21de4e7 authored by Peter Eisentraut's avatar Peter Eisentraut

ecpg: Split off mmfatal() from mmerror()

This allows decorating mmfatal() with noreturn compiler hints, leading
to better diagnostics.
parent 22967d80
......@@ -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;
......
......@@ -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
*/
......
......@@ -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 ']':
......
......@@ -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 *);
......
......@@ -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
......@@ -400,7 +400,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
<xc>{op_chars} { ECHO; }
<xc>\*+ { ECHO; }
<xc><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated /* comment"); }
<xc><<EOF>> { mmfatal(PARSE_ERROR, "unterminated /* comment"); }
<SQL>{xbstart} {
token_start = yytext;
......@@ -422,7 +422,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
<xb>{xbinside} { addlit(yytext, yyleng); }
<xh>{quotecontinue} |
<xb>{quotecontinue} { /* ignore */ }
<xb><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated bit string literal"); }
<xb><<EOF>> { mmfatal(PARSE_ERROR, "unterminated bit string literal"); }
<SQL>{xhstart} {
token_start = yytext;
......@@ -438,7 +438,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
return XCONST;
}
<xh><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated hexadecimal string literal"); }
<xh><<EOF>> { mmfatal(PARSE_ERROR, "unterminated hexadecimal string literal"); }
<SQL>{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]);
}
<xq,xqc,xe,xn,xus><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated quoted string"); }
<xq,xqc,xe,xn,xus><<EOF>> { mmfatal(PARSE_ERROR, "unterminated quoted string"); }
<SQL>{dolqfailed} {
/* throw back all but the initial "$" */
yyless(1);
......@@ -592,7 +592,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
}
<xd,xui>{xddouble} { addlitchar('"'); }
<xd,xui>{xdinside} { addlit(yytext, yyleng); }
<xd,xdc,xui><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "unterminated quoted identifier"); }
<xd,xdc,xui><<EOF>> { mmfatal(PARSE_ERROR, "unterminated quoted identifier"); }
<C,SQL>{xdstart} {
state_before = YYSTATE;
BEGIN(xdc);
......@@ -938,7 +938,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
BEGIN(C);
}
<undef>{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();
}
<C>{exec_sql}{include}{space}* { BEGIN(incl); }
......@@ -984,10 +984,10 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
}
<C,xskip>{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})*.
<C,xskip>{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})*.
}
<C,xskip>{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})*.
<xcond>{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})*.
}
<xcond>{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();
}
<def_ident>{identifier} {
......@@ -1133,7 +1133,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
startlit();
}
<def_ident>{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();
}
<def>{space}*";" {
......@@ -1166,7 +1166,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})(.*\\{space})*.
<incl>{dquote}{xdinside}{dquote}{space}*";"? { parse_include(); }
<incl>[^;\<\>\"]+";" { parse_include(); }
<incl>{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})*.
}
}
<INITIAL>{other}|\n { mmerror(PARSE_ERROR, ET_FATAL, "internal error: unreachable state; please report this to <pgsql-bugs@postgresql.org>"); }
<INITIAL>{other}|\n { mmfatal(PARSE_ERROR, "internal error: unreachable state; please report this to <pgsql-bugs@postgresql.org>"); }
%%
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 ));
......
......@@ -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)
......
......@@ -186,7 +186,7 @@ struct assignment
enum errortype
{
ET_WARNING, ET_ERROR, ET_FATAL
ET_WARNING, ET_ERROR
};
struct fetch_desc
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment