[build] Use gcc (and clang) in C99 mode.

Other compilers are unchanged.

* builds/compiler/gcc-dev.mk, builds/compiler/gcc.mk (ANSIFLAGS):
s/-ansi/-std=c99/.

* builds/freetype.mk (FT_CFLAGS): Remove `-std=c99`.

* builds/unix/configure.raw: Handle C99.
Remove no longer needed test for gcc 4.6 and earlier.
This commit is contained in:
Werner Lemberg 2020-12-01 23:07:21 +01:00
parent 741a690ad6
commit fcdab61ed1
6 changed files with 26 additions and 31 deletions

View File

@ -1,3 +1,17 @@
2020-12-01 Werner Lemberg <wl@gnu.org>
[build] Use gcc (and clang) in C99 mode.
Other compilers are unchanged.
* builds/compiler/gcc-dev.mk, builds/compiler/gcc.mk (ANSIFLAGS):
s/-ansi/-std=c99/.
* builds/freetype.mk (FT_CFLAGS): Remove `-std=c99`.
* builds/unix/configure.raw: Handle C99.
Remove no longer needed test for gcc 4.6 and earlier.
2020-12-01 Werner Lemberg <wl@gnu.org>
[dlg] Fix compiler warnings.

View File

@ -83,7 +83,7 @@ endif
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS := -ansi -pedantic
ANSIFLAGS := -std=c99 -pedantic
# Library linking

View File

@ -65,7 +65,7 @@ CFLAGS ?= -c -g -O3 -Wall
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
ANSIFLAGS := -ansi -pedantic
ANSIFLAGS := -std=c99 -pedantic
# Library linking

View File

@ -154,8 +154,7 @@ endif
#
FT_CFLAGS = $(CPPFLAGS) \
$(CFLAGS) \
$DFT2_BUILD_LIBRARY \
-std=c99
$DFT2_BUILD_LIBRARY
FT_COMPILE := $(CC) $(ANSIFLAGS) $(INCLUDE_FLAGS) $(FT_CFLAGS)

View File

@ -227,18 +227,10 @@ AC_CHECK_FUNCS([memcpy memmove])
# get compiler flags right
#
# We try to make the compiler work for C89-strict source. Even if the
# C compiler is gcc and C89 flags are available, some system headers
# (e.g., Android Bionic libc) are broken in C89 mode. We have to check
# whether the compilation finishes successfully.
#
# Due to bugs in mingwrt 4.0.3 we don't use `-ansi' for MinGW.
#
# To avoid zillions of
#
# ISO C90 does not support 'long long'
#
# warnings, we disable `-pedantic' for gcc version < 4.6.
# We try to make the compiler work for C99-strict source. Even if the
# C compiler is gcc and C99 flags are available, some system headers
# might be broken in C99 mode. We have to check whether compilation
# finishes successfully.
#
if test "x$GCC" = xyes; then
XX_CFLAGS="-Wall"
@ -250,23 +242,11 @@ if test "x$GCC" = xyes; then
XX_ANSIFLAGS="-pedantic"
;;
*)
GCC_VERSION=`$CC -dumpversion`
GCC_MAJOR=`echo "$GCC_VERSION" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
GCC_MINOR=`echo "$GCC_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
XX_PEDANTIC=-pedantic
if test $GCC_MAJOR -lt 4; then
XX_PEDANTIC=
else
if test $GCC_MAJOR -eq 4 -a $GCC_MINOR -lt 6; then
XX_PEDANTIC=
fi
fi
XX_ANSIFLAGS=""
for a in $XX_PEDANTIC -ansi
for a in "-pedantic" "-std=c99"
do
AC_MSG_CHECKING([gcc compiler flag ${a} to assure ANSI C works correctly])
AC_MSG_CHECKING([$CC compiler flag ${a} to assure ANSI C99 works correctly])
orig_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${XX_ANSIFLAGS} ${a}"
AC_COMPILE_IFELSE([

View File

@ -442,6 +442,8 @@ FT_BEGIN_HEADER
* trace log messages to a file instead of `stderr`. For writing logs
* to a file, FreeType uses an the external `dlg` library (the source
* code is in `src/dlg`).
*
* This option needs a C99 compiler.
*/
/* #define FT_LOGGING */