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

            Bug ID: 59855
           Summary: Support sparse-style __attribute__((designated_init))
                    on structures, requiring designated initializers
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: josh at joshtriplett dot org

Created attachment 31865
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31865&action=edit
Sparse test case for __attribute__((designated_init))

The Sparse static analyzer provides an extension to force designated
initialization of a structure, __attribute__((designated_init)).  Given a
structure declared with this attribute, Sparse warns if any instance of that
structure gets initialized using a positional initializer, rather than a
designated initializer.  This is useful for structure types likely to change
layout or gain additional fields in the future, to make initializers of the
structure more resilient.

It would help greatly if GCC could support this attribute as well, to make the
warnings more generally available and visible to developers who aren't using
sparse at compilation time.

I've attached Sparse's test case for designated_init, which provides
comprehensive coverage of cases that should and shouldn't generate warnings.

Reply via email to