chiark / gitweb /
Error handling: Fix messages resulting from bad directive arguments
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 26 Dec 2019 01:32:43 +0000 (01:32 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 30 Dec 2019 11:35:15 +0000 (11:35 +0000)
"Unknown directive" is not necessarily accurate; another possibility
is that the directive is known but didn't match the parsing regexp
because of problems with the arguments.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
generate

index 747a79b8441a740dedeb641886849111c5077c27..4a0450686c61e556227a1134bef5f3d114b7b277 100755 (executable)
--- a/generate
+++ b/generate
@@ -241,7 +241,7 @@ sub process_input_mk ($$$$) {
        } elsif (s#^\s*$esc\:(?=(-?)include|macro)##) {
            $buffering_output='';
        } elsif (m#^\s*$esc\:([a-z][-0-9a-z_]*)#) {
        } elsif (s#^\s*$esc\:(?=(-?)include|macro)##) {
            $buffering_output='';
        } elsif (m#^\s*$esc\:([a-z][-0-9a-z_]*)#) {
-           err "unknown directive &:$1";
+           err "unknown directive &:$1 or bad argumnt syntax";
        } elsif (s{^\s*${esc}TARGETS(?:_([0-9a-zA-Z_]+))?(?=\W)}{}) {
            my $t = $1 // 'all';
            od target_varname($var_prefix, $t);
        } elsif (s{^\s*${esc}TARGETS(?:_([0-9a-zA-Z_]+))?(?=\W)}{}) {
            my $t = $1 // 'all';
            od target_varname($var_prefix, $t);
@@ -311,7 +311,7 @@ sub process_input_mk ($$$$) {
                od "define $1\n";
                $push_nest->('macro', 1, '&:macro');
            } else {
                od "define $1\n";
                $push_nest->('macro', 1, '&:macro');
            } else {
-               die "internal error ($_?)";
+               err "bad directive argument syntax";
            }
        }
     }
            }
        }
     }