freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master 8ab3b39: Fixes for clang++.


From: Werner LEMBERG
Subject: [freetype2-demos] master 8ab3b39: Fixes for clang++.
Date: Sun, 25 Dec 2016 21:44:20 +0000 (UTC)

branch: master
commit 8ab3b39a9ceeadc7ea15ea796e1c1b44f6d38c51
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    Fixes for clang++.
    
    * Makefile (COMPILE): Don't add `-std=c99' if using a C++ compiler.
    
    * src/ftbench.c (_GNU_SOURCE): Declare only if not already defined.
    
    * src/ftcommon.c (_GNU_SOURCE): Declare only if not already defined.
    (FTDemo_Install_Font): Use proper case for `FT_Select_Charmap'.
    
    * src/ftmulti.c (main): Use proper case for `FT_Select_Charmap'.
---
 ChangeLog      |   13 +++++++++++++
 Makefile       |    8 ++++++--
 src/ftbench.c  |    4 +++-
 src/ftcommon.c |    6 ++++--
 src/ftmulti.c  |    2 +-
 5 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 800163a..5c2076f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2016-12-25  Werner Lemberg  <address@hidden>
+
+       Fixes for clang++.
+
+       * Makefile (COMPILE): Don't add `-std=c99' if using a C++ compiler.
+
+       * src/ftbench.c (_GNU_SOURCE): Declare only if not already defined.
+
+       * src/ftcommon.c (_GNU_SOURCE): Declare only if not already defined.
+       (FTDemo_Install_Font): Use proper case for `FT_Select_Charmap'.
+
+       * src/ftmulti.c (main): Use proper case for `FT_Select_Charmap'.
+
 2016-12-20  Werner Lemberg  <address@hidden>
 
        * src/ftmulti.c: Minor clang fixes.
diff --git a/Makefile b/Makefile
index 25ca4ad..e55dcfe 100644
--- a/Makefile
+++ b/Makefile
@@ -133,9 +133,13 @@ else
                   $(INCLUDES:%=$I%) \
                   $DFT_CONFIG_MODULES_H="<ftmodule.h>"
 
-  # Enable C99 for gcc and g++ to avoid warnings.
+  # Enable C99 for gcc to avoid warnings.
+  # Note that clang++ aborts with an error if we use `-std=C99',
+  # so check for `++' in $(CC) also.
   ifneq ($(findstring -pedantic,$(COMPILE)),)
-    COMPILE += -std=c99
+    ifeq ($(findstring ++,$(CC)),)
+      COMPILE += -std=c99
+    endif
   endif
 
   FTLIB := $(LIB_DIR)/$(LIBRARY).$A
diff --git a/src/ftbench.c b/src/ftbench.c
index 8c68305..6c9a4e7 100644
--- a/src/ftbench.c
+++ b/src/ftbench.c
@@ -10,7 +10,9 @@
 /****************************************************************************/
 
 
-#define _GNU_SOURCE /* we want to use extensions to `time.h' if available */
+#ifndef  _GNU_SOURCE
+#define  _GNU_SOURCE /* we want to use extensions to `time.h' if available */
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/src/ftcommon.c b/src/ftcommon.c
index 2855c93..bbcfd37 100644
--- a/src/ftcommon.c
+++ b/src/ftcommon.c
@@ -11,7 +11,9 @@
 /****************************************************************************/
 
 
-#define _GNU_SOURCE /* we use `strcasecmp' */
+#ifndef  _GNU_SOURCE
+#define  _GNU_SOURCE /* we use `strcasecmp' */
+#endif
 
 #include <ft2build.h>
 #include FT_FREETYPE_H
@@ -414,7 +416,7 @@
 
         if ( handle->encoding != FT_ENCODING_NONE )
         {
-          error = FT_Select_Charmap( face, handle->encoding );
+          error = FT_Select_Charmap( face, (FT_Encoding)handle->encoding );
           if ( error )
           {
             FT_Done_Face( face );
diff --git a/src/ftmulti.c b/src/ftmulti.c
index 4577a66..6807456 100644
--- a/src/ftmulti.c
+++ b/src/ftmulti.c
@@ -896,7 +896,7 @@
 
     if ( encoding != FT_ENCODING_NONE )
     {
-      error = FT_Select_Charmap( face, encoding );
+      error = FT_Select_Charmap( face, (FT_Encoding)encoding );
       if ( error )
         goto Display_Font;
     }



reply via email to

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