public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 4/4] fix fallthough statements to allow gcc-7 compile
  2017-02-23  0:37 [PATCH 1/4] Fix format-overflow errors Daniel Black
  2017-02-23  0:37 ` [PATCH 2/4] Fix incorrect indirection Daniel Black
@ 2017-02-23  0:37 ` Daniel Black
  2017-02-27 12:54   ` Nick Clifton
  2017-02-23  0:37 ` [PATCH 3/4] Add missing break statement Daniel Black
  2017-02-27 12:47 ` [PATCH 1/4] Fix format-overflow errors Nick Clifton
  3 siblings, 1 reply; 10+ messages in thread
From: Daniel Black @ 2017-02-23  0:37 UTC (permalink / raw)
  To: binutils; +Cc: Daniel Black

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
---
 binutils/dwarf.c     | 3 +++
 gas/config/obj-elf.c | 1 +
 gas/depend.c         | 5 +++--
 gas/dw2gencfi.c      | 1 +
 gas/expr.c           | 1 +
 5 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 282e069..091921f 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -1824,6 +1824,7 @@ read_and_display_attr_value (unsigned long attribute,
 	{
 	case DW_AT_frame_base:
 	  have_frame_base = 1;
+          /* fall through */
 	case DW_AT_location:
 	case DW_AT_string_length:
 	case DW_AT_return_addr:
@@ -2099,6 +2100,7 @@ read_and_display_attr_value (unsigned long attribute,
 
     case DW_AT_frame_base:
       have_frame_base = 1;
+      /* fall through */
     case DW_AT_location:
     case DW_AT_string_length:
     case DW_AT_return_addr:
@@ -7580,6 +7582,7 @@ dwarf_select_sections_by_letters (const char *letters)
 
       case 'F':
 	do_debug_frames_interp = 1;
+        /* fall through */
       case 'f':
 	do_debug_frames = 1;
 	break;
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 8af563f..4b85b52 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -813,6 +813,7 @@ obj_elf_parse_section_letters (char *str, size_t len, bfd_boolean *is_clone)
 		}
 	      break;
 	    }
+	  /* fallthrough */
 	default:
 	  {
 	    const char *bad_msg = _("unrecognized .section attribute:"
diff --git a/gas/depend.c b/gas/depend.c
index 7203e59..86d0566 100644
--- a/gas/depend.c
+++ b/gas/depend.c
@@ -121,8 +121,9 @@ quote_string_for_make (FILE *file, const char *src)
 	  if (file)
 	    putc (c, file);
 	  i++;
-	  /* Fall through.  This can mishandle things like "$(" but
-	     there's no easy fix.  */
+	  /* This can mishandle things like "$(" but
+	     there's no easy fix so */
+	  /* fall through */
 	default:
 	ordinary_char:
 	  /* This can mishandle characters in the string "\0\n%*?[\\~";
diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c
index fb3e302..a362a57 100644
--- a/gas/dw2gencfi.c
+++ b/gas/dw2gencfi.c
@@ -1153,6 +1153,7 @@ dot_cfi_val_encoded_addr (int ignored ATTRIBUTE_UNUSED)
     case O_constant:
       if ((encoding & 0x70) != DW_EH_PE_pcrel)
 	break;
+      /* fallthrough */
     default:
       encoding = DW_EH_PE_omit;
       break;
diff --git a/gas/expr.c b/gas/expr.c
index b1cdb38..3611f2a 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -1008,6 +1008,7 @@ operand (expressionS *expressionP, enum expr_mode mode)
       /* '~' is permitted to start a label on the Delta.  */
       if (is_name_beginner (c))
 	goto isname;
+      /* fallthrough */
     case '!':
     case '-':
     case '+':
-- 
2.7.4

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

* [PATCH 3/4] Add missing break statement
  2017-02-23  0:37 [PATCH 1/4] Fix format-overflow errors Daniel Black
  2017-02-23  0:37 ` [PATCH 2/4] Fix incorrect indirection Daniel Black
  2017-02-23  0:37 ` [PATCH 4/4] fix fallthough statements to allow gcc-7 compile Daniel Black
@ 2017-02-23  0:37 ` Daniel Black
  2017-02-27 12:50   ` Nick Clifton
  2017-02-27 12:47 ` [PATCH 1/4] Fix format-overflow errors Nick Clifton
  3 siblings, 1 reply; 10+ messages in thread
From: Daniel Black @ 2017-02-23  0:37 UTC (permalink / raw)
  To: binutils; +Cc: Daniel Black

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
---
 binutils/stabs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/binutils/stabs.c b/binutils/stabs.c
index 48d7633..eb023b0 100644
--- a/binutils/stabs.c
+++ b/binutils/stabs.c
@@ -3432,6 +3432,7 @@ stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info,
     case 9:
       name = "unsigned";
       rettype = debug_make_int_type (dhandle, 4, TRUE);
+      break;
     case 10:
       name = "unsigned long";
       rettype = debug_make_int_type (dhandle, 4, TRUE);
-- 
2.7.4

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

* [PATCH 2/4] Fix incorrect indirection
  2017-02-23  0:37 [PATCH 1/4] Fix format-overflow errors Daniel Black
@ 2017-02-23  0:37 ` Daniel Black
  2017-02-27 12:49   ` Nick Clifton
  2017-02-23  0:37 ` [PATCH 4/4] fix fallthough statements to allow gcc-7 compile Daniel Black
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Daniel Black @ 2017-02-23  0:37 UTC (permalink / raw)
  To: binutils; +Cc: Daniel Black

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
---
 binutils/stabs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/binutils/stabs.c b/binutils/stabs.c
index aebde7a..48d7633 100644
--- a/binutils/stabs.c
+++ b/binutils/stabs.c
@@ -2702,7 +2702,7 @@ parse_stab_members (void *dhandle, struct stab_handle *info,
 	      ++*pp;
 	      voffset &= 0x7fffffff;
 
-	      if (**pp == ';' || *pp == '\0')
+	      if (**pp == ';' || **pp == '\0')
 		{
 		  /* Must be g++ version 1.  */
 		  context = DEBUG_TYPE_NULL;
-- 
2.7.4

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

* [PATCH 1/4] Fix format-overflow errors
@ 2017-02-23  0:37 Daniel Black
  2017-02-23  0:37 ` [PATCH 2/4] Fix incorrect indirection Daniel Black
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Daniel Black @ 2017-02-23  0:37 UTC (permalink / raw)
  To: binutils; +Cc: Daniel Black

was:

../../binutils-gdb/binutils/prdbg.c: In function �pr_array_type�:
../../binutils-gdb/binutils/prdbg.c:500:16: error: �sprintf� may write a terminating nul past the end of the destination [-Werror=format-overflow=]
  sprintf (buf, "%ld", (long) vma);
                ^~~~~
../../binutils-gdb/binutils/prdbg.c:500:2: note: �sprintf� output between 2 and 21 bytes into a destination of size 20
  sprintf (buf, "%ld", (long) vma);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
---
 binutils/prdbg.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/binutils/prdbg.c b/binutils/prdbg.c
index 7f3dcce..f7b994b 100644
--- a/binutils/prdbg.c
+++ b/binutils/prdbg.c
@@ -82,7 +82,7 @@ static bfd_boolean append_type (struct pr_handle *, const char *);
 static bfd_boolean substitute_type (struct pr_handle *, const char *);
 static bfd_boolean indent_type (struct pr_handle *);
 static char *pop_type (struct pr_handle *);
-static void print_vma (bfd_vma, char *, bfd_boolean, bfd_boolean);
+static void print_vma (bfd_vma, char [21], bfd_boolean, bfd_boolean);
 static bfd_boolean pr_fix_visibility
   (struct pr_handle *, enum debug_visibility);
 static bfd_boolean pr_start_compilation_unit (void *, const char *);
@@ -488,7 +488,7 @@ pop_type (struct pr_handle *info)
 /* Print a VMA value into a string.  */
 
 static void
-print_vma (bfd_vma vma, char *buf, bfd_boolean unsignedp, bfd_boolean hexp)
+print_vma (bfd_vma vma, char buf[21], bfd_boolean unsignedp, bfd_boolean hexp)
 {
   if (sizeof (vma) <= sizeof (unsigned long))
     {
@@ -672,7 +672,7 @@ pr_enum_type (void *p, const char *tag, const char **names,
 
 	  if (values[i] != val)
 	    {
-	      char ab[20];
+	      char ab[21];
 
 	      print_vma (values[i], ab, FALSE, FALSE);
 	      if (! append_type (info, " = ")
@@ -802,7 +802,7 @@ static bfd_boolean
 pr_range_type (void *p, bfd_signed_vma lower, bfd_signed_vma upper)
 {
   struct pr_handle *info = (struct pr_handle *) p;
-  char abl[20], abu[20];
+  char abl[21], abu[21];
 
   assert (info->stack != NULL);
 
@@ -827,7 +827,7 @@ pr_array_type (void *p, bfd_signed_vma lower, bfd_signed_vma upper,
 {
   struct pr_handle *info = (struct pr_handle *) p;
   char *range_type;
-  char abl[20], abu[20], ab[50];
+  char abl[21], abu[21], ab[50];
 
   range_type = pop_type (info);
   if (range_type == NULL)
@@ -1151,7 +1151,7 @@ pr_struct_field (void *p, const char *name, bfd_vma bitpos, bfd_vma bitsize,
 		 enum debug_visibility visibility)
 {
   struct pr_handle *info = (struct pr_handle *) p;
-  char ab[20];
+  char ab[21];
   char *t;
 
   if (! substitute_type (info, name))
@@ -1253,7 +1253,7 @@ pr_start_class_type (void *p, const char *tag, unsigned int id,
 
       if (size != 0)
 	{
-	  char ab[20];
+	  char ab[21];
 
 	  sprintf (ab, "%u", size);
 	  if (! append_type (info, " size ")
@@ -1335,7 +1335,7 @@ pr_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean is_virtual,
   struct pr_handle *info = (struct pr_handle *) p;
   char *t;
   const char *prefix;
-  char ab[20];
+  char ab[21];
   char *s, *l, *n;
 
   assert (info->stack != NULL && info->stack->next != NULL);
@@ -1495,7 +1495,7 @@ pr_class_method_variant (void *p, const char *physname,
     return FALSE;
   if (context || voffset != 0)
     {
-      char ab[20];
+      char ab[21];
 
       if (context)
 	{
@@ -1698,7 +1698,7 @@ static bfd_boolean
 pr_int_constant (void *p, const char *name, bfd_vma val)
 {
   struct pr_handle *info = (struct pr_handle *) p;
-  char ab[20];
+  char ab[21];
 
   indent (info);
   print_vma (val, ab, FALSE, FALSE);
@@ -1725,7 +1725,7 @@ pr_typed_constant (void *p, const char *name, bfd_vma val)
 {
   struct pr_handle *info = (struct pr_handle *) p;
   char *t;
-  char ab[20];
+  char ab[21];
 
   t = pop_type (info);
   if (t == NULL)
@@ -1748,7 +1748,7 @@ pr_variable (void *p, const char *name, enum debug_var_kind kind,
 {
   struct pr_handle *info = (struct pr_handle *) p;
   char *t;
-  char ab[20];
+  char ab[21];
 
   if (! substitute_type (info, name))
     return FALSE;
@@ -1811,7 +1811,7 @@ pr_function_parameter (void *p, const char *name,
 {
   struct pr_handle *info = (struct pr_handle *) p;
   char *t;
-  char ab[20];
+  char ab[21];
 
   if (kind == DEBUG_PARM_REFERENCE
       || kind == DEBUG_PARM_REF_REG)
@@ -1849,7 +1849,7 @@ static bfd_boolean
 pr_start_block (void *p, bfd_vma addr)
 {
   struct pr_handle *info = (struct pr_handle *) p;
-  char ab[20];
+  char ab[21];
 
   if (info->parameter > 0)
     {
@@ -1872,7 +1872,7 @@ static bfd_boolean
 pr_lineno (void *p, const char *filename, unsigned long lineno, bfd_vma addr)
 {
   struct pr_handle *info = (struct pr_handle *) p;
-  char ab[20];
+  char ab[21];
 
   indent (info);
   print_vma (addr, ab, TRUE, TRUE);
@@ -1887,7 +1887,7 @@ static bfd_boolean
 pr_end_block (void *p, bfd_vma addr)
 {
   struct pr_handle *info = (struct pr_handle *) p;
-  char ab[20];
+  char ab[21];
 
   info->indent -= 2;
 
@@ -1993,7 +1993,7 @@ tg_enum_type (void *p, const char *tag, const char **names,
   struct pr_handle *info = (struct pr_handle *) p;
   unsigned int i;
   const char *name;
-  char ab[20];
+  char ab[21];
 
   if (! pr_enum_type (p, tag, names, values))
     return FALSE;
@@ -2540,7 +2540,7 @@ static bfd_boolean
 tg_int_constant (void *p, const char *name, bfd_vma val)
 {
   struct pr_handle *info = (struct pr_handle *) p;
-  char ab[20];
+  char ab[21];
 
   indent (info);
   print_vma (val, ab, FALSE, FALSE);
@@ -2569,7 +2569,7 @@ tg_typed_constant (void *p, const char *name, bfd_vma val)
 {
   struct pr_handle *info = (struct pr_handle *) p;
   char *t;
-  char ab[20];
+  char ab[21];
 
   t = pop_type (info);
   if (t == NULL)
@@ -2747,7 +2747,7 @@ static bfd_boolean
 tg_start_block (void *p, bfd_vma addr)
 {
   struct pr_handle *info = (struct pr_handle *) p;
-  char ab[20], kind, *partof;
+  char ab[21], kind, *partof;
   char *t;
   bfd_boolean local;
 
-- 
2.7.4

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

* Re: [PATCH 1/4] Fix format-overflow errors
  2017-02-23  0:37 [PATCH 1/4] Fix format-overflow errors Daniel Black
                   ` (2 preceding siblings ...)
  2017-02-23  0:37 ` [PATCH 3/4] Add missing break statement Daniel Black
@ 2017-02-27 12:47 ` Nick Clifton
  3 siblings, 0 replies; 10+ messages in thread
From: Nick Clifton @ 2017-02-27 12:47 UTC (permalink / raw)
  To: Daniel Black, binutils

Hi Daniel,

> ../../binutils-gdb/binutils/prdbg.c: In function �pr_array_type�:
> ../../binutils-gdb/binutils/prdbg.c:500:16: error: �sprintf� may write a terminating nul past the end of the destination [-Werror=format-overflow=]
>   sprintf (buf, "%ld", (long) vma);
>                 ^~~~~
> ../../binutils-gdb/binutils/prdbg.c:500:2: note: �sprintf� output between 2 and 21 bytes into a destination of size 20
>   sprintf (buf, "%ld", (long) vma);

This has already been fixed by commit: 98a4fc78f9dab76b5ada3551a7bef36db8a3ed05

Cheers
  Nick

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

* Re: [PATCH 2/4] Fix incorrect indirection
  2017-02-23  0:37 ` [PATCH 2/4] Fix incorrect indirection Daniel Black
@ 2017-02-27 12:49   ` Nick Clifton
  2017-02-27 22:07     ` Daniel Black
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Clifton @ 2017-02-27 12:49 UTC (permalink / raw)
  To: Daniel Black, binutils

Hi Daniel,

> --- a/binutils/stabs.c
> +++ b/binutils/stabs.c
> @@ -2702,7 +2702,7 @@ parse_stab_members (void *dhandle, struct stab_handle *info,
>  	      ++*pp;
>  	      voffset &= 0x7fffffff;
>  
> -	      if (**pp == ';' || *pp == '\0')
> +	      if (**pp == ';' || **pp == '\0')

This has already been fixed by commit b972a0d6

Cheers
  Nick

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

* Re: [PATCH 3/4] Add missing break statement
  2017-02-23  0:37 ` [PATCH 3/4] Add missing break statement Daniel Black
@ 2017-02-27 12:50   ` Nick Clifton
  0 siblings, 0 replies; 10+ messages in thread
From: Nick Clifton @ 2017-02-27 12:50 UTC (permalink / raw)
  To: Daniel Black, binutils

Hi Daniel,

> +++ b/binutils/stabs.c
> @@ -3432,6 +3432,7 @@ stab_xcoff_builtin_type (void *dhandle, struct stab_handle *info,
>      case 9:
>        name = "unsigned";
>        rettype = debug_make_int_type (dhandle, 4, TRUE);
> +      break;
>      case 10:

This has already been fixed by commit 2b804145

Cheers
  Nick

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

* Re: [PATCH 4/4] fix fallthough statements to allow gcc-7 compile
  2017-02-23  0:37 ` [PATCH 4/4] fix fallthough statements to allow gcc-7 compile Daniel Black
@ 2017-02-27 12:54   ` Nick Clifton
  0 siblings, 0 replies; 10+ messages in thread
From: Nick Clifton @ 2017-02-27 12:54 UTC (permalink / raw)
  To: Daniel Black, binutils

Hi Daniel,

  These have all been fixed already as well...

Cheers
  Nick

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

* Re: [PATCH 2/4] Fix incorrect indirection
  2017-02-27 12:49   ` Nick Clifton
@ 2017-02-27 22:07     ` Daniel Black
  2017-02-28 23:57       ` Alan Modra
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Black @ 2017-02-27 22:07 UTC (permalink / raw)
  To: Nick Clifton, binutils, Alan Modra


On 27/02/17 23:49, Nick Clifton wrote:
> Hi Daniel,
> 
>> --- a/binutils/stabs.c
>> +++ b/binutils/stabs.c
>> @@ -2702,7 +2702,7 @@ parse_stab_members (void *dhandle, struct stab_handle *info,
>>  	      ++*pp;
>>  	      voffset &= 0x7fffffff;
>>  
>> -	      if (**pp == ';' || *pp == '\0')
>> +	      if (**pp == ';' || **pp == '\0')
> 
> This has already been fixed by commit b972a0d6

Apologies Nick and Alan,

Seems I was looking at the binutils-2_27-branch rather than master.

Sorry for wasting your time.

> 
> Cheers
>   Nick
> 

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

* Re: [PATCH 2/4] Fix incorrect indirection
  2017-02-27 22:07     ` Daniel Black
@ 2017-02-28 23:57       ` Alan Modra
  0 siblings, 0 replies; 10+ messages in thread
From: Alan Modra @ 2017-02-28 23:57 UTC (permalink / raw)
  To: Daniel Black; +Cc: Nick Clifton, binutils

On Tue, Feb 28, 2017 at 09:06:23AM +1100, Daniel Black wrote:
> Seems I was looking at the binutils-2_27-branch rather than master.
> 
> Sorry for wasting your time.

I didn't take enough notice when you pinged me on irc.  I ought to
have noticed you were talking about 2.27 and informed you of the fixes
already in master.  Sorry about that.

-- 
Alan Modra
Australia Development Lab, IBM

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

end of thread, other threads:[~2017-02-28 23:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-23  0:37 [PATCH 1/4] Fix format-overflow errors Daniel Black
2017-02-23  0:37 ` [PATCH 2/4] Fix incorrect indirection Daniel Black
2017-02-27 12:49   ` Nick Clifton
2017-02-27 22:07     ` Daniel Black
2017-02-28 23:57       ` Alan Modra
2017-02-23  0:37 ` [PATCH 4/4] fix fallthough statements to allow gcc-7 compile Daniel Black
2017-02-27 12:54   ` Nick Clifton
2017-02-23  0:37 ` [PATCH 3/4] Add missing break statement Daniel Black
2017-02-27 12:50   ` Nick Clifton
2017-02-27 12:47 ` [PATCH 1/4] Fix format-overflow errors Nick Clifton

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