From: Nick Bowler Date: Tue, 9 Jan 2024 04:56:39 +0000 (-0500) Subject: libcdecl: Move another error message into the string table. X-Git-Tag: v1.3~40 X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/commitdiff_plain/4423b55b49e402ca3ac13a6430c23a6629da9bf4 libcdecl: Move another error message into the string table. The "array length must be positive" error message seems to have been missed when all the error messages were combined, so let's move it in now for a modest size reduction. --- diff --git a/src/errmsg.str b/src/errmsg.str index a0bb117..365e72f 100644 --- a/src/errmsg.str +++ b/src/errmsg.str @@ -19,3 +19,4 @@ &CDECL__EDECLTYPE mixing type names and declarations is not allowed &CDECL__ERANGE integer constant out of range &CDECL__EBADINT invalid integer constant +&CDECL__EZEROARRAY array length must be positive diff --git a/src/parse.y b/src/parse.y index 03fa139..6d349f7 100644 --- a/src/parse.y +++ b/src/parse.y @@ -36,11 +36,6 @@ #include "cdecl-internal.h" #include "errmsg.h" -#define FAIL(msg) do { \ - yyerror(&yylloc, NULL, NULL, msg); \ - YYERROR; \ -} while (0) - /* * Allocate a parse tree node via cdecl__alloc_item. * @@ -593,8 +588,10 @@ english_array: T_VLA T_ARRAY english_vla T_OF { array_length: { $$ = 0; } array_length: T_UINT { - if (!($$ = $1)) - FAIL(_("array length must be positive")); + if (!($$ = $1)) { + cdecl__errmsg(CDECL__EZEROARRAY); + YYERROR; + } } english_vla: T_IDENT | {