This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Recent change to display_arc_attribute
- From: Jeff Law <law at redhat dot com>
- To: claziss at synopsys dot com
- Cc: Binutils <binutils at sourceware dot org>
- Date: Mon, 15 May 2017 08:53:43 -0600
- Subject: Recent change to display_arc_attribute
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=law at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5968951440
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5968951440
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;