On Sun, Jan 31, 2021 at 10:48:53PM +0100, Eric Botcazou wrote:
> > But next time we use SIZE_MAX somewhere it is going to break again this way.
> > If we just define SIZE_MAX if not defined after all includes in system.h, I
> > think it is better than this.
> 
> The existing practice seems to define the missing constants right after the 
> corresponding include, e.g. MAP_FAILED, so I have successfully tested this.
> 
> 
>       * system.h (SIZE_MAX): Define if not already defined.
> 
> -- 
> Eric Botcazou

> diff --git a/gcc/system.h b/gcc/system.h
> index d04f8fd3360..a2218834b43 100644
> --- a/gcc/system.h
> +++ b/gcc/system.h
> @@ -528,6 +528,10 @@ extern void *realloc (void *, size_t);
>  #include <inttypes.h>
>  #endif
>  
> +#ifndef SIZE_MAX
> +# define SIZE_MAX INTTYPE_MAXIMUM (size_t)
> +#endif
> +
>  #ifdef __cplusplus
>  extern "C" {
>  #endif

Ok, thanks.


        Jakub

Reply via email to