From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126943 invoked by alias); 14 Jun 2016 19:08:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 126901 invoked by uid 89); 14 Jun 2016 19:07:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=H*F:D*freebsd.org, HX-Greylist:0400, HX-Greylist:EDT, Hx-languages-length:1794 X-HELO: bigwig.baldwin.cx Received: from bigwig.baldwin.cx (HELO bigwig.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Tue, 14 Jun 2016 19:07:57 +0000 Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 1FBF5B94E; Tue, 14 Jun 2016 15:07:55 -0400 (EDT) From: John Baldwin To: gdb-patches@sourceware.org Cc: Taras Tsugrii Subject: Re: [PATCH] Fix implicit conversion warning produced by clang Date: Tue, 14 Jun 2016 19:08:00 -0000 Message-ID: <4098693.y3tFsLmOox@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.3-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <1465926942-37759-1-git-send-email-ttsugrii@fb.com> References: <1465926942-37759-1-git-send-email-ttsugrii@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00258.txt.bz2 On Tuesday, June 14, 2016 10:55:42 AM Taras Tsugrii wrote: > 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. I had the same patch in queue and just pushed it. I have a few more patches from clang warnings pending as well. (I am testing with clang 3.8.0 in FreeBSD.) Some of clang's warnings are a bit noisy though and I haven't tried to address the -Wunused-function spam from VEC() (I presume that GDB will eventually switch the VEC stuff to templates which will fix that). Also, Some of the -Wtautological-compare warnings for things that do: if (foo >= 0 && foo <= bar) where 'foo' is unsigned I haven't posted patches to "fix" as I'm not sure that the existing code isn't more readable in its current form. -- John Baldwin