CL /WL

Syntax

positive:

/WL

negative:

/WL-

Relations

The positive and negative forms override each other, of course.

The positive form passes to the front-end C and C++ compilers. The negative form is not passed (though it is recognised by the compilers, if passed via the /d1 option).

Behaviour

This option keeps diagnostic messages (for warnings, errors and fatal errors) to one line each.

In the typical case, the same information as would be displayed without /WL is reformatted with spaces and/or semicolons instead of line breaks. However, it can be that the restriction to a single line is achieved by omitting information, though in the only known cases the information would anyway be displayed only on using an undocumented option.

Diagnostic messages each begin in the form:

position : style Cnumber: text 

where position is typically a filename and line number, style is one of warning, error or fatal error, number is particular to whatever condition prompted the message, and text is the corresponding description of this particular instance of that condition. The text is in something approaching human language and is taken from looking up number among the string resources in the relevant executable (C1 or C1XX) and resolving placeholders. Depending on the condition that prompted the diagnostic, there may then follow additional information, here called notes, to refine the description in ways that are not easily accommodated just by resolving placeholders in the text.

Diagnostic messages have several opportunities to spread over multiple lines. First, the text itself, especially if long, may have been composed with line breaks (indicated by a %$N placeholder in the string resource). Second, placeholders in the text may have a complex resolution. This applies most notably to the elaboration of an identifier that is formed from a template. Third, each note is ordinarily displayed on a new line. In any one diagnostic, all extra lines have some indentation, typically of eight spaces. Some lines have a nested formatting, with further indentation in multiples of four.

The /WL option defeats each of these opportunities for the diagnostic to run to a second line. Each line break in the text is instead resolved to a space. Each note does not get a new line but instead continues the one line after a semicolon and a space. Both behaviours may be seen by compiling a file named TEST.CPP containing

class Test
{
    void operator delete (void *, char *);
};

void func (Test *t)
{
    delete t;
}

The code is in error (C2573). In the English-language version 13.00.9466 inspected for this report, this is the only error (along with a handful of warnings) for which the text contains a line break. The whole error message is ordinarily

TEST.CPP(9) : error C2573: 'Test' : cannot delete pointers to objects of this type; the class has no non-placement overload for 'operator delete'.
        Use ::delete, or add 'operator delete(void*)' to the class
        TEST.CPP(3) : see declaration of 'Test'

showing a long first line of text, a continuation of the text to an indented second line, and finally a note, also indented. With /WL, the error message becomes

TEST.CPP(9) : error C2573: 'Test' : cannot delete pointers to objects of this type; the class has no non-placement overload for 'operator delete'. Use ::delete, or add 'operator delete(void*)' to the class; TEST.CPP(3) : see declaration of 'Test'

Where /WL may lose information is with resolution of placeholders in the text. Compile

TO BE DONE