From patchwork Tue Jun 14 17:55:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Tsugrii X-Patchwork-Id: 13075 Received: (qmail 117983 invoked by alias); 14 Jun 2016 17:56:12 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 117965 invoked by uid 89); 14 Jun 2016 17:56:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.5 required=5.0 tests=BAYES_05, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM autolearn=no version=3.3.2 spammy=sk:06fcea3, STT_COMMON, sk:do_debu, stt_common X-HELO: MacBook-Pro-974.local Received: from Unknown (HELO MacBook-Pro-974.local) (199.201.64.133) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Jun 2016 17:56:11 +0000 Received: by MacBook-Pro-974.local (Postfix, from userid 1573035693) id 1F3CB68C053D; Tue, 14 Jun 2016 10:56:08 -0700 (PDT) From: Taras Tsugrii To: gdb-patches@sourceware.org Cc: Taras Tsugrii Subject: [PATCH] Fix implicit conversion warning produced by clang Date: Tue, 14 Jun 2016 10:55:42 -0700 Message-Id: <1465926942-37759-1-git-send-email-ttsugrii@fb.com> When compiling with clang, which is part of Xcode 7.3, following warnings are emitted: objcopy.c:224:50: error: implicit conversion from enumeration type 'enum bfd_link_elf_stt_common' to different enumeration type 'enum bfd_link_discard' [-Werror,-Wenum-conversion] static enum bfd_link_discard do_elf_stt_common = unchanged; ~~~~~~~~~~~~~~~~~ ^~~~~~~~~ objcopy.c:4290:26: error: implicit conversion from enumeration type 'enum bfd_link_elf_stt_common' to different enumeration type 'enum bfd_link_discard' [-Werror,-Wenum-conversion] do_elf_stt_common = elf_stt_common; ~ ^~~~~~~~~~~~~~ objcopy.c:4292:26: error: implicit conversion from enumeration type 'enum bfd_link_elf_stt_common' to different enumeration type 'enum bfd_link_discard' [-Werror,-Wenum-conversion] do_elf_stt_common = no_elf_stt_common; ~ ^~~~~~~~~~~~~~~~~ 3 errors generated. This is risky, since essentially there is a coupling between 2 different enum orderings. Also since by default warnings are promoted to errors it breaks default build. To reproduce: ./configure && make Verified by: ./configure && make # above warnings disappear --- binutils/ChangeLog | 4 ++++ binutils/objcopy.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ff8161a..08be889 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2016-06-14 Taras Tsugrii + + * objcopy.c: Fix clang implicit conversion warning. + 2016-06-14 Alan Modra * ar.c: Expand uses of bfd_my_archive. diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 06fcea3..76170cb 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -221,7 +221,7 @@ static enum } do_debug_sections = nothing; /* Whether to generate ELF common symbols with the STT_COMMON type. */ -static enum bfd_link_discard do_elf_stt_common = unchanged; +static enum bfd_link_elf_stt_common do_elf_stt_common = unchanged; /* Whether to change the leading character in symbol names. */ static bfd_boolean change_leading_char = FALSE;