This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[Patch, MIPS] Fix warning in sysdeps/mips/dl-trampoline.c
- From: "Steve Ellcey " <sellcey at imgtec dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Wed, 10 Dec 2014 16:19:47 -0800
- Subject: [Patch, MIPS] Fix warning in sysdeps/mips/dl-trampoline.c
- Authentication-results: sourceware.org; auth=none
Here is another warning/error fix. The mips dl-trampline.c is doing a
switch on a comparision expression and this gives the error:
../sysdeps/mips/dl-trampoline.c: In function '__dl_runtime_resolve':
../sysdeps/mips/dl-trampoline.c:142:15: error: switch condition has boolean value [-Werror=switch-bool]
switch (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL)
^
cc1: all warnings being treated as errors
I looked at changing the switch to an if statement because there are only
two cases (default and 0) but it turned out to be a bit tricky because
in some cases the default case does a break and in other cases it falls
through to the '0' case. So instead I just cast the comparision to an
int before switching on it.
Ok to checkin?
Steve Ellcey
sellcey@imgtec.com
2014-12-10 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/dl-trampoline.c: Cast switch expression.
diff --git a/sysdeps/mips/dl-trampoline.c b/sysdeps/mips/dl-trampoline.c
index f565654..3aa147b 100644
--- a/sysdeps/mips/dl-trampoline.c
+++ b/sysdeps/mips/dl-trampoline.c
@@ -139,7 +139,7 @@ __dl_runtime_resolve (ElfW(Word) sym_index,
/* FIXME: The symbol versioning stuff is not tested yet. */
if (__builtin_expect (ELFW(ST_VISIBILITY) (sym->st_other), 0) == 0)
{
- switch (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL)
+ switch ((int) (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL))
{
default:
{