[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_PROG_CC: how to distinguish clang from gcc?
From: |
Russ Allbery |
Subject: |
Re: AC_PROG_CC: how to distinguish clang from gcc? |
Date: |
Fri, 05 Feb 2021 09:33:19 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
"David A. Wheeler" <dwheeler@dwheeler.com> writes:
> The gcc & clang groups coordinate with each other; they try to provide
> the same flags & API for the same functionality, and occasionally copy
> from each other.
This is not my experience. In particular, the warning flags for Clang are
significantly different than the warning flags for GCC, giving rise to
logic like this to configure warnings used for maintainer builds:
AS_IF([test x"$CLANG" = xyes],
[WARNINGS_CFLAGS="-Werror"
m4_foreach_w([flag],
[-Weverything -Wno-cast-qual -Wno-disabled-macro-expansion -Wno-padded
-Wno-sign-conversion -Wno-reserved-id-macro
-Wno-tautological-pointer-compare -Wno-undef -Wno-unreachable-code
-Wno-unreachable-code-return -Wno-unused-macros
-Wno-used-but-marked-unused],
[RRA_PROG_CC_FLAG(flag,
[WARNINGS_CFLAGS="${WARNINGS_CFLAGS} flag"])])],
[WARNINGS_CFLAGS="-g -O2 -D_FORTIFY_SOURCE=2 -Werror"
m4_foreach_w([flag],
[-fstrict-overflow -fstrict-aliasing -Wall -Wextra -Wformat=2
-Wformat-overflow=2 -Wformat-signedness -Wformat-truncation=2
-Wnull-dereference -Winit-self -Wswitch-enum -Wstrict-overflow=5
-Wmissing-format-attribute -Walloc-zero -Wduplicated-branches
-Wduplicated-cond -Wtrampolines -Wfloat-equal
-Wdeclaration-after-statement -Wshadow -Wpointer-arith
-Wbad-function-cast -Wcast-align -Wwrite-strings -Wconversion
-Wno-sign-conversion -Wdate-time -Wjump-misses-init -Wlogical-op
-Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
-Wmissing-declarations -Wnormalized=nfc -Wpacked -Wredundant-decls
-Wrestrict -Wnested-externs -Winline -Wvla],
[RRA_PROG_CC_FLAG(flag,
[WARNINGS_CFLAGS="${WARNINGS_CFLAGS} flag"])])])
--
Russ Allbery (eagle@eyrie.org) <https://www.eyrie.org/~eagle/>
- Re: Weird behaviour about system types, (continued)
- Re: Weird behaviour about system types, Nick Bowler, 2021/02/04
- Re: Weird behaviour about system types, Sébastien Hinderer, 2021/02/04
- Re: Weird behaviour about system types, Nick Bowler, 2021/02/04
- Re: Weird behaviour about system types, Sébastien Hinderer, 2021/02/05
- AC_PROG_CC: how to distinguish clnag from gcc?, Sébastien Hinderer, 2021/02/05
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Todd C. Miller, 2021/02/05
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Sébastien Hinderer, 2021/02/05
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, David A . Wheeler, 2021/02/05
- Re: AC_PROG_CC: how to distinguish clang from gcc?, David A. Wheeler, 2021/02/05
- Re: AC_PROG_CC: how to distinguish clang from gcc?,
Russ Allbery <=
- Re: AC_PROG_CC: how to distinguish clang from gcc?, Sébastien Hinderer, 2021/02/08
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Russ Allbery, 2021/02/05
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Sébastien Hinderer, 2021/02/08
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Russ Allbery, 2021/02/08
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Sébastien Hinderer, 2021/02/09
- Re: AC_PROG_CC: how to distinguish clnag from gcc?, Paul Eggert, 2021/02/08