From fecccf83624c2f09207cd281f9efc272300e8e55 Mon Sep 17 00:00:00 2001 From: Elliott Baron Date: Mon, 20 Oct 2008 11:11:19 -0400 Subject: PR6851: Added support for %c printf conversion specifier [trying again] --- ChangeLog | 10 ++++++++++ elaborate.cxx | 7 ++++--- staptree.cxx | 10 +++++++++- staptree.h | 1 + testsuite/ChangeLog | 5 +++++ 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index de4e934b..ac29d2ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-10-20 Elliott Baron + + PR6851 + * elaborate.cxx (typeresolution_info::visit_print_format): add case + for conv_char. + * staptree.cxx (print_format::components_to_string): add case for + conv_char. + (print_format::string_to_components): add parsing for "c" conversion. + * staptree.h (enum conversion_type): add conv_char member. + 2008-10-17 Frank Ch. Eigler * stap-report: Add kernel config extracts. Generate to stdout. diff --git a/elaborate.cxx b/elaborate.cxx index 9f0a2a74..e4251f2a 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1439,17 +1439,17 @@ systemtap_session::print_error (const semantic_error& e) for (int i=0; i<2; i++) { stringstream message; - + message << "semantic error: " << e.what (); if (e.tok1 || e.tok2) message << ": "; - if (e.tok1) + if (e.tok1) { if (i == 0) print_token (message, e.tok1); else message << *e.tok1; } message << e.msg2; - if (e.tok2) + if (e.tok2) { if (i == 0) print_token (message, e.tok2); else message << *e.tok2; @@ -3903,6 +3903,7 @@ typeresolution_info::visit_print_format (print_format* e) case print_format::conv_unsigned_uppercase_hex: case print_format::conv_unsigned_lowercase_hex: case print_format::conv_binary: + case print_format::conv_char: case print_format::conv_memory: wanted = pe_long; break; diff --git a/staptree.cxx b/staptree.cxx index 73d6fe93..38166c54 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -458,6 +458,10 @@ print_format::components_to_string(vector const & components) oss << "b"; break; + case conv_char: + oss << "llc"; + break; + case conv_signed_decimal: oss << "lld"; break; @@ -635,7 +639,7 @@ print_format::string_to_components(string const & str) if (i == str.end()) break; - // Parse the actual conversion specifier (sdiouxX) + // Parse the actual conversion specifier (bcsmdioupxXn) switch (*i) { // Valid conversion types @@ -643,6 +647,10 @@ print_format::string_to_components(string const & str) curr.type = conv_binary; break; + case 'c': + curr.type = conv_char; + break; + case 's': curr.type = conv_string; break; diff --git a/staptree.h b/staptree.h index c35728cb..40be8e05 100644 --- a/staptree.h +++ b/staptree.h @@ -287,6 +287,7 @@ struct print_format: public expression conv_unsigned_uppercase_hex, conv_unsigned_lowercase_hex, conv_string, + conv_char, conv_memory, conv_literal, conv_binary, diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 1664f8c2..2ec0fb0e 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-10-20 Elliott Baron + + PR6851 + * systemtap.printf/char1.exp: New test. + 2008-10-10 Frank Ch. Eigler PR6749. -- cgit