On Sun, Apr 8, 2012 at 11:52 AM, Manuel López-Ibáñez <lopeziba...@gmail.com> wrote: > On 8 April 2012 18:35, Gabriel Dos Reis <g...@integrable-solutions.net> wrote: >> On Sun, Apr 8, 2012 at 11:13 AM, Manuel López-Ibáñez >> <lopeziba...@gmail.com> wrote: >>> On 8 April 2012 06:09, Jason Merrill <ja...@redhat.com> wrote: >>>> On 04/07/2012 06:29 PM, Manuel López-Ibáńez wrote: >>>> >>>>> +getenv_columns (void) >>>> >>>> >>>> I had been thinking to check COLUMNS once at the beginning of compilation; >>>> I >>>> don't think the value can change while the compiler is running since we >>>> don't respond to SIGWINCH. And let's use this value in >>>> c_common_initialize_diagnostics, too. >>>> >>> >>> To focus on the issue at hand, and independently of whether any bugs >>> exist or not, and whether I am capable or not to fix them. What you >>> are proposing is to change the current default of no line-wrapping to >>> line-wrap at getenv("COLUMNS"), isn't it? >> >> yes. > > OK, so to do this, I have to figure out where the pretty-printer is > initialized in each FE. For C++ there are two different places: > > init_error() initializes cxx_pp
global_dc is the global diagnostic context -- that is used by almost every front-end (except Ada and Fortran?) cxx_pp is the C++ front-end-specific global pretty printer: this is where we dump C++ ASTs as strings. It is mostly used only by the various tree -> string functions that are occasionally called from the debugger or by the front-end for things like __PRETTY_FUNCTION__. It is NOT for diagnostic purposes. (it was never meant to survive so many releases.) > whereas cxx_initialize_diagnostics seems to initialize a different > pretty-printer for C++. This is where we allocate a C++ pretty printer attached to the diagnostic context passed in as a parameter. It is this pretty printer that is used by the diagnostic machinery. > > What is the difference between the two? > > Cheers, > > Manuel.