[MIPS] Fix warning in sysdeps/mips/dl-trampoline.c
diff mbox

Message ID 1418318568.2196.145.camel@ubuntu-sellcey
State New
Headers show

Commit Message

Steve Ellcey Dec. 11, 2014, 5:22 p.m. UTC
On Thu, 2014-12-11 at 11:31 -0500, Carlos O'Donell wrote:
> On 12/11/2014 11:21 AM, Steve Ellcey wrote:
> > On Wed, 2014-12-10 at 20:01 -0500, Carlos O'Donell wrote:
> > 
> >> Why not "switch (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL ? 0 : 1)" to
> >> avoid the (int) case potentially hiding future type errors?
> > 
> > That seems reasonable but shouldn't it be "switch (l->l_info[VERSYMIDX
> > (DT_VERSYM)] != NULL ? 1 : 0)"  I.e. return 1 if the boolean expression
> > is true and 0 if the boolean expression is false?
> 
> Yes, you are correct, my mistake.
> 
> Cheers,
> Carlos.

OK, here is what I am currently testing.  OK for checkin if my testing
finishes with no regressions?

Steve Ellcey
sellcey@imgtec.com



2014-12-11  Steve Ellcey  <sellcey@imgtec.com>

	* sysdeps/mips/dl-trampoline.c: Modify switch expression.

Comments

Joseph Myers Dec. 11, 2014, 5:26 p.m. UTC | #1
On Thu, 11 Dec 2014, Steve Ellcey wrote:

> On Thu, 2014-12-11 at 11:31 -0500, Carlos O'Donell wrote:
> > On 12/11/2014 11:21 AM, Steve Ellcey wrote:
> > > On Wed, 2014-12-10 at 20:01 -0500, Carlos O'Donell wrote:
> > > 
> > >> Why not "switch (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL ? 0 : 1)" to
> > >> avoid the (int) case potentially hiding future type errors?
> > > 
> > > That seems reasonable but shouldn't it be "switch (l->l_info[VERSYMIDX
> > > (DT_VERSYM)] != NULL ? 1 : 0)"  I.e. return 1 if the boolean expression
> > > is true and 0 if the boolean expression is false?
> > 
> > Yes, you are correct, my mistake.
> > 
> > Cheers,
> > Carlos.
> 
> OK, here is what I am currently testing.  OK for checkin if my testing
> finishes with no regressions?

OK.

> 2014-12-11  Steve Ellcey  <sellcey@imgtec.com>
> 
> 	* sysdeps/mips/dl-trampoline.c: Modify switch expression.

But describe the change more meaningfully than "Modify".

Patch
diff mbox

diff --git a/sysdeps/mips/dl-trampoline.c b/sysdeps/mips/dl-trampoline.c
index f565654..66a1ea1 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 (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL ? 1 : 0)
 	{
 	default:
 	  {