freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] logging 20c173f 07/12: [build] Use gcc (and clang) in C99 mo


From: Werner LEMBERG
Subject: [freetype2] logging 20c173f 07/12: [build] Use gcc (and clang) in C99 mode.
Date: Thu, 3 Dec 2020 13:31:36 -0500 (EST)

branch: logging
commit 20c173f8e9e759db22a42913fd434a2f7a062940
Author: Werner Lemberg <wl@gnu.org>
Commit: 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.
---
 ChangeLog                          | 14 ++++++++++++++
 builds/compiler/gcc-dev.mk         |  2 +-
 builds/compiler/gcc.mk             |  2 +-
 builds/freetype.mk                 |  1 -
 builds/unix/configure.raw          | 34 +++++++---------------------------
 include/freetype/config/ftoption.h |  2 ++
 6 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3f5c081..9385736 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..e4a1267 100644
--- a/builds/freetype.mk
+++ b/builds/freetype.mk
@@ -155,7 +155,6 @@ endif
 FT_CFLAGS = $(CPPFLAGS) \
             $(CFLAGS) \
             $DFT2_BUILD_LIBRARY \
-            -std=c99
 
 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 */
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]