]> sourceware.org Git - systemtap.git/commitdiff
undocumented, obfuscated, *evil* option to suppress -Werror during module building
authorPrzemysław Pawełczyk <przemyslaw@pawelczyk.it>
Sun, 7 Feb 2010 01:24:06 +0000 (20:24 -0500)
committerFrank Ch. Eigler <fche@elastic.org>
Sun, 7 Feb 2010 01:24:06 +0000 (20:24 -0500)
* session.h (omit_werror): New flag.
* buildrun.cxx (compile_pass): Use it.
* main.cxx (main): Set it.

buildrun.cxx
main.cxx
session.h

index 3091c51105172f3dd5da191e33c863daec468b0f..d6fc52ee28d0f41e4625eb20dc13d1c670cbb69b 100644 (file)
@@ -153,7 +153,7 @@ compile_pass (systemtap_session& s)
   o << "_KBUILD_CFLAGS := $(call flags,KBUILD_CFLAGS)" << endl;
 
   o << "stap_check_gcc = $(shell " << superverbose << " if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo \"$(1)\"; else echo \"$(2)\"; fi)" << endl;
-  o << "CHECK_BUILD := $(CC) $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(LINUXINCLUDE) $(_KBUILD_CFLAGS) $(CFLAGS_KERNEL) $(EXTRA_CFLAGS) $(CFLAGS) -DKBUILD_BASENAME=\\\"" << s.module_name << "\\\" -Werror -S -o /dev/null -xc " << endl;
+  o << "CHECK_BUILD := $(CC) $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(LINUXINCLUDE) $(_KBUILD_CFLAGS) $(CFLAGS_KERNEL) $(EXTRA_CFLAGS) $(CFLAGS) -DKBUILD_BASENAME=\\\"" << s.module_name << "\\\"" << (s.omit_werror ? "" : " -Werror") << " -S -o /dev/null -xc " << endl;
   o << "stap_check_build = $(shell " << superverbose << " if $(CHECK_BUILD) $(1) " << redirecterrors << " ; then echo \"$(2)\"; else echo \"$(3)\"; fi)" << endl;
 
   o << "SYSTEMTAP_RUNTIME = \"" << s.runtime_path << "\"" << endl;
@@ -251,7 +251,7 @@ compile_pass (systemtap_session& s)
   o << "EXTRA_CFLAGS += $(call cc-option,-Wframe-larger-than=600)" << endl;
 
   // Assumes linux 2.6 kbuild
-  o << "EXTRA_CFLAGS += -Wno-unused -Werror" << endl;
+  o << "EXTRA_CFLAGS += -Wno-unused" << (s.omit_werror ? "" : " -Werror") << endl;
   #if CHECK_POINTER_ARITH_PR5947
   o << "EXTRA_CFLAGS += -Wpointer-arith" << endl;
   #endif
@@ -494,7 +494,7 @@ make_tracequery(systemtap_session& s, string& name,
   string makefile(dir + "/Makefile");
   ofstream omf(makefile.c_str());
   // force debuginfo generation, and relax implicit functions
-  omf << "EXTRA_CFLAGS := -g -Wno-implicit-function-declaration -Werror" << endl;
+  omf << "EXTRA_CFLAGS := -g -Wno-implicit-function-declaration" << (s.omit_werror ? "" : " -Werror") << endl;
   omf << "obj-m := " + basename + ".o" << endl;
   omf.close();
 
index 0126f3231025cf420ede9c3d116191699ae01502..8f5ee72e505a5d30bf158888f718007e1ed745ce 100644 (file)
--- a/main.cxx
+++ b/main.cxx
@@ -532,6 +532,7 @@ main (int argc, char * const argv [])
   s.load_only = false;
   s.skip_badvars = false;
   s.unprivileged = false;
+  s.omit_werror = false;
   bool client_options = false;
   string client_options_disallowed;
 
@@ -616,7 +617,8 @@ main (int argc, char * const argv [])
 #define LONG_OPT_VERBOSE_PASS 5
 #define LONG_OPT_SKIP_BADVARS 6
 #define LONG_OPT_UNPRIVILEGED 7
-#define LONG_OPT_CLIENT_OPTIONS 8
+#define LONG_OPT_OMIT_WERROR 8
+#define LONG_OPT_CLIENT_OPTIONS 9
       // 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 },
@@ -626,6 +628,13 @@ main (int argc, char * const argv [])
        { "skip-badvars", 0, &long_opt, LONG_OPT_SKIP_BADVARS },
         { "vp", 1, &long_opt, LONG_OPT_VERBOSE_PASS },
         { "unprivileged", 0, &long_opt, LONG_OPT_UNPRIVILEGED },
+#define OWE5 "tter"
+#define OWE1 "uild-"
+#define OWE6 "fu-kb"
+#define OWE2 "i-kno"
+#define OWE4 "st"
+#define OWE3 "w-be"
+        { OWE4 OWE6 OWE1 OWE2 OWE3 OWE5, 0, &long_opt, LONG_OPT_OMIT_WERROR },
         { "client-options", 0, &long_opt, LONG_OPT_CLIENT_OPTIONS },
         { NULL, 0, NULL, 0 }
       };
@@ -909,6 +918,9 @@ main (int argc, char * const argv [])
               /* NB: for server security, it is essential that once this flag is
                  set, no future flag be able to unset it. */
              break;
+           case LONG_OPT_OMIT_WERROR:
+             s.omit_werror = true;
+             break;
            case LONG_OPT_CLIENT_OPTIONS:
              client_options = true;
              break;
index df3aae41a66e1adccfe504fe81ad3398cf7b9ffd..d43b1f21ddd199b0d2dac63dd6a861f40901c0f4 100644 (file)
--- a/session.h
+++ b/session.h
@@ -118,6 +118,7 @@ struct systemtap_session
   bool need_uprobes;
   bool load_only; // flight recorder mode
   bool unprivileged;
+  bool omit_werror;
 
   // NB: It is very important for all of the above (and below) fields
   // to be cleared in the systemtap_session ctor (elaborate.cxx)
This page took 0.0346 seconds and 5 git commands to generate.