Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Baldwin <jhb@freebsd.org>
To: gdb-patches@sourceware.org
Cc: Taras Tsugrii <ttsugrii@fb.com>
Subject: Re: [PATCH] Fix implicit conversion warning produced by clang
Date: Tue, 14 Jun 2016 19:08:00 -0000	[thread overview]
Message-ID: <4098693.y3tFsLmOox@ralph.baldwin.cx> (raw)
In-Reply-To: <1465926942-37759-1-git-send-email-ttsugrii@fb.com>

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


  reply	other threads:[~2016-06-14 19:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14 17:56 Taras Tsugrii
2016-06-14 19:08 ` John Baldwin [this message]
2016-06-14 21:03   ` Pedro Alves
2016-06-15  8:52 ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4098693.y3tFsLmOox@ralph.baldwin.cx \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    --cc=ttsugrii@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox