Actually, this is a feature request, not a bug report. It would be very useful if I could specify in a source file the maximum number of symbols per line that the source file is allowed to contain. If some line exceeds that limit, then the compiler should print the respective warning mentioning the line number where the limit is exceeded.
This seems like a better fit for something like clang-tidy than being hardcoded into the compiler.
(In reply to Jonathan Wakely from comment #1) > This seems like a better fit for something like clang-tidy than being > hardcoded into the compiler. I can see the reasoning there, but different source/header files may have different maximum line width limitations. For example, we may have a project where most files are limited to 80 symbols per line but a subset of header files is limited to 240 symbols per line (as an exception). So, this could not be handled as a project-wide restriction but rather case-by-case. For example, those header files may contain large multidimensional nested arrays/tables (basically data) which requires an exception to be made. For the above reasons, it would make sense to keep the line width limit as part of the code file that is supposed to respect that limit. Clang-tidy would have to get these limits from an external configuration file which bloats the project. Since GCC already implements special comments such as "// fall through" for switch statements, I could see this implemented similarly, as a comment in the beginning of the code file.
FWIW, the Ada front end has some style checking support (I once broke bootstrap by applying spelling corrections there, where fixing the spelling in a comment made a line too long). It wouldn't be ridiculous to have such checks available for C and C++, so far as formatting checks work reasonably in the presence of macros.
The fortran FE also has diagnostics about source line lengths. The question is e.g. if comments should be an exception or not.
I assume you are talking about stuff like: int t, t1, t2, t43, t55, t6, t7888888, t99999, t999876, t323434, ttsdgsdg, thfgd, tdfhghh, t354635463546; ? If so confirmed. I have not looked into how to do this and if this is normally not useful without a code style checker. Having a code style checker part of GCC would be a good long term really.
Has there been an effort already to add a code style checker as part of GCC, similar to clang-tidy?