public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Roland McGrath <mcgrathr@google.com>
To: "binutils@sourceware.org" <binutils@sourceware.org>
Subject: [COMMITTED PATCH] cast Booleanish expression to int when used in switch
Date: Wed, 09 Oct 2013 19:40:00 -0000	[thread overview]
Message-ID: <CAB=4xhpc4A7mwQtotV3rg25LDQWKxr8QMtsvLHYN5-s6C1EC6A@mail.gmail.com> (raw)

Committed as obvious enough, to trunk and 2.24 branch.
(Clang warns about this by default.)


Thanks,
Roland


bfd/
	* elf64-alpha.c (elf64_alpha_relax_tls_get_addr): Cast switch
	expression to int to silence over-eager compiler warnings.

--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -1,6 +1,6 @@
 /* Alpha specific support for 64-bit ELF
    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009, 2010, 2011, 2012
+   2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
    Free Software Foundation, Inc.
    Contributed by Richard Henderson <rth@tamu.edu>.

@@ -3590,7 +3590,9 @@ elf64_alpha_relax_tls_get_addr (struct
alpha_relax_info *info, bfd_vma symval,
   use_gottprel = FALSE;
   new_symndx = is_gd ? ELF64_R_SYM (irel->r_info) : STN_UNDEF;

-  switch (!dynamic && !info->link_info->shared)
+  /* Some compilers warn about a Boolean-looking expression being
+     used in a switch.  The explicit cast silences them.  */
+  switch ((int) (!dynamic && !info->link_info->shared))
     {
     case 1:
       {

                 reply	other threads:[~2013-10-09 19:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CAB=4xhpc4A7mwQtotV3rg25LDQWKxr8QMtsvLHYN5-s6C1EC6A@mail.gmail.com' \
    --to=mcgrathr@google.com \
    --cc=binutils@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).