This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [google][RFA] add extra text to stack frame warnings (issue4479046)


On Thu, May 5, 2011 at 12:19, Andrew Pinski <pinskia@gmail.com> wrote:
> Is there a reason why this cannot be an option that someone passes on
> the command line of GCC instead of a configure option?

I don't think we ever considered that approach.
That's actually a great idea, I think better for our purposes than a
configuration option.
(Previously, it didn't much matter, since in our tree this was a small
local patch directly to final.c.)

Thank you, I'm going to do over taking the approach you suggested.


> Also can you
> show an example of why this message would be changed?

We use the stack frame size warning on some of our internal code.
(Obvious, I guess -- otherwise, why would I be messing with it.  8-)

In summary, -Wframe-larger-than does not always produce obvious results.  8-)

There are common questions, e.g.:
* why we care about this warning at all (i.e., "why does stack frame
size matter?!").
* how to identify the cause of the warning (since it's not necessarily
obvious what's causing stack growth, and because the warning is
somewhat ... finicky thanks to inlining and thanks to
sometimes-less-than-great reuse of stack space from dead variables in
optimized and especially unoptimized code).
* how to work around, or if absolutely necessary disable the warning.

So, to help, when we output the frame-size warning, we also provide a
link to an internal documentation page to help with the stuff
mentioned above.

Of necessity, the doc link we provide explains our internal
circumstances and workarounds.  (Generic documentation wouldn't help
with a number of the questions.)


In theory, a more general warning-text-addition mechanism could be useful.
e.g. a flag that said "when outputting a warning about flag 'foo',
output this additional text" could be useful.
However, we haven't felt the need to do this for other warnings.

IMO, a general solution along these lines would be solving a problem
that ~nobody has.  8-)

If one wanted to dive into warning message changes, there are other,
more substantial changes IMO that would be generally useful and would
enable this type of functionality via external tools.
E.g., structured warnings with fixed identifiers (numbers, words,
whatever), blah blah blah.
If there were support for *that*, then people could write wrapper
tools that automatically annotate warnings with additional information
as necessary.
(it would also make parsing errors/warnings a lot easier.  8-)



Anyway, thanks for the suggestion.  8-)


chris


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]