diff options
author | jistone <jistone> | 2006-12-08 02:17:09 +0000 |
---|---|---|
committer | jistone <jistone> | 2006-12-08 02:17:09 +0000 |
commit | 16e8f21f336bcfc16a1174be8a8143668dbd0118 (patch) | |
tree | c967ecdec501b69910a16ee0f50317434ed49675 /parse.cxx | |
parent | e0d86324628566cedd055ed038fd487c12db676a (diff) | |
download | systemtap-steved-16e8f21f336bcfc16a1174be8a8143668dbd0118.tar.gz systemtap-steved-16e8f21f336bcfc16a1174be8a8143668dbd0118.tar.xz systemtap-steved-16e8f21f336bcfc16a1174be8a8143668dbd0118.zip |
2006-12-07 Josh Stone <joshua.i.stone@intel.com>
PR 3624.
* tapsets.cxx (struct be_derived_probe): Add a new priority parameter
for begin/end probes, and a comparison function for sorting.
(be_builder::build): Parse the priority & pass it to be_derived_probe.
(be_derived_probe_group::emit_module_init, emit_module_exit): Sort the
probe list by priority before emitting any code.
(register_standard_tapsets): Add new begin/end variants.
* parse.cxx (parser::parse_literal): Allow negative numeric literals,
by checking for a '-' unary operator right before a number.
testsuite/
* systemtap.base/be_order.exp, systemtap.base/be_order.stp,
semok/beginend.stp: New tests for begin/end priorities.
* lib/stap_run.exp: Anchor OUTPUT_CHECK_STRING to the end of output.
* systemtap.base/maxactive.exp: Fix to compare output to the end.
* systemtap.base/probefunc.exp: Ditto.
* systemtap.samples/ioblocktest.exp: Ditto.
* systemtap.samples/ioblocktest.stp: Ditto.
* systemtap.samples/tcptest.exp: Ditto.
Diffstat (limited to 'parse.cxx')
-rw-r--r-- | parse.cxx | 46 |
1 files changed, 29 insertions, 17 deletions
@@ -1277,25 +1277,37 @@ parser::parse_literal () literal* l; if (t->type == tok_string) l = new literal_string (t->content); - else if (t->type == tok_number) + else { - const char* startp = t->content.c_str (); - char* endp = (char*) startp; - - // NB: we allow controlled overflow from LLONG_MIN .. ULLONG_MAX - // Actually, this allows all the way from -ULLONG_MAX to ULLONG_MAX, - // since the lexer only gives us positive digit strings. - errno = 0; - long long value = (long long) strtoull (startp, & endp, 0); - if (errno == ERANGE || errno == EINVAL || *endp != '\0' - || (unsigned long long) value > 18446744073709551615ULL - || value < -9223372036854775807LL-1) - throw parse_error ("number invalid or out of range"); - - l = new literal_number (value); + bool neg = false; + if (t->type == tok_operator && t->content == "-") + { + neg = true; + t = next (); + } + + if (t->type == tok_number) + { + const char* startp = t->content.c_str (); + char* endp = (char*) startp; + + // NB: we allow controlled overflow from LLONG_MIN .. ULLONG_MAX + // Actually, this allows all the way from -ULLONG_MAX to ULLONG_MAX, + // since the lexer only gives us positive digit strings. + errno = 0; + long long value = (long long) strtoull (startp, & endp, 0); + if (neg) + value = -value; + if (errno == ERANGE || errno == EINVAL || *endp != '\0' + || (unsigned long long) value > 18446744073709551615ULL + || value < -9223372036854775807LL-1) + throw parse_error ("number invalid or out of range"); + + l = new literal_number (value); + } + else + throw parse_error ("expected literal string or number"); } - else - throw parse_error ("expected literal string or number"); l->tok = t; return l; |