This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/13282] New: A "-Wno..." switch to turn off "missing initializer" warnings


With "-W -Wall" gcc, among several useful warnings, prints warnings if an
aggregate initializes only some of the members.

With declaration like

struct {int v; int f;} a[2] = {
  {10, 1},
  {15}
};

it warns about "missing initializer (near initialization for `a[1].f')".

But leaving some elements to be implicitly initialized with zeroes is perfectly
legitimate in C, so one has a hard choice: either switch off all "-W" warnings
altogether, or cope with tons of "missing initializer" warnings.

A switch to turn this warning on/off separate from "-W" could be an excellent
solution, and it was discussed several times (see e.g.
http://gcc.gnu.org/ml/gcc-patches/2002-05/msg00664.html) with patches proposed.
 But, for some reasons, these patches never found their way to CVS.

-- 
           Summary: A "-Wno..." switch to turn off "missing initializer"
                    warnings
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: d dot yu dot bolkhovityanov at inp dot nsk dot su
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13282


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]