diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-10-02 16:34:08 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-10-02 16:34:08 +0300 |
commit | 26f33cd3d334c4ac8044dfb49785414ed59cc254 (patch) | |
tree | 0d9f1147713e059279a83bb4ac0ba7c74087aa9b | |
parent | f019b1fe50cce4e9f890613ab19bbf17fa5a22e1 (diff) | |
download | mailfromd-26f33cd3d334c4ac8044dfb49785414ed59cc254.tar.gz mailfromd-26f33cd3d334c4ac8044dfb49785414ed59cc254.tar.bz2 |
Treat unquoted literals as errors.
* mfd/gram.y: Treat unquoted literals as errors.
* doc/mailfromd.texi: Comment out the description of
unquoted literals and add a FIXME.
-rw-r--r-- | doc/mailfromd.texi | 3 | ||||
-rw-r--r-- | mfd/gram.y | 18 |
2 files changed, 8 insertions, 13 deletions
diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi index 6f82657b..35ec60a2 100644 --- a/doc/mailfromd.texi +++ b/doc/mailfromd.texi @@ -3662,6 +3662,7 @@ echo toupper("some" "thing") @result{} "SOMETHING" echo toupper("some") "thing" @result{} "SOMEthing" @end smallexample +@FIXME{This is no longer the case: Quoteless literals (@pxref{Literals}) are yet another dangerous feature. Just as the features mentioned above, it stems from the good old days when @acronym{MFL} was small and sweet and using @@ -3724,7 +3725,7 @@ to place quotes around the suspicious string, if it is intended to be used as a literal, or to require the corresponding module (@pxref{Modules}) (or include the source file directly, @pxref{include}), if it is indeed a function name. - +} Another place to execute special caution are format strings used with @code{sprintf} (@pxref{String formatting}) and @code{strftime} (@pxref{strftime}) functions. They use @samp{%} as a character @@ -87,10 +87,6 @@ enum lexical_context outer_context, inner_context; size_t catch_nesting; /* Nesting level for catch statements */ -/* Controls whether unquoted strings are warned about. Normally it is off - within a `when .*:' construct. */ -static int allow_unquoted_strings; - static struct stmtlist genstmt; /* List of generated statements */ /* State handlers and their positional parameters */ @@ -1399,9 +1395,8 @@ value : T_STRING if (value_ptr) $$ = *value_ptr; else { - if (!allow_unquoted_strings) - parse_warning(_("unquoted identifier `%s'"), - $1->text); + parse_error(_("unquoted identifier `%s'"), + $1->text); $$.type = dtype_string; $$.v.literal = $1; } @@ -2310,12 +2305,11 @@ branches : branch } ; -branch : T_WHEN { allow_unquoted_strings = 1; } valist ':' - { allow_unquoted_strings = 0; } stmtlist +branch : T_WHEN valist ':' stmtlist { struct valist *p; - for (p = $3.head; p; p = p->next) { + for (p = $2.head; p; p = p->next) { if (p->value.type == dtype_string) { parse_error("Invalid data type, expected number."); /* Try to continue */ @@ -2327,8 +2321,8 @@ branch : T_WHEN { allow_unquoted_strings = 1; } valist ':' $$ = xmalloc(sizeof *$$); $$->next = NULL; $$->locus = $1; - $$->valist = $3.head; - $$->node = $6.head; + $$->valist = $2.head; + $$->node = $4.head; } ; |