summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2020-12-01 23:07:21 +0100
committerWerner Lemberg <wl@gnu.org>2020-12-05 09:43:42 +0100
commitfcdab61ed16f4c2f9b65a8e2ea3394ecb0d33944 (patch)
treed8d305b57295e071e69eafe9869085e88c6c759f
parent741a690ad6dc9c3ff3ce2cead3e97caea6a0e635 (diff)
downloadfreetype2-fcdab61ed16f4c2f9b65a8e2ea3394ecb0d33944.tar.gz
[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.
-rw-r--r--ChangeLog14
-rw-r--r--builds/compiler/gcc-dev.mk2
-rw-r--r--builds/compiler/gcc.mk2
-rw-r--r--builds/freetype.mk3
-rw-r--r--builds/unix/configure.raw34
-rw-r--r--include/freetype/config/ftoption.h2
6 files changed, 26 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index 54c457656..a4231f40b 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 0ccd1161d..6d84b2421 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 c1dcef5ab..cbecdbde6 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 9b5251026..91455ea3e 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 2c04b7e41..f5cf34a94 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 7dcf19771..4d6bfa165 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 */