ref: fcdab61ed16f4c2f9b65a8e2ea3394ecb0d33944
parent: 741a690ad6dc9c3ff3ce2cead3e97caea6a0e635
author: Werner Lemberg <[email protected]>
date: Tue Dec 1 18:07:21 EST 2020
[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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2020-12-01 Werner Lemberg <[email protected]>
+ [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 <[email protected]>
+
[dlg] Fix compiler warnings.
* src/dlg/dlgwrap.c: Duplicate some feature test macros from
--- a/builds/compiler/gcc-dev.mk
+++ b/builds/compiler/gcc-dev.mk
@@ -83,7 +83,7 @@
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
-ANSIFLAGS := -ansi -pedantic
+ANSIFLAGS := -std=c99 -pedantic
# Library linking
--- a/builds/compiler/gcc.mk
+++ b/builds/compiler/gcc.mk
@@ -65,7 +65,7 @@
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
#
-ANSIFLAGS := -ansi -pedantic
+ANSIFLAGS := -std=c99 -pedantic
# Library linking
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -154,8 +154,7 @@
#
FT_CFLAGS = $(CPPFLAGS) \
$(CFLAGS) \
- $DFT2_BUILD_LIBRARY \
- -std=c99
+ $DFT2_BUILD_LIBRARY
FT_COMPILE := $(CC) $(ANSIFLAGS) $(INCLUDE_FLAGS) $(FT_CFLAGS)
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -227,19 +227,11 @@
# 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.
+# 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.
#
-# 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.
-#
if test "x$GCC" = xyes; then
XX_CFLAGS="-Wall"
case "$host" in
@@ -250,23 +242,11 @@
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([
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -442,6 +442,8 @@
* 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 */