This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, MIPS] Fix warning in sysdeps/mips/dl-trampoline.c

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

2014-12-10  Steve Ellcey  <>

	* 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))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]