Re: Gcc-12 and SWIG problem

2022-02-21 Thread Steve Grubb
On Monday, February 21, 2022 2:58:43 PM EST Richard W.M. Jones wrote: > > if (arg2) { > > arg1->bar = (char [])(char *)memcpy(malloc((size)*sizeof(char)), (const > > char *)(arg2), sizeof(char)*(size)); > > } else { > > arg1->bar = 0; > > } > > > > which results in > > > > error: cast specifies a

Re: Gcc-12 and SWIG problem

2022-02-21 Thread Richard W.M. Jones
On Mon, Feb 21, 2022 at 01:22:53PM -0500, Steve Grubb wrote: > Hello, > > I have a FTBFS package, audit, that has a strange problem that I'd like to > run by the devel list. It is a common idiom in the kernel to do something > like: > > struct foo{ > unsigned int barlen; > char

Re: Gcc-12 and SWIG problem

2022-02-21 Thread Ben Beasley
This idiom is known as “flexible array member,” and it is standardized since C99. The “bar[0]” syntax you mention is a GCC extension predating C99. I’m not that familiar with the nuances of SWIG, but it looks like SWIG doesn’t understand this at all, and is treating “bar” as a pointer member and

Gcc-12 and SWIG problem

2022-02-21 Thread Steve Grubb
Hello, I have a FTBFS package, audit, that has a strange problem that I'd like to run by the devel list. It is a common idiom in the kernel to do something like: struct foo{ unsigned int barlen; char bar[]; }; There are about 80 instances of this in the kernel headers. When one