Florian, Thanks for your suggestion. I'm already using macros, but that results in code that does not look like "C" any more. New "C" developers that are looking at hte code that uses DECLARE_VLA (or similar) macro - have trouble understanding this new construct, how to use it, limitations, etc (e.g., OK to use in `for (DECLARE_VLA(...) ; ; )`. The attribute provide "in-langauge" support for the same functionality in a way that is consistent with [[fallthru]], and similar.
Yair On Thu, Feb 26, 2026 at 6:49 AM Florian Weimer <[email protected]> wrote: > > * Yair Lenga via Gcc: > > > Hi Martin, > > > > Yes - I believe something more "lightweight" than #pragma is needed. > > What I've observed is that it's very "cumbersome", to write > > > > #pragma GCC diagnostic push > > #pragma GCC diagnostic ignored "-Wvla" > > double a[len] ; > > #pragma GCC diagnostic push > > > > Technically, can be "compacted" via #define - but then it's becoming > > something that it's not "C" any more: e .g. > > int foo(int how_many) { > > DECLARE_VLA(ddd, double, how_many) ; // Compact but NOT C > > int x = 5 ; > > } > > Could you achieve this effect if you used _Pragma? It can be part of > macros. The quoting is a bit tricky to get right, though. In your > case, that should be less of an issue because the pragma contents is not > dependent on macro arguments. > > Thanks, > Florian >
