Promote -Wno-sizeof-array-argument to an error
Alejandro Colomar
alx@kernel.org
Thu Aug 8 08:12:03 GMT 2024
On Thu, Aug 08, 2024 at 09:31:37AM GMT, Martin Uecker wrote:
> Am Donnerstag, dem 08.08.2024 um 02:36 +0200 schrieb Alejandro Colomar:
> > Hi Martin,
> >
> > Can we promote -Wno-sizeof-array-argument to a hard error? I don't
> > think there's any legitimate use sizeof() on such a parameter.
>
> I am a bit worried that it might prevent people from adding size information
> to arguments, by transforming later use of sizeof on such a pointer argument
> into a hard error.
>
> So I would not do this at this time, until we have fully evolved the
> size checking and the benefits are clear.
Hmmm, I see; makes sense. Thanks!
Alex
>
> >
> > It would be an incompatible extension to ISO C, which would make sure
> > that there are no remaining uses of sizeof(array_param), which would
> > itself allow in the future --if n2906 or something similar is accepted--
> > repurposing sizeof() to return the size in bytes of the array (instead
> > of the size of a pointer) without worrying about breaking existing code.
>
> I agree with this goal, but this is a long term goal.
>
>
> Martin
>
> >
>
>
>
--
<https://www.alejandro-colomar.es/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20240808/3b1e5fdb/attachment.sig>
More information about the Gcc
mailing list