]> git.tdb.fi Git - builder.git/blobdiff - source/builder.cpp
Make warnings configurable through build_info and command line
[builder.git] / source / builder.cpp
index e4f7e580f9a1b15fdf2a52eba51d777884f54099..147371cd22519524683df31378fc0b6597d118f7 100644 (file)
@@ -59,6 +59,7 @@ Builder::Builder(int argc, char **argv):
        string   work_dir;
        bool     full_paths=false;
        unsigned max_depth=5;
+       StringList cmdline_warn;
 
        GetOpt getopt;
        getopt.add_option('a', "analyze",    analyze_mode, GetOpt::REQUIRED_ARG);
@@ -80,6 +81,7 @@ Builder::Builder(int argc, char **argv):
        //getopt.add_option(     "makefile",   create_makefile, GetOpt::NO_ARG);
        getopt.add_option(     "max-depth",  max_depth,    GetOpt::REQUIRED_ARG);
        getopt.add_option(     "prefix",     prefix,       GetOpt::REQUIRED_ARG);
+       getopt.add_option(     "warnings",   cmdline_warn, GetOpt::REQUIRED_ARG);
        getopt(argc, argv);
 
        if(!analyze_mode.empty())
@@ -137,6 +139,17 @@ Builder::Builder(int argc, char **argv):
                else
                        prefix=(get_home_dir()/"local"/current_arch).str();
        }
+
+       warnings.push_back("all");
+       warnings.push_back("extra");
+       warnings.push_back("shadow");
+       warnings.push_back("pointer-arith");
+       warnings.push_back("error");
+       for(StringList::iterator i=cmdline_warn.begin(); i!=cmdline_warn.end(); ++i)
+       {
+               vector<string> warns=split(*i, ',');
+               warnings.insert(warnings.end(), warns.begin(), warns.end());
+       }
 }
 
 /**
@@ -447,7 +460,7 @@ void Builder::usage(const char *reason, const char *argv0, bool brief)
                cerr<<reason<<'\n';
 
        if(brief)
-               cerr<<"Usage: "<<argv0<<" [-a|--analyze MODE] [-b|--build] [-c|--clean] [-f|--file FILE] [-h|--help] [-j|--jobs NUM] [-n||--dry-run] [-v|--verbose] [-A|--conf-all] [-B|--build-all] [-C|--chdir DIRECTORY] [-W|--what-if FILE] [--chrome] [--conf-only] [--full-paths] [--max-depth NUM] [<target> ...]";
+               cerr<<"Usage: "<<argv0<<" [-a|--analyze MODE] [-b|--build] [-c|--clean] [-f|--file FILE] [-h|--help] [-j|--jobs NUM] [-n||--dry-run] [-v|--verbose] [-A|--conf-all] [-B|--build-all] [-C|--chdir DIRECTORY] [-W|--what-if FILE] [--chrome] [--conf-only] [--full-paths] [--max-depth NUM] [<target> ...]\n";
        else
        {
                cerr<<
@@ -467,10 +480,13 @@ void Builder::usage(const char *reason, const char *argv0, bool brief)
                        "  -C, --chdir DIR     Change to DIR before doing anything else.\n"
                        "  -P, --progress      Display progress while building.\n"
                        "  -W, --what-if FILE  Pretend that FILE has changed.\n"
+                       "  --arch ARCH         Architecture to build for.\n"
                        "  --conf-only         Stop after configuring packages.\n"
                        "  --full-paths        Output full paths in analysis.\n"
                        //"  --makefile          Create a makefile for this package.\n"
-                       "  --max-depth NUM     Maximum depth to show in analysis.\n";
+                       "  --max-depth NUM     Maximum depth to show in analysis.\n"
+                       "  --prefix DIR        Directory to install things to.\n"
+                       "  --warnings LIST     Compiler warnings to use.\n";
        }
 }