I've most of the way through a v3 of the patch kit, but given the ongoing discussion/review on this mailing list, I thought I'd post what I have so far.
I'm going to work on squashing the changes, to produce a v3 relative to trunk. This drops the "in-tree plugin" idea, and the auto_client_timevar, but in the meantime here are the changes relative to the branch. I've rebased from r278495 (2019-11-20) to r279013 (2019-12-05). Patch 1 contains the only change needed by the rebase. Patch 2 contains the fixups *relative to the analyzer branch* to convert it from being an in-tree plugin to being built into gcc, with an opt-out configure option (--disable-analyzer). Changes include: * I kept the new source files in the new "gcc/analyzer" subdirectory, although they're still built by gcc/Makefile.in - we have a huge number of source files in the "gcc" subdir, and we already have subdirs that complicate grep, so keeping a subdir for the source files seemed cleanest. (though some e.g. tristate.h/cc might be better in the gcc subdir, as noted in review) * I kept a separate .opt file for the new command line options * I dropped #include "gcc-plugin.h" from the source files, and add includes of the things that are needed (which was rather tedious as e.g. gimple.h doesn't include what it needs, requiring manually included its dependences everywhere, which seems like a violation of DRY - but that's an orthogonal issue) * I added #if ENABLE_ANALYZER guards around the bodies of the source files so that it ought to compile away with --disable-analyzer I haven't yet measured the effect on * I dropped the auto_client_timevar in favor of new TV_*. * Putting everything in the core middle-end exposed a breakage in the selftests for C++ due to the %E in some dumps, which is FE-specific. I fixed this by rewriting the dumps to avoid %E. See the ChangeLog of patch 2 for more details. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to branch "dmalcolm/analyzer-v3-unsquashed" on the GCC git mirror. I may integrate Lewis's fix for multicolumn characters into trunk first, then rebase my patch, since our changes to diagnostic-show-locus.c have numerous conflicts, albeit ones that ought to be mechanical (if tedious) to resolve. Dave David Malcolm (2): Fixup for rebase: c-format.c: get_pointer_to_named_type -> get_named_type Rework as a non-plugin gcc/Makefile.in | 32 +++- gcc/analyzer/Make-plugin.in | 182 ---------------------- gcc/analyzer/analysis-plan.cc | 8 +- gcc/analyzer/analyzer-logging.cc | 4 + gcc/analyzer/analyzer-pass.cc | 41 +++-- gcc/analyzer/analyzer-plugin.cc | 63 -------- gcc/analyzer/analyzer-selftests.cc | 3 +- gcc/analyzer/analyzer-selftests.h | 2 +- gcc/analyzer/analyzer.cc | 7 +- gcc/analyzer/analyzer.h | 2 + gcc/analyzer/{plugin.opt => analyzer.opt} | 0 gcc/analyzer/call-string.cc | 6 +- gcc/analyzer/checker-path.cc | 8 +- gcc/analyzer/config-plugin.in | 34 ---- gcc/analyzer/constraint-manager.cc | 10 +- gcc/analyzer/diagnostic-manager.cc | 7 +- gcc/analyzer/digraph.cc | 5 +- gcc/analyzer/engine.cc | 26 ++-- gcc/analyzer/exploded-graph.h | 1 + gcc/analyzer/graphviz.cc | 5 +- gcc/analyzer/pending-diagnostic.cc | 5 +- gcc/analyzer/program-point.cc | 5 +- gcc/analyzer/program-state.cc | 5 +- gcc/analyzer/region-model.cc | 66 ++++---- gcc/analyzer/region-model.h | 1 + gcc/analyzer/shortest-paths.h | 2 +- gcc/analyzer/sm-file.cc | 8 +- gcc/analyzer/sm-malloc.cc | 9 +- gcc/analyzer/sm-pattern-test.cc | 7 +- gcc/analyzer/sm-sensitive.cc | 9 +- gcc/analyzer/sm-signal.cc | 7 +- gcc/analyzer/sm-taint.cc | 8 +- gcc/analyzer/sm.cc | 8 +- gcc/analyzer/state-purge.cc | 10 +- gcc/analyzer/supergraph.cc | 9 +- gcc/analyzer/supergraph.h | 4 + gcc/analyzer/tristate.cc | 5 +- gcc/c-family/c-format.c | 2 +- gcc/common.opt | 3 +- gcc/configure | 25 ++- gcc/configure.ac | 14 +- gcc/gcc.c | 12 -- gcc/passes.def | 1 + gcc/selftest-run-tests.c | 4 + gcc/timevar.def | 11 ++ gcc/tree-pass.h | 1 + 46 files changed, 301 insertions(+), 386 deletions(-) delete mode 100644 gcc/analyzer/Make-plugin.in delete mode 100644 gcc/analyzer/analyzer-plugin.cc rename gcc/analyzer/{plugin.opt => analyzer.opt} (100%) delete mode 100644 gcc/analyzer/config-plugin.in -- 2.21.0