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

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

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

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
It's very error-prone to make these kinds of changes.  Absent designated
initializers the problem could be avoided by defining an initialization macro
and using it to initialize the elements.  E.g., something like this:

#define ATTR_SPEC_INIT(name, min_len, max_len, decl_req, type_req, fn_type_req,
affects_type_identity, handler, exclude) \
  { name, min_len, max_len, decl_req, type_req, fn_type_req,
affects_type_identity, handler, exclude }

With more than one such initialization macro new members could also be added
without having to disturb all those that don't need to set it to a non-default
value.  E.g.,

#define ATTR_SPEC_DECL_INIT(name) \
  ATTR_SPEC_INIT (name, 0, 0, true, false, false, false, NULL, NULL }

#define ATTR_SPEC_TYPE_INIT(name) \
  ATTR_SPEC_INIT (name, 0, 0, false, true false, false, NULL, NULL }

etc.

Another alternative is to move the tables into their own files compiled using
the C compiler and make use of designated initializers.

Reply via email to