On Fri, May 09, 2025 at 09:32:50PM +0200, Alejandro Colomar wrote:
> gcc/ChangeLog:
> 
>       * Makefile.in

Missing (USER_H): Add stdcountof.h.

> --- /dev/null
> +++ b/gcc/ginclude/stdcountof.h
> @@ -0,0 +1,31 @@
> +/* Copyright (C) 2025 Free Software Foundation, Inc.
> +
> +This file is part of GCC.
> +
> +GCC is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; either version 3, or (at your option)
> +any later version.
> +
> +GCC is distributed in the hope that it will be useful,
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +GNU General Public License for more details.
> +
> +Under Section 7 of GPL version 3, you are granted additional
> +permissions described in the GCC Runtime Library Exception, version
> +3.1, as published by the Free Software Foundation.
> +
> +You should have received a copy of the GNU General Public License and
> +a copy of the GCC Runtime Library Exception along with this program;
> +see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
> +<http://www.gnu.org/licenses/>.  */
> +
> +/* ISO C2Y: 7.21 Array count <stdcountof.h>.  */
> +
> +#ifndef _STDCOUNTOF_H
> +#define _STDCOUNTOF_H

This should define also
__STDC_VERSION_STDCOUNTOF_H__
macro (guess to 202502L or when the paper has been approved for now
or maybe 202500L as something clearly before that).

> +
> +#define countof _Countof

N3550 says
The macro
countof(...)
expands to _Countof(__VA_ARGS__).

I believe that means it should be function-like macro and
#include <stdcountof.h>
int countof = 42;
IMHO is valid C2Y source.
countof doesn't match any of the J.6.2 patterns, it is listed in J.6.3
instead.

        Jakub

Reply via email to