[RFC] Deprecating and removing -fmessage-length option from Clang

I have been looking into the TextDiagnostic.cpp implementation in clang on the side, trying to improve the way we display text diagnostics and cleaning up the source file while doing so.

One of the things that complicates the implementation significantly is the -fmessage-length option, which tries to limit the length of diagnostic mesages to a certain column width. It the implements some logic to figure out the “interesting” part of the diagnostics (highlighted source ranges might be after the selected column width, etc.).

I have briefly googled and the only usages I have found are people passing 0 explicitly, which disables it (but that’s also the default).

I understand that this option might have been useful at some point in the past, but it anyone actually using it today? When terminal emulators can all do line breaking themselves and so can email clients and text editors used for writing git commit messages?

I think it would be useful to deprecated and remove this option if nobody is using this.

I don’t think that’s going to be possible based on this search:

as it seems the option is still in active use by a fair number of projects.

(It seems Discourse is munging up the link, but the search string I used was context:global -fmessage-length=[1-9][0-9]* -file:.*test.*)

I expected as much but 1) I doubt the usefulness of these project using it and 2) the results of the search are often gcc-specific (which has the same option).

Neither of those points strike me as a reason to move forward with a deprecation though. It’s clear that the option is being used in the wild and our users typically appreciate GCC compatibility. Do you know if GCC is looking to deprecate or remove that feature as well?

The default value is not 0 in the clang driver, it’s StandardErrColumns, which on some platforms/shells will be the current terminal width.