bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Jeffrey Walton <noloader@gmail.com>
To: "bug-gnulib@gnu.org List" <bug-gnulib@gnu.org>
Cc: Alexandre Duret-Lutz <adl@lrde.epita.fr>
Subject: Re: clang++ 11 compilation issues
Date: Wed, 13 Jan 2021 16:04:00 -0500	[thread overview]
Message-ID: <CAH8yC8mVcWFEpjcOoWrxktZQeBr4gDnnsAxbBssxxM38TVShSg@mail.gmail.com> (raw)
In-Reply-To: <2634507.PNdPYx674J@omega>

On Tue, Jan 12, 2021 at 3:19 PM Bruno Haible <bruno@clisp.org> wrote:
>
> Hi Alexandre,
>
> > I'm upgrading a project that used a 8-month-old copy of gnulib to
> > today's version
>
> Since then, gnulib has improved its support for clang.
>
> > I compile with -Werror.
>
> Gnulib generally does not support -Werror on arbitrary platforms.
>
> We try to make for a warning-free compilation on glibc systems with GCC,
> as far as it is reasonable (but it does not work always, due to GCC bugs).
>
> > Testing the result with clang++ 11.0.1-2 (Debian unstable)
>
> Now, using clang with -Wall and -Werror is a recipe for failures, for sure.
>
> This is because clang has _many_ warnings, and
>
>   - Some of the warnings are of the kind "tell me when you did a certain
>     optimization". Most of the warnings in this category are not helpful.
>
>   - Some of the warnings merely enforce certain coding styles. You can
>     try to enforce your preferred coding style on your code, but enforcing
>     it on Gnulib code is a non-starter.
>
>   - Some of the warnings are contradictory.
>
> You are supposed to choose the warnings that are reasonable for your
> project. For some project of mine, I had to disable 20-40 warning options
> before I could get reasonable output.

Perhaps it would be a good idea to filter-out the options that you
don't want present for Gnulib.

If you are doing it during configure, then take the user's CFLAGS (or
CXXFLAGS) and then:

       TCFLAGS=`echo $CFLAGS | sed -e 's/-Wall//g' -e 's/-Wextra//g'
-e 's/-Werror//g'`

If you are doing it during make, then use a recipe like this for Gnulib sources:

    GL_CFLAGS := $(filter-out -Wall -Wextra -Werror% -Wunused
-Wconversion -Wp%, $(CFLAGS))
    ...
    %.o:%.c:
        $CC $(strip $CPPFLAGS $GL_CFLAGS -c) $<

That will put an end to these mailing list messages and bug reports.
You get what you want, and users get what they want.

Otherwise, this is an exercise in insanity. Users keep doing the same
thing, GNU keeps doing the same thing, but everyone expects a
different outcome. Instead of practicing inanity, engineer a fix for
the problem.

Jeff


  reply	other threads:[~2021-01-13 21:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 10:37 clang++ 11 compilation issues Alexandre Duret-Lutz
2021-01-12 18:23 ` Florian Weimer
2021-01-13 11:31   ` Alexandre Duret-Lutz
2021-01-12 20:19 ` Bruno Haible
2021-01-13 21:04   ` Jeffrey Walton [this message]
2021-01-15  8:55     ` different CFLAGS for gnulib code? Bruno Haible
2021-01-15  9:20       ` Alexandre Duret-Lutz
2021-01-15 11:11       ` Paul Eggert
2021-01-15 16:36         ` Darshit Shah
2021-01-15 11:17       ` Simon Josefsson via Gnulib discussion list
2021-01-15 16:08       ` Jim Meyering
2021-01-17 12:55       ` Pádraig Brady
2021-01-14  0:37   ` clang++ 11 compilation issues Paul Eggert
2021-01-14  1:21     ` Bruno Haible
2021-01-14  1:55       ` Paul Eggert
2021-01-14  2:09         ` Bruno Haible
2021-01-14 18:21   ` Alexandre Duret-Lutz

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

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

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

  git send-email \
    --in-reply-to=CAH8yC8mVcWFEpjcOoWrxktZQeBr4gDnnsAxbBssxxM38TVShSg@mail.gmail.com \
    --to=noloader@gmail.com \
    --cc=adl@lrde.epita.fr \
    --cc=bug-gnulib@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).