]> git.draconx.ca Git - cdecl99.git/commitdiff
libcdecl: Move another error message into the string table.
authorNick Bowler <nbowler@draconx.ca>
Tue, 9 Jan 2024 04:56:39 +0000 (23:56 -0500)
committerNick Bowler <nbowler@draconx.ca>
Tue, 9 Jan 2024 04:59:52 +0000 (23:59 -0500)
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.

src/errmsg.str
src/parse.y

index a0bb117bb17c6484c9493882a03c964e04ffa4d0..365e72f7fcf985381ae051175a43717949894f85 100644 (file)
@@ -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
index 03fa1395a6df02fa27f7ec864998c6251c143388..6d349f79ef1bc8537280c92066a349f0429ff20f 100644 (file)
 #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 | {