On Mon, Sep 21, 2015 at 12:46 PM, Manuel López-Ibáñez <lopeziba...@gmail.com> wrote: > On 21 September 2015 at 12:29, Richard Biener > <richard.guent...@gmail.com> wrote: >>>> least note the function we are failing to inline to (thus, use >>>> DECL_SOURCE_LOCATION >>>> of cfun->decl). So better add a diag_location and compute that upfront to >>>> avoid >>>> repeating the check. >>> >>> error ("inlining failed in call to always_inline %q+F: %s", fn, >>> cgraph_inline_failed_string (reason)); >>> >>> The call is using '+F', thus the location is set to some location >>> related to F, depending on which *_printer function is active at that >>> moment. cp_printer uses location_of, and default_tree_printer uses >>> DECL_SOURCE_LOCATION. Is the default_tree_printer always used at this >>> point? If yes, I completely agree we should use an explicit >>> DECL_SOURCE_LOCATION. The meaning of '+' is not only opaque but it >>> breaks #pragma GCC diagnostic. >> >> But it prints the location of the function we failed to inline. I >> want to retain >> at least an approximation to the location of the call, which is the location >> of the function we inline _to_. > > I think I misunderstood you. Do you mean something like? > > if (gimple_location (stmt) != UNKNOWN_LOCATION) > inform (gimple_location (stmt), "called from here"); > else > inform (DECL_SOURCE_LOCATION (cfun->decl), "called from this > function");
Yes. (now that location may also be UNKNOWN in which case I don't have a good fallback idea and we can drop the note) Richard. > > Cheers, > > Manuel.