This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH] Support OR (using ||) in preprocessor's conditions.
- From: Przemyslaw Pawelczyk <przemyslaw at pawelczyk dot it>
- To: systemtap at sourceware dot org
- Date: Sat, 20 Jun 2009 01:55:07 +0200
- Subject: [PATCH] Support OR (using ||) in preprocessor's conditions.
- Mail-from: cfd3851190942c765810b8316caa23486871fb77 Mon Sep 17 00:00:00 2001
---
parse.cxx | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/parse.cxx b/parse.cxx
index a26d594..52712bd 100644
--- a/parse.cxx
+++ b/parse.cxx
@@ -337,11 +337,27 @@ parser::scan_pp (bool wildcard)
delete op;
delete r;
+ const token *n;
+ while ((n = input.scan ()) && n->type == tok_operator && n->content == "||")
+ {
+ l = input.scan (false);
+ op = input.scan (false);
+ r = input.scan (false);
+ if (l == 0 || op == 0 || r == 0)
+ throw parse_error ("incomplete condition after '%('", t);
+
+ result |= eval_pp_conditional (session, l, op, r);
+ delete l;
+ delete op;
+ delete r;
+ delete n;
+ }
+
/*
clog << "PP eval (" << *t << ") == " << result << endl;
*/
- const token *m = input.scan (); // NB: not recursive
+ const token *m = n; // NB: not recursive
if (! (m && m->type == tok_operator && m->content == "%?"))
throw parse_error ("expected '%?' marker for conditional", t);
delete m; // "%?"
--
1.5.6.5