https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81512

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
This is a general problem of the diagnostics machinery:

* Macro trace is generated after each diagnostic

* There is no way to create one diagnostic that contains several messages.

However, in this particular case, I think the warning could be smarter in one
of two ways:

* The second note could point the argument instead of the alloca call:

a.c:1:16: warning: argument to ‘alloca’ is too large [-Walloca-larger-than=]
 #define alloca __builtin_alloca
                ^
a.c:5:10: note: in expansion of macro ‘alloca’
   return alloca (12345);
          ^~~~~~
a.c:1:23: note: limit is 12344 bytes, but argument is 12345
   return alloca (12345);
                  ^~~~~

* Alternatively, if the note is always going to be at exactly the same location
as the warning, why not simply include the text in the warning?

a.c:1:16: warning: argument to ‘alloca’ is too large (limit is 12344 bytes, but
argument is 12345) [-Walloca-larger-than=]
 #define alloca __builtin_alloca
                ^
a.c:5:10: note: in expansion of macro ‘alloca’
   return alloca (12345);
          ^~~~~~

Much shorter, saves vertical space.

Reply via email to