Add --full-impact option to kmidiff
authorDodji Seketeli <dodji@redhat.com>
Wed, 4 Oct 2017 08:33:53 +0000 (10:33 +0200)
committerDodji Seketeli <dodji@redhat.com>
Sun, 8 Oct 2017 16:51:35 +0000 (18:51 +0200)
This patch changes the default report emitted by kmidiff.  Now, it
emits a leaf changes report by default.  And if the user wants the
classical kind of report then she can use the --full-impact option.

* doc/manuals/kmidiff.rst: Add documentation for the new
--full-impact|-f option.
* tools/kmidiff.cc (options::leaf_changes_only): Add new data
member.
(option::option): Initialize the new data member.
(display_usage): Add a documentation string for the new
--full-impact|-f option.
(parse_command_line): Parse the new --full-impact|-f option.
(set_diff_context): Set the diff context appropriately.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
doc/manuals/kmidiff.rst
tools/kmidiff.cc

index 1b184c35316e62a7be9d6aedef3af9dad160f0dc..eafefce2d6728d3b119593991bf57c39d22e5248 100644 (file)
@@ -147,3 +147,10 @@ Options
     Please note that, by default, if this option is not provided, then
     the :ref:`default suppression specification files
     <abidiff_default_supprs_label>` are loaded .
+
+
+  * ``--full-impact | -f``
+
+    Emit a change report that shows the full impact of each change on
+    exported interfaces.  This is the default kind of report emitted
+    by tools like ``abidiff`` or ``abipkgdiff``.
index 02dd5e8a99688ac9c52fac6c9e2f940f47d16658..c10d850dc8886cf3264360cbcc7e028e2f13bdbb 100644 (file)
@@ -72,6 +72,7 @@ struct options
   bool         display_version;
   bool         verbose;
   bool         missing_operand;
+  bool         leaf_changes_only;
   string       wrong_option;
   string       kernel_dist_root1;
   string       kernel_dist_root2;
@@ -86,7 +87,8 @@ struct options
     : display_usage(),
       display_version(),
       verbose(),
-      missing_operand()
+      missing_operand(),
+      leaf_changes_only(true)
   {}
 }; // end struct options.
 
@@ -108,7 +110,9 @@ display_usage(const string& prog_name, ostream& out)
     << " --vmlinux2|--l2 <path>  the path to the second vmlinux\n"
     << " --suppressions|--suppr <path>  specify a suppression file\n"
     << " --kmi-whitelist|-w <path>  path to a kernel module interface "
-    "whitelist\n";
+    "whitelist\n"
+    << " --full-impact|-f  show the full impact of changes on top-most "
+        "interfaces\n";
 }
 
 /// Parse the command line of the program.
@@ -205,6 +209,9 @@ parse_command_line(int argc, char* argv[], options& opts)
          opts.suppression_paths.push_back(argv[j]);
          ++i;
        }
+      else if (!strcmp(argv[i], "--full-impact")
+              || !strcmp(argv[i], "-f"))
+       opts.leaf_changes_only = false;
     }
 
   return true;
@@ -256,6 +263,7 @@ set_diff_context(diff_context_sptr ctxt, const options& opts)
     (false);
   ctxt->show_symbols_unreferenced_by_debug_info
     (true);
+  ctxt->show_leaf_changes_only(opts.leaf_changes_only);
 
   ctxt->switch_categories_off(get_default_harmless_categories_bitmap());