Opened 3 months ago

Closed 3 months ago

#261 closed defect (fixed)

Assignment for flexible array member

Reported by: Thierry Delisle Owned by: Thierry Delisle <tdelisle@…>
Priority: minor Component: cfa-cc
Version: 1.0 Keywords: Warning
Cc:

Description

C supports structures with "flexible array member", i.e.,

struct SomeStruct {
	int NormalFields;
	char FlexibleArray[];
};

These structures do not really have a known size and therefore we shouldn't be automatically generating assignment operators or field constructors.

I can see this being handled in a few ways:

  • Going through all the members in FuncGenerator::genStandardFuncs.
  • Mark the struct as special earlier than that.
  • Have the resolver somehow mark these as unresolvable.

These autogenerated functions cause the following output: "note: the ABI of passing struct with a flexible array member has changed in GCC 4.4"

Change History (1)

comment:1 Changed 3 months ago by Thierry Delisle <tdelisle@…>

Owner: set to Thierry Delisle <tdelisle@…>
Resolution: fixed
Status: newclosed

In 91715ce:

Don't autogen for struct with flexible array members
fixes #261?

Note: See TracTickets for help on using tickets.