This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Preventing ISO C errors when using macros for builtin types


On Tue, 11 Jun 2019 18:01:55 -0500
Segher Boessenkool <segher@kernel.crashing.org> wrote:
> On Tue, Jun 11, 2019 at 09:44:30PM +0100, Jozef Lawrynowicz wrote:
> > --- a/gcc/lto/lto-lang.c
> > +++ b/gcc/lto/lto-lang.c
> > @@ -1260,9 +1260,9 @@ lto_build_c_type_nodes (void)
> >  	if (int_n_enabled_p[i])
> >  	  {
> >  	    char name[50];
> > -	    sprintf (name, "__int%d unsigned", int_n_data[i].bitsize);
> > +	    sprintf (name, "int%d", int_n_data[i].bitsize);
> >  
> > -	    if (strcmp (name, SIZE_TYPE) == 0)
> > +	    if (strstr (SIZE_TYPE, name) != NULL)
> >  	      {
> >  		intmax_type_node = int_n_trees[i].signed_type;
> >  		uintmax_type_node = int_n_trees[i].unsigned_type;  
> 
> I don't think that is correct, strstr allows too much?  If you want to
> allow some variants, you should test for all those variants exactly?

Yeah I'll fix this up in my full patch submission.

> It looks great otherwise :-)
> 
> 
> Segher

Great, thanks for all your help!

Jozef


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