public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Recent change to display_arc_attribute
@ 2017-05-15 14:53 Jeff Law
  2017-05-15 16:36 ` Claudiu Zissulescu
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2017-05-15 14:53 UTC (permalink / raw)
  To: claziss; +Cc: Binutils

[-- Attachment #1: Type: text/plain, Size: 863 bytes --]


Recent changes to display_arc_attribute are causing significant failures 
to build with modern compilers due to introduction of a switch case 
fallthru.

The code in question:

     case Tag_ARC_CPU_variation:
       val = read_uleb128 (p, &len, end);
       p += len;
       printf ("  Tag_ARC_CPU_variation: ");
       switch (val)
         {
         default:
           if (val > 0 && val < 16)
             {
               printf ("Core%d\n", val);
               break;
             }
         case 0:
           printf (_("Absent\n"));
           break;
         }
       break;

Note the fallthru from the default to case 0.


I'm not at all familiar with the ARC port and what we want to do here. 
But the attached seems fairly benign in that if someone added an out of 
range variation we'd flag it as "Unknown" rather than "Absent".

Thoughts?

Jeff

[-- Attachment #2: ZZ --]
[-- Type: text/plain, Size: 411 bytes --]

diff --git a/binutils/readelf.c b/binutils/readelf.c
index 16eb866..39bc88f 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -13586,10 +13586,11 @@ display_arc_attribute (unsigned char * p,
 	{
 	default:
 	  if (val > 0 && val < 16)
-	    {
 	      printf ("Core%d\n", val);
-	      break;
-	    }
+	  else
+	      printf ("Unknown\n");
+	  break;
+
 	case 0:
 	  printf (_("Absent\n"));
 	  break;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Recent change to display_arc_attribute
  2017-05-15 14:53 Recent change to display_arc_attribute Jeff Law
@ 2017-05-15 16:36 ` Claudiu Zissulescu
  2017-05-15 17:12   ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Claudiu Zissulescu @ 2017-05-15 16:36 UTC (permalink / raw)
  To: Jeff Law; +Cc: claziss@gmail.com, Binutils

Hi Jeff,

It looks alright from my side. Sorry for this overlooking. I'm also
preparing a patch to add the fall through comments.

Thank you,
Claudiu

On Mon, May 15, 2017 at 4:53 PM, Jeff Law <law@redhat.com> wrote:
>
> Recent changes to display_arc_attribute are causing significant failures to
> build with modern compilers due to introduction of a switch case fallthru.
>
> The code in question:
>
>     case Tag_ARC_CPU_variation:
>       val = read_uleb128 (p, &len, end);
>       p += len;
>       printf ("  Tag_ARC_CPU_variation: ");
>       switch (val)
>         {
>         default:
>           if (val > 0 && val < 16)
>             {
>               printf ("Core%d\n", val);
>               break;
>             }
>         case 0:
>           printf (_("Absent\n"));
>           break;
>         }
>       break;
>
> Note the fallthru from the default to case 0.
>
>
> I'm not at all familiar with the ARC port and what we want to do here. But
> the attached seems fairly benign in that if someone added an out of range
> variation we'd flag it as "Unknown" rather than "Absent".
>
> Thoughts?
>
> Jeff
>
> diff --git a/binutils/readelf.c b/binutils/readelf.c
> index 16eb866..39bc88f 100644
> --- a/binutils/readelf.c
> +++ b/binutils/readelf.c
> @@ -13586,10 +13586,11 @@ display_arc_attribute (unsigned char * p,
>         {
>         default:
>           if (val > 0 && val < 16)
> -           {
>               printf ("Core%d\n", val);
> -             break;
> -           }
> +         else
> +             printf ("Unknown\n");
> +         break;
> +
>         case 0:
>           printf (_("Absent\n"));
>           break;
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Recent change to display_arc_attribute
  2017-05-15 16:36 ` Claudiu Zissulescu
@ 2017-05-15 17:12   ` Jeff Law
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Law @ 2017-05-15 17:12 UTC (permalink / raw)
  To: Claudiu Zissulescu; +Cc: claziss@gmail.com, Binutils

On 05/15/2017 10:36 AM, Claudiu Zissulescu wrote:
> Hi Jeff,
> 
> It looks alright from my side. Sorry for this overlooking. I'm also
> preparing a patch to add the fall through comments.
Thanks.  Installed.

Jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-15 17:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-15 14:53 Recent change to display_arc_attribute Jeff Law
2017-05-15 16:36 ` Claudiu Zissulescu
2017-05-15 17:12   ` Jeff Law

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