Hi,
just tried building the new head.
Behdad Esfahbod wrote:
[...]
New commits:
commit b604f10c0c31a56ae16154dfe6a2f13b795aaabf
Author: Behdad Esfahbod <behdad@xxxxxxxxxx>
Date: Wed Jan 2 01:09:20 2013 -0600
Make fcobjs.c thread-safe
With this, the library should be threadsafe as far as my analysis goes!
[...]
diff --git a/src/fcatomic.h b/src/fcatomic.h
[...]
+#define FC_ATOMIC_INT_NIL 1 /* Warn that fallback implementation is in use. */
+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)
+
+
+#else /* FC_NO_MT */
+
+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)
These give me problems with Sun Studio and older GCC (3.4.3) on Solaris
x86 and SPARC, which ./configure does not define
HAVE_INTEL_ATOMIC_PRIMITIVES for:
gmake[1]: Entering directory `/home/rs/src/fontconfig-git/fontconfig/src'
CC fcatomic.lo
CC fcblanks.lo
CC fccache.lo
fccache.c: In function `FcCacheIsMmapSafe':
fccache.c:80: error: `true' undeclared (first use in this function)
fccache.c:80: error: (Each undeclared identifier is reported only once
fccache.c:80: error: for each function it appears in.)
fccache.c:80: error: `false' undeclared (first use in this function)
[...]
(GCC 4.5.2 and 4.7.1 work.)
[...]
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...
Also, 'make distclean'/'make clean' don't seem to remove
src/fcobjshash.gperf.
Will do some more testing in the next couple of days.
Raimund
--
Worringer Str 31 Duesseldorf 40211 DE home: <rs@xxxxxxxx>
+49-179-2981632 icq 16845346 work: <rs@xxxxxxxxxxxxxxx>
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig