[pango] Ignore undefined macros when importing freetype



commit 0b86506c7c19e3ef0c6581dfbc04aec769af57c3
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed May 31 11:54:43 2017 +0100

    Ignore undefined macros when importing freetype
    
    Recently, freetype added checks for various options and forgot to check
    all combinations. This breaks building projects including freetype.h
    and using -Werror=undef.

 pango/Makefile.am    |    1 +
 pango/meson.build    |    1 +
 pango/pangofc-font.h |   11 +++++++++++
 3 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/pango/Makefile.am b/pango/Makefile.am
index 6df7d52..95b4dd2 100644
--- a/pango/Makefile.am
+++ b/pango/Makefile.am
@@ -15,6 +15,7 @@ SUBDIRS = mini-fribidi
 
 INCLUDES =                                             \
        -DG_LOG_DOMAIN=\"Pango\"                        \
+       -DPANGO_COMPILATION                             \
        -DPANGO_ENABLE_BACKEND                          \
        -DPANGO_ENABLE_ENGINE                           \
        -DSYSCONFDIR=\"$(sysconfdir)\"                  \
diff --git a/pango/meson.build b/pango/meson.build
index 93f2e79..c3c1ad6 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -82,6 +82,7 @@ pango_enum_h = pango_enums[1]
 pango_cflags = [
   '-DG_LOG_DOMAIN="Pango"',
   '-DG_LOG_USE_STRUCTURED=1',
+  '-DPANGO_COMPILATION',
   '-DPANGO_ENABLE_BACKEND',
   '-DPANGO_ENABLE_ENGINE',
   '-DSYSCONFDIR="@0@"'.format(pango_sysconfdir),
diff --git a/pango/pangofc-font.h b/pango/pangofc-font.h
index ab5a12a..954abdc 100644
--- a/pango/pangofc-font.h
+++ b/pango/pangofc-font.h
@@ -23,10 +23,21 @@
 #define __PANGO_FC_FONT_H__
 
 #include <pango/pango.h>
+
+/* Freetype has undefined macros in its header */
+#ifdef PANGO_COMPILATION
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wundef"
+#endif
+
 #include <ft2build.h>
 #include FT_FREETYPE_H
 #include <fontconfig/fontconfig.h>
 
+#ifdef PANGO_COMPILATION
+#pragma GCC diagnostic pop
+#endif
+
 G_BEGIN_DECLS
 
 #define PANGO_TYPE_FC_FONT              (pango_fc_font_get_type ())


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