This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug translator/10747] preprocessor permits invalid construct
- From: "wenji dot huang at oracle dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sources dot redhat dot com
- Date: 12 Oct 2009 09:23:38 -0000
- Subject: [Bug translator/10747] preprocessor permits invalid construct
- References: <20091008134335.10747.fche@redhat.com>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From wenji dot huang at oracle dot com 2009-10-12 09:23 -------
In fact, there will be error reported when executing
$ stap -e 'probe begin{ a = %( 1 == 0 %? yes %? no %)}'
parse error: expected literal string or number
saw: operator '}' at <input>:1:43
source: probe begin{ a = %( 1 == 0 %? yes %? no %)}
^
1 parse error(s).
Pass 1: parse failed. Try again with another '--vp 1' option.
but, maybe more accurate message is better, like
$ stap -e 'probe begin{ a = %( 1 == 0 %? yes %? no %)}'
parse error: incomplete conditional - missing '%('
at: operator '%?' at <input>:1:35
source: probe begin{ a = %( 1 == 0 %? yes %? no %)}
^
parse error: expected statement
saw: <input> EOF
2 parse error(s).
Pass 1: parse failed. Try again with another '--vp 1' option.
This can be reached by the following patch.
diff --git a/parse.cxx b/parse.cxx
index b88ef7f..2ae8c68 100644
--- a/parse.cxx
+++ b/parse.cxx
@@ -394,6 +394,8 @@ parser::scan_pp (bool wildcard)
if (m && m->type == tok_operator && m->content == "%(") // nested %(
nesting ++;
+ if (m && m->type == tok_operator && m->content == "%?" && !nesting)
+ throw parse_error ("incomplete conditional - missing '%('", m);
if (nesting == 0 && m && (m->type == tok_operator && (m->content ==
"%:" || // ELSE
m->content ==
"%)"))) // END
break;
--
http://sourceware.org/bugzilla/show_bug.cgi?id=10747
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.