[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
diff --git a/ChangeLog b/ChangeLog
index 54c4576..a4231f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
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.
* src/dlg/dlgwrap.c: Duplicate some feature test macros from
diff --git a/builds/compiler/gcc-dev.mk b/builds/compiler/gcc-dev.mk
index 0ccd116..6d84b24 100644
--- a/builds/compiler/gcc-dev.mk
+++ b/builds/compiler/gcc-dev.mk
@@ -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
diff --git a/builds/compiler/gcc.mk b/builds/compiler/gcc.mk
index c1dcef5..cbecdbd 100644
--- a/builds/compiler/gcc.mk
+++ b/builds/compiler/gcc.mk
@@ -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
diff --git a/builds/freetype.mk b/builds/freetype.mk
index 9b52510..91455ea 100644
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -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)
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index 2c04b7e..f5cf34a 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -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([
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 7dcf197..4d6bfa1 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -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 */