• g++: What command line option allow me to get the most friendly/responsive compiling error message?

    From =?UTF-8?B?8J+HtfCfh7FKYWNlayBNYXJjaW4gSmF3b3Jza2nwn4e18J+HsQ==?=@jmj@energokod.gda.pl to comp.lang.c++ on Mon Apr 27 17:27:44 2026
    From Newsgroup: comp.lang.c++

    Hello!

    What g++ command line option allow me to get the most
    friendly/responsive compiling error message? I use:

    -Wformat=2

    which is not very friendly.
    --
    Have a nice day!
    Jacek Marcin Jaworski, Pruszcz Gd., woj. Pomorskie, Polska Efc|Efc#, EU Efc-Efc|;
    tel.: +48-609-170-742, najlepiej w godz.: 5:00-5:55 lub 16:00-17:25; <jmj@energokod.gda.pl>, gpg: 4A541AA7A6E872318B85D7F6A651CC39244B0BFA;
    Domowa s. WWW: <https://energokod.gda.pl>;
    Mini Netykieta: <https://energokod.gda.pl/MiniNetykieta.html>;
    Mailowa Samoobrona: <https://emailselfdefense.fsf.org/pl>.
    UWAGA:
    NIE ZACI-aGAJ "UKRYTEGO D+UUGU"! P+UA-a ZA PROG. FOSS I INFO. INTERNETOWE! CZYTAJ DARMOWY: "17. Raport Totaliztyczny - Patroni Kontra Bankierzy": <https://energokod.gda.pl/raporty-totaliztyczne/17.%20Patroni%20Kontra%20Bankierzy.pdf>
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Michael S@already5chosen@yahoo.com to comp.lang.c++ on Mon Apr 27 18:43:33 2026
    From Newsgroup: comp.lang.c++

    On Mon, 27 Apr 2026 17:27:44 +0200
    Efc|Efc#Jacek Marcin JaworskiEfc|Efc# <jmj@energokod.gda.pl> wrote:
    Hello!

    What g++ command line option allow me to get the most
    friendly/responsive compiling error message? I use:

    -Wformat=2

    which is not very friendly.

    Friendly is in the eye of beholder.
    Responsive? That I don't understand at all. What exactly do you mean by
    that?
    -Wformat=2 influences warnings related to format specifiers in printf
    family. It has no effect on the rest of the warnings and certainly has
    no effect on error messages.
    BTW, docs are here: https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/Warning-Options.html
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From =?UTF-8?B?8J+HtfCfh7FKYWNlayBNYXJjaW4gSmF3b3Jza2nwn4e18J+HsQ==?=@jmj@energokod.gda.pl to comp.lang.c++ on Mon Apr 27 18:20:09 2026
    From Newsgroup: comp.lang.c++

    W dniu 27.04.2026 o-a17:27, Efc|Efc#Jacek Marcin JaworskiEfc|Efc# pisze:
    Hello!

    What g++ command line option allow me to get the most
    friendly/responsive compiling error message? I use:

    -Wformat=2

    which is not very friendly.

    In the middle time I ask ChatGPT, and it give me some advises:

    -fdiagnostics-color=always -fdiagnostics-show-caret
    -fdiagnostics-show-option -fdiagnostics-show-template-tree -fmax-errors=5

    , but is this optimal?
    --
    Jacek Marcin Jaworski, Pruszcz Gd., woj. Pomorskie, Polska Efc|Efc#, EU Efc-Efc|;
    tel.: +48-609-170-742, najlepiej w godz.: 5:00-5:55 lub 16:00-17:25; <jmj@energokod.gda.pl>, gpg: 4A541AA7A6E872318B85D7F6A651CC39244B0BFA;
    Domowa s. WWW: <https://energokod.gda.pl>;
    Mini Netykieta: <https://energokod.gda.pl/MiniNetykieta.html>;
    Mailowa Samoobrona: <https://emailselfdefense.fsf.org/pl>.
    UWAGA:
    NIE ZACI-aGAJ "UKRYTEGO D+UUGU"! P+UA-a ZA PROG. FOSS I INFO. INTERNETOWE! CZYTAJ DARMOWY: "17. Raport Totaliztyczny - Patroni Kontra Bankierzy": <https://energokod.gda.pl/raporty-totaliztyczne/17.%20Patroni%20Kontra%20Bankierzy.pdf>

    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Michael S@already5chosen@yahoo.com to comp.lang.c++ on Mon Apr 27 19:29:49 2026
    From Newsgroup: comp.lang.c++

    On Mon, 27 Apr 2026 18:20:09 +0200
    Efc|Efc#Jacek Marcin JaworskiEfc|Efc# <jmj@energokod.gda.pl> wrote:
    W dniu 27.04.2026 o-a17:27, Efc|Efc#Jacek Marcin JaworskiEfc|Efc# pisze:
    Hello!

    What g++ command line option allow me to get the most
    friendly/responsive compiling error message? I use:

    -Wformat=2

    which is not very friendly.

    In the middle time I ask ChatGPT, and it give me some advises:

    -fdiagnostics-color=always -fdiagnostics-show-caret -fdiagnostics-show-option -fdiagnostics-show-template-tree
    -fmax-errors=5

    , but is this optimal?

    Your questions are impossible to answer before you explain to us what do
    you want.
    And no, "friendly", "responsive" and "optimal" are not explanations.
    The best use of chat bot would be to ask it to translate your very
    detailed wishes from Polish to English. Then ask it translate back from
    English to Polish, fix parts you are not happy about and repeat this
    loop until satisfied.
    Then come here with last translated variant.
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.lang.c++ on Mon Apr 27 18:53:36 2026
    From Newsgroup: comp.lang.c++

    =?UTF-8?B?8J+HtfCfh7FKYWNlayBNYXJjaW4gSmF3b3Jza2nwn4e18J+HsQ==?= <jmj@energokod.gda.pl> writes:
    W dniu 27.04.2026 o-a17:27, Efc|Efc#Jacek Marcin JaworskiEfc|Efc# pisze:
    Hello!

    What g++ command line option allow me to get the most
    friendly/responsive compiling error message? I use:

    -Wformat=2

    which is not very friendly.

    In the middle time I ask ChatGPT, and it give me some advises:

    -fdiagnostics-color=always -fdiagnostics-show-caret >-fdiagnostics-show-option -fdiagnostics-show-template-tree -fmax-errors=5

    , but is this optimal?

    Optimal is the set of options that reduce the number of
    lines of diagnostic per detected syntax error to exactly one.

    Every release, gcc gets more verbose, and multiple
    diagnostic lines per error are very annoying.

    CFLAGS += -fno-diagnostics-show-caret
    CFLAGS += -fno-diagnostics-show-option

    at a minimum.

    I prefer -Wformat=1, to avoid spurious warnings when the
    format string is not a string constant, yet is completely under
    control of the application (I.e. not dependent upon
    any input from the end-user).

    YMMV.
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From James Kuyper@jameskuyper@alumni.caltech.edu to comp.lang.c++ on Mon Apr 27 17:28:09 2026
    From Newsgroup: comp.lang.c++

    On 2026-04-27 11:27, Efc|Efc#Jacek Marcin JaworskiEfc|Efc# wrote:
    Hello!

    What g++ command line option allow me to get the most
    friendly/responsive compiling error message? I use:

    -Wformat=2

    which is not very friendly.

    That is a highly subjective opinion. You'll get different answers from different people. In general, each person's answer is "right" for that
    person, but not necessarily for anyone else. I normally build using
    make, which looks for and uses an environment variable named CXXFLAGS
    when compiling C++ code, and I've got CXXFLAGS set to:

    -std=c++23 -pedantic -Wall -O2 -Wpointer-arith -Wcast-align -fno-enforce-eh-specs -fno-gnu-keywords -fno-nonansi-builtins -Wctor-dtor-privacy -Wnon-virtual-dtor -Wold-style-cast
    -Woverloaded-virtual -Wsign-promo

    I guarantee you that my posting that list of options will cause many
    people to disagree - whether they'll bother saying so, I don't know.

    --- Synchronet 3.21f-Linux NewsLink 1.2