Remove redundant code from abidiff

Message ID 20220603131621.315455-1-woodard@redhat.com
State New
Headers
Series Remove redundant code from abidiff |

Commit Message

Ben Woodard June 3, 2022, 1:16 p.m. UTC
  While working on abicompat, I noticed that the following two blocks of
code are redundant. They perform the same test as in the switch
statement a few lines below.

	* tools/abidiff.cc - remove redundant code.

Signed-off-by: Ben Woodard <woodard@redhat.com>
---
 tools/abidiff.cc | 13 -------------
 1 file changed, 13 deletions(-)
  

Comments

Dodji Seketeli June 7, 2022, 3:23 p.m. UTC | #1
Ben Woodard via Libabigail <libabigail@sourceware.org> a écrit:

> While working on abicompat, I noticed that the following two blocks of
> code are redundant. They perform the same test as in the switch
> statement a few lines below.
>
> 	* tools/abidiff.cc - remove redundant code.

Thanks!  I have applied the patch to the master branch.

I have just updated the ChangeLog part of the log to make it comply with
the standard.  Below is the patch that was applied.

From ebf8f98f3dc7b6e4fe2af9c1ccbbfee55ace6c54 Mon Sep 17 00:00:00 2001
From: Ben Woodard <woodard@redhat.com>
Date: Fri, 3 Jun 2022 06:16:21 -0700
Subject: [PATCH] abidiff: Remove redundant code

While working on abicompat, I noticed that the following two blocks of
code are redundant. They perform the same test as in the switch
statement a few lines below.

	* tools/abidiff.cc (main): Remove redundant code.

Signed-off-by: Ben Woodard <woodard@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 tools/abidiff.cc | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/tools/abidiff.cc b/tools/abidiff.cc
index 37a273ad..e0f6d5be 100644
--- a/tools/abidiff.cc
+++ b/tools/abidiff.cc
@@ -1127,20 +1127,7 @@ main(int argc, char* argv[])
       abigail::tools_utils::file_type t1_type, t2_type;
 
       t1_type = guess_file_type(opts.file1);
-      if (t1_type == abigail::tools_utils::FILE_TYPE_UNKNOWN)
-	{
-	  emit_prefix(argv[0], cerr)
-	    << "Unknown content type for file " << opts.file1 << "\n";
-	  return abigail::tools_utils::ABIDIFF_ERROR;
-	}
-
       t2_type = guess_file_type(opts.file2);
-      if (t2_type == abigail::tools_utils::FILE_TYPE_UNKNOWN)
-	{
-	  emit_prefix(argv[0], cerr)
-	    << "Unknown content type for file " << opts.file2 << "\n";
-	  return abigail::tools_utils::ABIDIFF_ERROR;
-	}
 
       environment_sptr env(new environment);
 #ifdef WITH_DEBUG_SELF_COMPARISON
  

Patch

diff --git a/tools/abidiff.cc b/tools/abidiff.cc
index 37a273ad..e0f6d5be 100644
--- a/tools/abidiff.cc
+++ b/tools/abidiff.cc
@@ -1127,20 +1127,7 @@  main(int argc, char* argv[])
       abigail::tools_utils::file_type t1_type, t2_type;
 
       t1_type = guess_file_type(opts.file1);
-      if (t1_type == abigail::tools_utils::FILE_TYPE_UNKNOWN)
-	{
-	  emit_prefix(argv[0], cerr)
-	    << "Unknown content type for file " << opts.file1 << "\n";
-	  return abigail::tools_utils::ABIDIFF_ERROR;
-	}
-
       t2_type = guess_file_type(opts.file2);
-      if (t2_type == abigail::tools_utils::FILE_TYPE_UNKNOWN)
-	{
-	  emit_prefix(argv[0], cerr)
-	    << "Unknown content type for file " << opts.file2 << "\n";
-	  return abigail::tools_utils::ABIDIFF_ERROR;
-	}
 
       environment_sptr env(new environment);
 #ifdef WITH_DEBUG_SELF_COMPARISON