[Fontconfig] fontconfig: Branch 'master' - 2 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Jan 2 17:05:14 PST 2013


 src/Makefile.am |    3 ++-
 src/fcatomic.h  |    4 ++--
 src/fcinit.c    |   10 ++++++++++
 3 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 32c1d32cbd54686804481fedaa1881d4f3043f1b
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Jan 2 19:04:17 2013 -0600

    Work around Sun CPP
    
    According to Raimund Steger:
    
    > [...]
    > diff --git a/src/Makefile.am b/src/Makefile.am
    > index dc082b7..57c34a2 100644
    > [...]
    > +fcobjshash.gperf: fcobjshash.gperf.h fcobjs.h
    > +    $(AM_V_GEN) $(CPP) -I$(top_srcdir) $< | $(GREP) '^[^#]' | awk ' \
    > +    /CUT_OUT_BEGIN/ { no_write=1; next; }; \
    > +    /CUT_OUT_END/ { no_write=0; next; }; \
    > +    { if (!no_write) print; next; }; \
    > +    ' - > $@.tmp && \
    > +    mv -f $@.tmp $@
    
    Sun Studio CPP seems to insert whitespace in a different way than GCC's CPP.
    
    GCC generates in src/fcobjshash.gperf:
    
    [...]
    "family", FC_FAMILY_OBJECT
    "familylang", FC_FAMILYLANG_OBJECT
    [...]
    
    Sun Studio generates:
    
    [...]
     "family" , FC_FAMILY_OBJECT
     "familylang" , FC_FAMILYLANG_OBJECT
    [...]
    
    leading to:
    
    [...]
    Making all in src
    gmake[2]: Entering directory `/home/rs/src/fontconfig-git/fontconfig/src'
      GEN    fcobjshash.gperf
      GEN    fcobjshash.h
    Key link: " " = " ", with key set "".
    1 input keys have identical hash values,
    use option -D.
    gmake[2]: *** [fcobjshash.h] Error 1
    gmake[2]: Leaving directory `/home/rs/src/fontconfig-git/fontconfig/src'
    gmake[1]: *** [all-recursive] Error 1
    gmake[1]: Leaving directory `/home/rs/src/fontconfig-git/fontconfig'
    gmake: *** [all] Error 2
    
    ...maybe we could tuck in an additional sed to remove the whitespace, like:
    
    [...]
    fcobjshash.gperf: fcobjshash.gperf.h fcobjs.h
        $(AM_V_GEN) $(CPP) -I$(top_srcdir) $< | \
        $(SED) 's/^\s*//;s/\s*,\s*/,/;' | \
        $(GREP) '^[^#]' | \
        $(AWK) '/CUT_OUT_BEGIN/,/CUT_OUT_END/ { next; }; { print; };' \
        > $@.tmp && \
        mv -f $@.tmp $@
    [...]
    
    though I'm not sure what kind of guarantee CPP can give us/what easier option I might have missed...

diff --git a/src/Makefile.am b/src/Makefile.am
index c32c6f3..d3ce428 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -108,7 +108,8 @@ fcobjshash.gperf: fcobjshash.gperf.h fcobjs.h
 	/CUT_OUT_BEGIN/ { no_write=1; next; }; \
 	/CUT_OUT_END/ { no_write=0; next; }; \
 	{ if (!no_write) print; next; }; \
-	' - > $@.tmp && \
+	' - | \
+	sed 's/^ *//;s/ *, */,/' > $@.tmp && \
 	mv -f $@.tmp $@
 
 fcobjshash.h: fcobjshash.gperf
commit b1510145e7a38802bd544de6035fabf9f81f9710
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Jan 2 18:57:47 2013 -0600

    Fix build around true/false

diff --git a/src/fcatomic.h b/src/fcatomic.h
index 073809e..72ae372 100644
--- a/src/fcatomic.h
+++ b/src/fcatomic.h
@@ -94,7 +94,7 @@ typedef volatile int fc_atomic_int_t;
 #define fc_atomic_int_add(AI, V)	(((AI) += (V)) - (V))
 
 #define fc_atomic_ptr_get(P)		((void *) *(P))
-#define fc_atomic_ptr_cmpexch(P,O,N)	(* (void * volatile *) (P) == (void *) (O) ? (* (void * volatile *) (P) = (void *) (N), true) : false)
+#define fc_atomic_ptr_cmpexch(P,O,N)	(* (void * volatile *) (P) == (void *) (O) ? (* (void * volatile *) (P) = (void *) (N), FcTrue) : FcFalse)
 
 
 #else /* FC_NO_MT */
@@ -103,7 +103,7 @@ typedef int fc_atomic_int_t;
 #define fc_atomic_int_add(AI, V)	(((AI) += (V)) - (V))
 
 #define fc_atomic_ptr_get(P)		((void *) *(P))
-#define fc_atomic_ptr_cmpexch(P,O,N)	(* (void **) (P) == (void *) (O) ? (* (void **) (P) = (void *) (N), true) : false)
+#define fc_atomic_ptr_cmpexch(P,O,N)	(* (void **) (P) == (void *) (O) ? (* (void **) (P) = (void *) (N), FcTrue) : FcFalse)
 
 #endif
 
diff --git a/src/fcinit.c b/src/fcinit.c
index 146fbc1..2360764 100644
--- a/src/fcinit.c
+++ b/src/fcinit.c
@@ -25,6 +25,16 @@
 #include "fcint.h"
 #include <stdlib.h>
 
+#if defined(FC_ATOMIC_INT_NIL)
+#pragma message("Could not find any system to define atomic_int macros, library may NOT be thread-safe.")
+#endif
+#if defined(FC_MUTEX_IMPL_NIL)
+#pragma message("Could not find any system to define mutex macros, library may NOT be thread-safe.")
+#endif
+#if defined(FC_ATOMIC_INT_NIL) || defined(FC_MUTEX_IMPL_NIL)
+#pragma message("To suppress these warnings, define FC_NO_MT.")
+#endif
+
 static FcConfig *
 FcInitFallbackConfig (void)
 {


More information about the Fontconfig mailing list