[cairo-commit] 4 commits - build/aclocal.cairo.m4 build/configure.ac.features build/configure.ac.system src/cairo-atomic-private.h src/cairo-compiler-private.h src/cairo-image-surface.c src/cairo-mutex-impl-private.h src/cairo-mutex-private.h src/cairo-os2-private.h src/cairo-reference-count-private.h src/cairo-region-private.h src/cairo-types-private.h src/cairo-wideint-type-private.h src/check-cairoint.sh src/check-includes.sh src/Makefile.am
Behdad Esfahbod
behdad at kemper.freedesktop.org
Fri Sep 19 14:22:22 PDT 2008
build/aclocal.cairo.m4 | 13 ---------
build/configure.ac.features | 2 -
build/configure.ac.system | 2 -
src/Makefile.am | 2 -
src/cairo-atomic-private.h | 4 +--
src/cairo-compiler-private.h | 2 +
src/cairo-image-surface.c | 5 +++
src/cairo-mutex-impl-private.h | 4 ++-
src/cairo-mutex-private.h | 4 ---
src/cairo-os2-private.h | 6 ++--
src/cairo-reference-count-private.h | 8 ------
src/cairo-region-private.h | 8 ++++--
src/cairo-types-private.h | 2 -
src/cairo-wideint-type-private.h | 2 +
src/check-cairoint.sh | 22 ----------------
src/check-includes.sh | 48 ++++++++++++++++++++++++++++++++++++
16 files changed, 71 insertions(+), 63 deletions(-)
New commits:
commit d84752605a4aee96fa872a97a50e59a44ee7051a
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Sep 19 17:17:03 2008 -0400
Make sure (and check) that all private headers include some cairo header first
The macros CAIRO_BEGIN_DECLS and CAIRO_END_DECLS are declared in two
places: config.h and cairo.h. On Win32 build there is no config.h. So,
we can't rely on pulling CAIRO_BEGIN_DECLS from there. Hence, we now:
* Not add those declarations to config.h anymore,
* Test that every cairo private header includes some other cairo
header before any other includes.
These two are fairly enough to ensure that cairo.h is seen from all
private headers. There's still the case of headers not including
any header file at all. I'll fix that later.
diff --git a/build/aclocal.cairo.m4 b/build/aclocal.cairo.m4
index 2187e4e..8292e8e 100644
--- a/build/aclocal.cairo.m4
+++ b/build/aclocal.cairo.m4
@@ -130,17 +130,4 @@ AC_DEFUN([CAIRO_CHECK_ATOMIC_OP_NEEDS_MEMORY_BARRIER],
fi
])
-AC_DEFUN([CAIRO_BEGINEND_DECLS],
-[dnl
-AH_BOTTOM([
-#ifdef __cplusplus
-# define CAIRO_BEGIN_DECLS extern "C" {
-# define CAIRO_END_DECLS }
-#else
-# define CAIRO_BEGIN_DECLS
-# define CAIRO_END_DECLS
-#endif
-])dnl
-])
-
AC_DEFUN([CAIRO_TEXT_WRAP], [m4_text_wrap([$1], [$2],, 78)])
diff --git a/build/configure.ac.system b/build/configure.ac.system
index 519991d..2102627 100644
--- a/build/configure.ac.system
+++ b/build/configure.ac.system
@@ -2,8 +2,6 @@ dnl
dnl Non-failing checks for functions, headers, libraries, etc go here
dnl
-CAIRO_BEGINEND_DECLS
-
dnl ====================================================================
dnl Feature checks
dnl ====================================================================
diff --git a/src/Makefile.am b/src/Makefile.am
index 7d26f26..65f7017 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,7 +72,7 @@ TESTS_SH = \
check-def.sh \
check-plt.sh \
check-headers.sh \
- check-cairoint.sh \
+ check-includes.sh \
check-doc-syntax.sh\
$(NULL)
TESTS += $(TESTS_SH)
diff --git a/src/cairo-atomic-private.h b/src/cairo-atomic-private.h
index 56ae7d2..fb5e60d 100644
--- a/src/cairo-atomic-private.h
+++ b/src/cairo-atomic-private.h
@@ -37,12 +37,12 @@
#ifndef CAIRO_ATOMIC_PRIVATE_H
#define CAIRO_ATOMIC_PRIVATE_H
+# include "cairo-compiler-private.h"
+
#if HAVE_CONFIG_H
#include "config.h"
#endif
-# include "cairo-compiler-private.h"
-
CAIRO_BEGIN_DECLS
#if HAVE_INTEL_ATOMIC_PRIMITIVES
diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h
index 9a53234..fc41645 100644
--- a/src/cairo-compiler-private.h
+++ b/src/cairo-compiler-private.h
@@ -38,6 +38,8 @@
#ifndef CAIRO_COMPILER_PRIVATE_H
#define CAIRO_COMPILER_PRIVATE_H
+#include "cairo.h"
+
#if HAVE_CONFIG_H
#include "config.h"
#endif
diff --git a/src/cairo-mutex-impl-private.h b/src/cairo-mutex-impl-private.h
index b8f32a4..ec7b578 100644
--- a/src/cairo-mutex-impl-private.h
+++ b/src/cairo-mutex-impl-private.h
@@ -41,6 +41,8 @@
#ifndef CAIRO_MUTEX_IMPL_PRIVATE_H
#define CAIRO_MUTEX_IMPL_PRIVATE_H
+#include "cairo.h"
+
#if HAVE_CONFIG_H
#include "config.h"
#endif
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index d4bf68b..61b87d7 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -41,10 +41,6 @@
#ifndef CAIRO_MUTEX_PRIVATE_H
#define CAIRO_MUTEX_PRIVATE_H
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include "cairo-mutex-type-private.h"
CAIRO_BEGIN_DECLS
diff --git a/src/cairo-os2-private.h b/src/cairo-os2-private.h
index 6e8eb7b..5fa2829 100644
--- a/src/cairo-os2-private.h
+++ b/src/cairo-os2-private.h
@@ -38,6 +38,9 @@
#ifndef CAIRO_OS2_PRIVATE_H
#define CAIRO_OS2_PRIVATE_H
+#include "cairo-os2.h"
+#include "cairoint.h"
+
#define INCL_DOS
#define INCL_DOSSEMAPHORES
#define INCL_DOSERRORS
@@ -49,9 +52,6 @@
# include <os2emx.h>
#endif
-#include "cairo-os2.h"
-#include "cairoint.h"
-
typedef struct _cairo_os2_surface
{
cairo_surface_t base;
diff --git a/src/cairo-reference-count-private.h b/src/cairo-reference-count-private.h
index 8dbc1ab..d6adaad 100644
--- a/src/cairo-reference-count-private.h
+++ b/src/cairo-reference-count-private.h
@@ -37,14 +37,8 @@
#ifndef CAIRO_REFRENCE_COUNT_PRIVATE_H
#define CAIRO_REFRENCE_COUNT_PRIVATE_H
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
#include "cairo-atomic-private.h"
-CAIRO_BEGIN_DECLS
-
/* Encapsulate operations on the object's reference count */
typedef struct {
cairo_atomic_int_t ref_count;
@@ -65,6 +59,4 @@ typedef struct {
#define CAIRO_REFERENCE_COUNT_HAS_REFERENCE(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) > 0)
-CAIRO_END_DECLS
-
#endif
diff --git a/src/cairo-region-private.h b/src/cairo-region-private.h
index 1902500..352a23f 100644
--- a/src/cairo-region-private.h
+++ b/src/cairo-region-private.h
@@ -37,11 +37,13 @@
#ifndef CAIRO_REGION_PRIVATE_H
#define CAIRO_REGION_PRIVATE_H
-#include <pixman.h>
-
#include "cairo-compiler-private.h"
#include "cairo-types-private.h"
+#include <pixman.h>
+
+CAIRO_BEGIN_DECLS
+
/* #cairo_region_t is defined in cairoint.h */
struct _cairo_region {
@@ -109,4 +111,6 @@ cairo_private pixman_region_overlap_t
_cairo_region_contains_rectangle (cairo_region_t *region, cairo_rectangle_int_t *box);
+CAIRO_END_DECLS
+
#endif /* CAIRO_REGION_PRIVATE_H */
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index 006aec0..6859736 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -39,8 +39,6 @@
#ifndef CAIRO_TYPES_PRIVATE_H
#define CAIRO_TYPES_PRIVATE_H
-/* This is the only header file not including cairoint.h. It only contains
- * typedefs.*/
#include "cairo.h"
#include "cairo-fixed-type-private.h"
diff --git a/src/cairo-wideint-type-private.h b/src/cairo-wideint-type-private.h
index fdcfe1d..3d24150 100644
--- a/src/cairo-wideint-type-private.h
+++ b/src/cairo-wideint-type-private.h
@@ -37,6 +37,8 @@
#ifndef CAIRO_WIDEINT_TYPE_H
#define CAIRO_WIDEINT_TYPE_H
+#include "cairo.h"
+
#if HAVE_CONFIG_H
#include "config.h"
#endif
diff --git a/src/check-cairoint.sh b/src/check-cairoint.sh
deleted file mode 100755
index f9d3fef..0000000
--- a/src/check-cairoint.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-LANG=C
-
-test -z "$srcdir" && srcdir=.
-stat=0
-
-echo 'Checking source files for missing or misplaced #include "cairoint.h"'
-
-cd "$srcdir"
-FILES=$all_cairo_sources
-if test "x$FILES" = x; then
- FILES=`find . -name 'cairo*.c' -or -name 'cairo*.cpp'`
-fi
-
-for x in $FILES; do
- grep '\<include\>' "$x" /dev/null | head -n 1
-done |
-grep -v '"cairoint[.]h"' |
-grep . && stat=1
-
-exit $stat
diff --git a/src/check-includes.sh b/src/check-includes.sh
new file mode 100755
index 0000000..ead88ef
--- /dev/null
+++ b/src/check-includes.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+LANG=C
+
+test -z "$srcdir" && srcdir=.
+cd "$srcdir"
+stat=0
+
+
+echo 'Checking that public header files #include "cairo.h" first (or none)'
+
+FILES=$all_cairo_headers
+test "x$FILES" = x && FILES=`find . -name 'cairo*.h' ! -name 'cairo*-private.h' ! -name 'cairoint.h'`
+
+for x in $FILES; do
+ grep '\<include\>' "$x" /dev/null | head -n 1
+done |
+grep -v '"cairo[.]h"' |
+grep -v 'cairo[.]h:' |
+grep . && stat=1
+
+
+echo 'Checking that private header files #include "some cairo header" first (or none)'
+
+FILES=$all_cairo_private
+test "x$FILES" = x && FILES=`find . -name 'cairo*-private.h'`
+
+for x in $FILES; do
+ grep '\<include\>' "$x" /dev/null | head -n 1
+done |
+grep -v '"cairo.*[.]h"' |
+grep -v 'cairoint[.]h:' |
+grep . && stat=1
+
+
+echo 'Checking that source files #include "cairoint.h" first (or none)'
+
+FILES=$all_cairo_sources
+test "x$FILES" = x && FILES=`find . -name 'cairo*.c' -or -name 'cairo*.cpp'`
+
+for x in $FILES; do
+ grep '\<include\>' "$x" /dev/null | head -n 1
+done |
+grep -v '"cairoint[.]h"' |
+grep . && stat=1
+
+
+exit $stat
commit eb89bf049a4c2ab0946c45a1277bfd8b1519efa1
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Sep 19 16:52:59 2008 -0400
Check for _MSC_VER in mutex implementation code
Previously I made the mutex implementation code to use Windows mutexes
conditional on HAVE_WINDOWS_H. This was suppposed to be a more wine-friendly
version of checking for a Windows platform. However, it also meant that
when compiling without config.h, one had to stuff a #define for HAVE_WINDOWS_H
somewhere. Traditionally it was put in cairo-features-win32.h, and that
practice was carried over even after my build system rewrite.
Somewhere along the road I also decided that the mutex implementation header
does not need to include anything other than config.h. So the hacked up
HAVE_WINDOWS_H in cairo-features-win32.h was not being seen by its lone
user.
We now condition on any of HAVE_WINDOWS_H and _MSC_VER. So the hack can be
removed altogether.
diff --git a/build/configure.ac.features b/build/configure.ac.features
index e23d9ce..fcdc77f 100644
--- a/build/configure.ac.features
+++ b/build/configure.ac.features
@@ -292,8 +292,6 @@ CAIRO_CONFIG_COMMANDS([$srcdir/src/cairo-features-win32.h],
echo '#ifndef CAIRO_FEATURES_H'
echo '#define CAIRO_FEATURES_H'
echo ''
- echo '#define HAVE_WINDOWS_H 1'
- echo ''
for FEATURE in $CAIRO_WIN32_FEATURES; do
echo "#define $FEATURE 1"
done
diff --git a/src/cairo-mutex-impl-private.h b/src/cairo-mutex-impl-private.h
index db65bd1..b8f32a4 100644
--- a/src/cairo-mutex-impl-private.h
+++ b/src/cairo-mutex-impl-private.h
@@ -174,7 +174,7 @@
# define CAIRO_MUTEX_IMPL_FINALIZE() CAIRO_MUTEX_IMPL_NOOP
# define CAIRO_MUTEX_IMPL_NIL_INITIALIZER PTHREAD_MUTEX_INITIALIZER
-#elif HAVE_WINDOWS_H /*******************************************************/
+#elif defined(HAVE_WINDOWS_H) || defined(_MSC_VER) /*************************/
# include <windows.h>
commit 33b6d2b5eb4f5d424cec51970d9b72bef49a5fc8
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Sep 19 16:48:12 2008 -0400
[src/check-cairoint.sh] Escape dot in regexp
No why, just that it's more robust :).
diff --git a/src/check-cairoint.sh b/src/check-cairoint.sh
index 1f33224..f9d3fef 100755
--- a/src/check-cairoint.sh
+++ b/src/check-cairoint.sh
@@ -16,7 +16,7 @@ fi
for x in $FILES; do
grep '\<include\>' "$x" /dev/null | head -n 1
done |
-grep -v '"cairoint.h"' |
+grep -v '"cairoint[.]h"' |
grep . && stat=1
exit $stat
commit d635c941b2d046c5edfef84ef870009069fb4004
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri Sep 19 14:50:24 2008 -0400
[image] Check for PACKAGE_BUGREPORT availability
Building using win32, there is no config.h. So PACKAGE_BUGREPORT may
not be defined.
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index e0b19a7..297c947 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -275,8 +275,11 @@ _cairo_image_surface_create_with_masks (unsigned char *data,
"\tRed mask: 0x%08lx\n"
"\tGreen mask: 0x%08lx\n"
"\tBlue mask: 0x%08lx\n"
+#ifdef PACKAGE_BUGGREPORT
"Please file an enhancement request (quoting the above) at:\n"
- PACKAGE_BUGREPORT "\n",
+ PACKAGE_BUGREPORT"\n"
+#endif
+ ,
cairo_version_string (),
masks->bpp, masks->alpha_mask,
masks->red_mask, masks->green_mask, masks->blue_mask);
More information about the cairo-commit
mailing list