This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

Re: ToT glibc build problem with ToT GCC


On 30/08/2019 14:06, Florian Weimer wrote:
> * Carlos O'Donell:
> 
>> Is there a viable solution for a static allocation of a structure
>> that ends in a VLA?
> 
> Sure, use an initializer.  Not sure if this breaks anything.  The test
> suite is clean.
> 
> (GNU C obviously didn't support that when the code was written.)

i didn't know an initializer would be enough.

>  
> -	replace[0].nbytes = 1;
> -	replace[0].bytes[0] = '?';
> -	replace[0].bytes[1] = '\0';
> -	ctype->mboutdigits[cnt] = &replace[0];
> +	static const struct charseq replace =
> +	  {
> +	     .nbytes = 1,
> +	     .bytes = { '\0' },
> +	  };
> +	ctype->mboutdigits[cnt] = (struct charseq *) &replace;
>        }

is it ok to change {'?','\0'} to {'\0'} ?

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