From db135493669e5e2e1d0dc5c30c8d4a38bfd6653f Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 8 Apr 2010 17:15:49 -0400 Subject: PR11343: backward compatibility option/conditional * main.cxx: Add "--compatible=VERSION" option. * session.h (compatible): Store it. * parse.cxx (eval_pp_conditional): Look at it as %( systemtap_v CMP VALUE ... %) * stap.1.in: Document it. * testsuite/parseko/preprocess17.stp, parseok/twenty.stp: Test it. --- main.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'main.cxx') diff --git a/main.cxx b/main.cxx index 06f9c296..28d3bc8a 100644 --- a/main.cxx +++ b/main.cxx @@ -152,6 +152,9 @@ usage (systemtap_session& s, int exitcode) #endif // Formerly present --ignore-{vmlinux,dwarf} options are for testsuite use // only, and don't belong in the eyesight of a plain user. + << " --compatible=VERSION" << endl + << " suppress incompatible language/tapset changes beyond VERSION," << endl + << " instead of " << s.compatible << endl << " --skip-badvars" << endl << " substitute zero for bad context $variables" << endl << endl @@ -609,6 +612,7 @@ main (int argc, char * const argv []) s.skip_badvars = false; s.unprivileged = false; s.omit_werror = false; + s.compatible = VERSION; // XXX: perhaps also process GIT_SHAID if available? bool client_options = false; string client_options_disallowed; @@ -699,6 +703,7 @@ main (int argc, char * const argv []) #define LONG_OPT_DISABLE_CACHE 11 #define LONG_OPT_POISON_CACHE 12 #define LONG_OPT_CLEAN_CACHE 13 +#define LONG_OPT_COMPATIBLE 14 // NB: also see find_hash(), usage(), switch stmt below, stap.1 man page static struct option long_options[] = { { "kelf", 0, &long_opt, LONG_OPT_KELF }, @@ -720,6 +725,7 @@ main (int argc, char * const argv []) { "disable-cache", 0, &long_opt, LONG_OPT_DISABLE_CACHE }, { "poison-cache", 0, &long_opt, LONG_OPT_POISON_CACHE }, { "clean-cache", 0, &long_opt, LONG_OPT_CLEAN_CACHE }, + { "compatible", 1, &long_opt, LONG_OPT_COMPATIBLE }, { NULL, 0, NULL, 0 } }; int grc = getopt_long (argc, argv, "hVvtp:I:e:o:R:r:a:m:kgPc:x:D:bs:uqwl:d:L:FS:B:W", @@ -1038,12 +1044,20 @@ main (int argc, char * const argv []) clean_cache(s); exit(0); + case LONG_OPT_COMPATIBLE: + s.compatible = optarg; + break; + default: + // NOTREACHED unless one added a getopt option but not a corresponding switch/case: + cerr << "Unhandled long argument id " << long_opt << endl; exit(1); } break; default: + // NOTREACHED unless one added a getopt option but not a corresponding switch/case: + cerr << "Unhandled argument code " << (char)grc << endl; exit(1); break; } -- cgit