public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hyena at hyena dot net.ee" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/95763] Feature request: compiler warning if line width exceeds N symbols
Date: Fri, 19 Jun 2020 13:12:59 +0000	[thread overview]
Message-ID: <bug-95763-4-EOs860qoVd@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95763-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95763

--- Comment #2 from Erich Erstu <hyena at hyena dot net.ee> ---
(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.

  parent reply	other threads:[~2020-06-19 13:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19  9:55 [Bug c++/95763] New: " hyena at hyena dot net.ee
2020-06-19 12:08 ` [Bug c++/95763] " redi at gcc dot gnu.org
2020-06-19 13:12 ` hyena at hyena dot net.ee [this message]
2020-06-19 14:42 ` joseph at codesourcery dot com
2020-06-19 14:55 ` jakub at gcc dot gnu.org
2021-04-17 21:36 ` pinskia at gcc dot gnu.org
2024-06-20 20:44 ` mlevine55 at bloomberg dot net

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-95763-4-EOs860qoVd@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).