https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92773

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #13 from Martin Sebor <msebor at gcc dot gnu.org> ---
The output of the much simpler test case below shows the warning repeatedly
prints the same hint over and over, adding to it for each new element of the
outer array.  The last two hints are also duplicates of one another.  It's easy
to limit the number of warnings for the same initializer to some maximum.  A
nicer fix would avoid the duplication altogether.

$ cat t.c && gcc -S -Wall t.c
struct {
  int a[8];
}
  a [] =
{
  { 0 },
  { 0, 0 },
  { 0, 0, 0 },
  { 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0 }
};

t.c:5:1: warning: missing braces around initializer [-Wmissing-braces]
    5 | {
      | ^
    6 |   { 0 },
      |     { }
    7 |   { 0, 0 },
      |     {    }
t.c:5:1: warning: missing braces around initializer [-Wmissing-braces]
    5 | {
      | ^
    6 |   { 0 },
      |     { }
    7 |   { 0, 0 },
      |     {    }
    8 |   { 0, 0, 0 },
      |     {       }
t.c:5:1: warning: missing braces around initializer [-Wmissing-braces]
    5 | {
      | ^
    6 |   { 0 },
      |     { }
    7 |   { 0, 0 },
      |     {    }
    8 |   { 0, 0, 0 },
      |     {       }
    9 |   { 0, 0, 0, 0 },
      |     {          }
t.c:5:1: warning: missing braces around initializer [-Wmissing-braces]
    5 | {
      | ^
    6 |   { 0 },
      |     { }
    7 |   { 0, 0 },
      |     {    }
    8 |   { 0, 0, 0 },
      |     {       }
    9 |   { 0, 0, 0, 0 },
      |     {          }
   10 |   { 0, 0, 0, 0, 0 },
      |     {             }
t.c:5:1: warning: missing braces around initializer [-Wmissing-braces]
    5 | {
      | ^
    6 |   { 0 },
      |     { }
    7 |   { 0, 0 },
      |     {    }
    8 |   { 0, 0, 0 },
      |     {       }
    9 |   { 0, 0, 0, 0 },
      |     {          }
   10 |   { 0, 0, 0, 0, 0 },
      |     {             }
   11 |   { 0, 0, 0, 0, 0, 0 },
      |     {                }
t.c:5:1: warning: missing braces around initializer [-Wmissing-braces]
    5 | {
      | ^
    6 |   { 0 },
      |     { }
    7 |   { 0, 0 },
      |     {    }
    8 |   { 0, 0, 0 },
      |     {       }
    9 |   { 0, 0, 0, 0 },
      |     {          }
   10 |   { 0, 0, 0, 0, 0 },
      |     {             }
   11 |   { 0, 0, 0, 0, 0, 0 },
      |     {                }
   12 |   { 0, 0, 0, 0, 0, 0, 0 }
      |     {                   }
t.c:5:1: warning: missing braces around initializer [-Wmissing-braces]
    5 | {
      | ^
    6 |   { 0 },
      |     { }
    7 |   { 0, 0 },
      |     {    }
    8 |   { 0, 0, 0 },
      |     {       }
    9 |   { 0, 0, 0, 0 },
      |     {          }
   10 |   { 0, 0, 0, 0, 0 },
      |     {             }
   11 |   { 0, 0, 0, 0, 0, 0 },
      |     {                }
   12 |   { 0, 0, 0, 0, 0, 0, 0 }
      |     {                   }

Reply via email to