[cairo-commit] 3 commits - pixman/src src/cairo-arc.c src/cairo-atsui-font.c src/cairo-beos-surface.cpp src/cairo-directfb-surface.c src/cairo-freelist.c src/cairo-ft-font.c src/cairo-gstate.c src/cairoint.h src/cairo-matrix.c src/cairo-os2-surface.c src/cairo-output-stream.c src/cairo-path.c src/cairo-path-fixed.c src/cairo-png.c src/cairo-polygon.c src/cairo-quartz-surface.c src/cairo-region.c src/cairo-skiplist.c src/cairo-surface.c src/cairo-surface-fallback.c src/cairo-truetype-subset.c src/cairo-unicode.c src/cairo-win32-font.c src/cairo-win32-surface.c src/cairo-xlib-screen.c src/check-cairoint.sh src/Makefile.am src/test-fallback-surface.c src/test-meta-surface.c src/test-paginated-surface.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Apr 3 17:30:28 PDT 2007


 pixman/src/Makefile.am       |    3 +++
 pixman/src/check-config.sh   |   17 +++++++++++++++++
 src/Makefile.am              |    2 +-
 src/cairo-arc.c              |    2 ++
 src/cairo-atsui-font.c       |    5 ++---
 src/cairo-beos-surface.cpp   |    7 ++++---
 src/cairo-directfb-surface.c |   10 +++-------
 src/cairo-freelist.c         |    5 +++--
 src/cairo-ft-font.c          |    4 +++-
 src/cairo-gstate.c           |    2 --
 src/cairo-matrix.c           |    1 -
 src/cairo-os2-surface.c      |   11 ++++++-----
 src/cairo-output-stream.c    |    7 ++++---
 src/cairo-path-fixed.c       |    1 -
 src/cairo-path.c             |    2 ++
 src/cairo-png.c              |    3 ++-
 src/cairo-polygon.c          |    1 -
 src/cairo-quartz-surface.c   |    4 ++--
 src/cairo-region.c           |    2 +-
 src/cairo-skiplist.c         |    6 +-----
 src/cairo-surface-fallback.c |    2 ++
 src/cairo-surface.c          |    3 +--
 src/cairo-truetype-subset.c  |    2 +-
 src/cairo-unicode.c          |    4 +---
 src/cairo-win32-font.c       |    3 +--
 src/cairo-win32-surface.c    |   10 +++++-----
 src/cairo-xlib-screen.c      |    4 ++--
 src/cairoint.h               |    1 +
 src/check-cairoint.sh        |   17 +++++++++++++++++
 src/test-fallback-surface.c  |    4 ++--
 src/test-meta-surface.c      |    4 ++--
 src/test-paginated-surface.c |    4 ++--
 32 files changed, 93 insertions(+), 60 deletions(-)

New commits:
diff-tree a1287e483ce8efcf3f1eca97bdaaccac2393a1bf (from 8fbf50d31da9e13f1e55c7ee19586b7c394684ba)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Apr 3 20:30:30 2007 -0400

    [pixman/src/check-config.sh] Test that all source files #include <config.h>
    as their first include.

diff --git a/pixman/src/Makefile.am b/pixman/src/Makefile.am
index 7b828f5..7b0f0f6 100644
--- a/pixman/src/Makefile.am
+++ b/pixman/src/Makefile.am
@@ -38,3 +38,6 @@ libpixman_mmx_la_SOURCES = \
 libpixman_mmx_la_CFLAGS = $(PIXMAN_CFLAGS)
 libpixman_la_LIBADD = libpixman-mmx.la
 endif
+
+TESTS = check-config.sh
+EXTRA_DIST = $(TESTS)
diff --git a/pixman/src/check-config.sh b/pixman/src/check-config.sh
new file mode 100755
index 0000000..a1f9194
--- /dev/null
+++ b/pixman/src/check-config.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+LANG=C
+
+test -z "$srcdir" && srcdir=.
+status=0
+
+echo 'Checking source files for missing or misplaced #include <config.h>'
+
+find "$srcdir" -name '*.c' -or -name '*.cpp' |
+while read x; do
+	grep '\<include\>' "$x" /dev/null | head -n 1
+done |
+grep -v '<config.h>' |
+grep . && status = 1
+
+exit $status
diff --git a/src/check-cairoint.sh b/src/check-cairoint.sh
index 0c05589..05ba8ea 100755
--- a/src/check-cairoint.sh
+++ b/src/check-cairoint.sh
@@ -9,7 +9,7 @@ echo 'Checking source files for missing 
 
 find "$srcdir" -name '*.c' -or -name '*.cpp' |
 while read x; do
-	grep 'include' "$x" /dev/null | head -n 1
+	grep '\<include\>' "$x" /dev/null | head -n 1
 done |
 grep -v '"cairoint.h"' |
 grep . && status = 1
diff-tree 8fbf50d31da9e13f1e55c7ee19586b7c394684ba (from ffc7d06da0f97390025a510b9532e4a64e9230f4)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Apr 3 20:25:30 2007 -0400

    [src] Make sure all source files #include "cairoint.h" as their first include
    
    This is necessary to avoid many portability problems as cairoint.h includes
    config.h.  Without a test, we will regress again, hence add it.
    
    The inclusion idiom for cairo now is:
    
    	#include "cairoint.h"
    
    	#include "cairo-something.h"
    	#include "cairo-anotherthing-private.h"
    
    	#include <some-library.h>
    	#include <other-library/other-file.h>
    
    Moreover, some standard headers files are included from cairoint.h and need
    not be included again.

diff --git a/src/cairo-arc.c b/src/cairo-arc.c
index 7b2789d..377da84 100644
--- a/src/cairo-arc.c
+++ b/src/cairo-arc.c
@@ -34,6 +34,8 @@
  *	Carl D. Worth <cworth at cworth.org>
  */
 
+#include "cairoint.h"
+
 #include "cairo-arc-private.h"
 
 /* Spline deviation from the circle in radius would be given by:
diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c
index 8a82a7f..b5b783c 100644
--- a/src/cairo-atsui-font.c
+++ b/src/cairo-atsui-font.c
@@ -34,11 +34,10 @@
  *  Calum Robinson <calumr at mac.com>
  */
 
-#include <stdlib.h>
-#include <math.h>
-#include "cairo-atsui.h"
 #include "cairoint.h"
+
 #include "cairo.h"
+#include "cairo-atsui.h"
 #include "cairo-quartz-private.h"
 
 /*
diff --git a/src/cairo-beos-surface.cpp b/src/cairo-beos-surface.cpp
index 066e389..e0ff297 100644
--- a/src/cairo-beos-surface.cpp
+++ b/src/cairo-beos-surface.cpp
@@ -36,6 +36,10 @@
 
 // This is a C++ file in order to use the C++ BeOS API
 
+#include "cairoint.h"
+
+#include "cairo-beos.h"
+
 #include <new>
 
 #include <Bitmap.h>
@@ -47,9 +51,6 @@
 #include <Window.h>
 #include <Locker.h>
 
-#include "cairoint.h"
-#include "cairo-beos.h"
-
 #define CAIRO_INT_STATUS_SUCCESS (cairo_int_status_t)(CAIRO_STATUS_SUCCESS)
 
 struct cairo_beos_surface_t {
diff --git a/src/cairo-directfb-surface.c b/src/cairo-directfb-surface.c
index 686510d..f6e1c01 100644
--- a/src/cairo-directfb-surface.c
+++ b/src/cairo-directfb-surface.c
@@ -35,10 +35,9 @@
  *    Claudio Ciccani <klan at users.sf.net>
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <assert.h>
+#include "cairoint.h"
+
+#include "cairo-directfb.h"
 
 #include <directfb.h>
 
@@ -47,9 +46,6 @@
 #include <direct/memcpy.h>
 #include <direct/util.h>
 
-#include "cairo-directfb.h"
-#include "cairoint.h"
-
 
 /*
  * Rectangle causes problems (see bugs 361377, 359553, 359243 in Gnome BTS).
diff --git a/src/cairo-freelist.c b/src/cairo-freelist.c
index eed1934..3887f4b 100644
--- a/src/cairo-freelist.c
+++ b/src/cairo-freelist.c
@@ -19,8 +19,9 @@
  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  * OF THIS SOFTWARE.
  */
-#include <stdlib.h>
-#include <string.h>
+
+#include "cairoint.h"
+
 #include "cairo-freelist-private.h"
 
 void
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 7f10fd7..c703b98 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -37,10 +37,12 @@
  *      Carl Worth <cworth at cworth.org>
  */
 
-#include <float.h>
+#include "cairoint.h"
 
 #include "cairo-ft-private.h"
 
+#include <float.h>
+
 #include <fontconfig/fontconfig.h>
 #include <fontconfig/fcfreetype.h>
 
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index 377871e..0d11f98 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -35,8 +35,6 @@
  *	Carl D. Worth <cworth at cworth.org>
  */
 
-#include <stdlib.h>
-
 #include "cairoint.h"
 
 #include "cairo-clip-private.h"
diff --git a/src/cairo-matrix.c b/src/cairo-matrix.c
index b689f2a..75c27b2 100644
--- a/src/cairo-matrix.c
+++ b/src/cairo-matrix.c
@@ -35,7 +35,6 @@
  */
 
 #define _GNU_SOURCE
-#include <stdlib.h>
 
 #include "cairoint.h"
 
diff --git a/src/cairo-os2-surface.c b/src/cairo-os2-surface.c
index baaef23..c3e19dd 100644
--- a/src/cairo-os2-surface.c
+++ b/src/cairo-os2-surface.c
@@ -35,8 +35,12 @@
  *     Peter Weilbacher <mozilla at Weilbacher.org>
  */
 
-#include <stdlib.h>
-#include <stdio.h>
+#include "cairoint.h"
+
+#include "cairo-os2-private.h"
+
+#include <fontconfig/fontconfig.h>
+
 #include <float.h>
 #ifdef BUILD_CAIRO_DLL
 # define INCL_WIN
@@ -49,9 +53,6 @@
 #  include <emx/startup.h>
 # endif
 #endif
-#include "cairoint.h"
-#include "cairo-os2-private.h"
-#include "fontconfig/fontconfig.h"
 
 /*
  * Here comes the extra API for the OS/2 platform. Currently it consists
diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c
index 341a93a..cdf7d1d 100644
--- a/src/cairo-output-stream.c
+++ b/src/cairo-output-stream.c
@@ -34,12 +34,13 @@
  *	Kristian Høgsberg <krh at redhat.com>
  */
 
-#include <stdio.h>
-#include <locale.h>
-#include <ctype.h>
 #include "cairoint.h"
+
 #include "cairo-output-stream-private.h"
 
+#include <locale.h>
+#include <ctype.h>
+
 #ifdef _MSC_VER
 #define snprintf _snprintf
 #endif /* _MSC_VER */
diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c
index 41d8f9e..dfd30b1 100644
--- a/src/cairo-path-fixed.c
+++ b/src/cairo-path-fixed.c
@@ -35,7 +35,6 @@
  *	Carl D. Worth <cworth at cworth.org>
  */
 
-#include <stdlib.h>
 #include "cairoint.h"
 
 #include "cairo-path-fixed-private.h"
diff --git a/src/cairo-path.c b/src/cairo-path.c
index d79454c..ff44191 100644
--- a/src/cairo-path.c
+++ b/src/cairo-path.c
@@ -34,6 +34,8 @@
  *	Carl D. Worth <cworth at redhat.com>
  */
 
+#include "cairoint.h"
+
 #include "cairo-path-private.h"
 #include "cairo-path-fixed-private.h"
 
diff --git a/src/cairo-png.c b/src/cairo-png.c
index 006cae3..10f801a 100644
--- a/src/cairo-png.c
+++ b/src/cairo-png.c
@@ -35,8 +35,9 @@
  *	Kristian Høgsberg <krh at redhat.com>
  */
 
-#include <errno.h>
 #include "cairoint.h"
+
+#include <errno.h>
 #include <png.h>
 
 /* Unpremultiplies data and converts native endian ARGB => RGBA bytes */
diff --git a/src/cairo-polygon.c b/src/cairo-polygon.c
index f36bc71..bba9e93 100644
--- a/src/cairo-polygon.c
+++ b/src/cairo-polygon.c
@@ -34,7 +34,6 @@
  *	Carl D. Worth <cworth at cworth.org>
  */
 
-#include <stdlib.h>
 #include "cairoint.h"
 
 /* private functions */
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 3617b1e..2754666 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -34,12 +34,12 @@
  *	Vladimir Vukicevic <vladimir at mozilla.com>
  */
 
-#include <Carbon/Carbon.h>
-
 #include "cairoint.h"
 
 #include "cairo-quartz-private.h"
 
+#include <Carbon/Carbon.h>
+
 #undef QUARTZ_DEBUG
 
 #ifdef QUARTZ_DEBUG
diff --git a/src/cairo-region.c b/src/cairo-region.c
index 057f9fe..4ba2852 100644
--- a/src/cairo-region.c
+++ b/src/cairo-region.c
@@ -33,7 +33,7 @@
  *	Owen Taylor <otaylor at redhat.com>
  */
 
-#include <cairoint.h>
+#include "cairoint.h"
 
 /**
  * _cairo_region_create_from_rectangle:
diff --git a/src/cairo-skiplist.c b/src/cairo-skiplist.c
index 451ecb0..a12392a 100644
--- a/src/cairo-skiplist.c
+++ b/src/cairo-skiplist.c
@@ -21,11 +21,7 @@
  * OF THIS SOFTWARE.
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <string.h>
-#include <assert.h>
+#include "cairoint.h"
 
 #include "cairo-skiplist-private.h"
 
diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c
index 1a7d666..004de68 100644
--- a/src/cairo-surface-fallback.c
+++ b/src/cairo-surface-fallback.c
@@ -35,6 +35,8 @@
  *	Carl D. Worth <cworth at cworth.org>
  */
 
+#include "cairoint.h"
+
 #include "cairo-surface-fallback-private.h"
 #include "cairo-clip-private.h"
 
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index aa4f3b8..115824d 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -35,9 +35,8 @@
  *	Carl D. Worth <cworth at cworth.org>
  */
 
-#include <stdlib.h>
-
 #include "cairoint.h"
+
 #include "cairo-surface-fallback-private.h"
 #include "cairo-clip-private.h"
 
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index a99aed7..262912e 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -34,8 +34,8 @@
  *	Adrian Johnson <ajohnson at redneon.com>
  */
 
-#include <string.h>
 #include "cairoint.h"
+
 #include "cairo-scaled-font-subsets-private.h"
 #include "cairo-truetype-subset-private.h"
 
diff --git a/src/cairo-unicode.c b/src/cairo-unicode.c
index 5ca51e1..9abb0eb 100644
--- a/src/cairo-unicode.c
+++ b/src/cairo-unicode.c
@@ -40,9 +40,7 @@
  *	Owen Taylor <otaylor at redhat.com>
  */
 
-#include <limits.h>
-
-#include <cairoint.h>
+#include "cairoint.h"
 
 #define UTF8_COMPUTE(Char, Mask, Len)					      \
   if (Char < 128)							      \
diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index 897aec3..c38e1a5 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -32,9 +32,8 @@
  * Contributor(s):
  */
 
-#include <string.h>
-#include <stdio.h>
 #include "cairoint.h"
+
 #include "cairo-win32-private.h"
 
 #ifndef SPI_GETFONTSMOOTHINGTYPE
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 09ffae4..a498eac 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -36,6 +36,11 @@
  *	Vladimir Vukicevic <vladimir at pobox.com>
  */
 
+#include "cairoint.h"
+
+#include "cairo-clip-private.h"
+#include "cairo-win32-private.h"
+
 #define WIN32_LEAN_AND_MEAN
 /* We require Windows 2000 features such as ETO_PDY */
 #if !defined(WINVER) || (WINVER < 0x0500)
@@ -46,11 +51,6 @@
 #endif
 #include <windows.h>
 
-#include <stdio.h>
-#include "cairoint.h"
-#include "cairo-clip-private.h"
-#include "cairo-win32-private.h"
-
 #undef DEBUG_COMPOSITE
 
 /* for older SDKs */
diff --git a/src/cairo-xlib-screen.c b/src/cairo-xlib-screen.c
index d27057e..fff273d 100644
--- a/src/cairo-xlib-screen.c
+++ b/src/cairo-xlib-screen.c
@@ -51,8 +51,8 @@
  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  * PERFORMANCE OF THIS SOFTWARE.
  */
-#include <stdlib.h>
-#include <string.h>
+
+#include "cairoint.h"
 
 #include "cairo-xlib-private.h"
 
diff --git a/src/cairoint.h b/src/cairoint.h
index 8ba2882..c5333fb 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -54,6 +54,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
+#include <stddef.h>
 
 #ifdef _MSC_VER
 #define _USE_MATH_DEFINES
diff --git a/src/check-cairoint.sh b/src/check-cairoint.sh
index a2a3197..0c05589 100755
--- a/src/check-cairoint.sh
+++ b/src/check-cairoint.sh
@@ -5,7 +5,7 @@ LANG=C
 test -z "$srcdir" && srcdir=.
 status=0
 
-echo Checking source files for missing or misplaced \#include cairoint.h
+echo 'Checking source files for missing or misplaced #include "cairoint.h"'
 
 find "$srcdir" -name '*.c' -or -name '*.cpp' |
 while read x; do
diff --git a/src/test-fallback-surface.c b/src/test-fallback-surface.c
index 21ee190..628373c 100644
--- a/src/test-fallback-surface.c
+++ b/src/test-fallback-surface.c
@@ -51,10 +51,10 @@
  * there.
  */
 
-#include "test-fallback-surface.h"
-
 #include "cairoint.h"
 
+#include "test-fallback-surface.h"
+
 typedef struct _test_fallback_surface {
     cairo_surface_t base;
 
diff --git a/src/test-meta-surface.c b/src/test-meta-surface.c
index 04e741a..d686881 100644
--- a/src/test-meta-surface.c
+++ b/src/test-meta-surface.c
@@ -45,10 +45,10 @@
  * backend.
  */
 
-#include "test-meta-surface.h"
-
 #include "cairoint.h"
 
+#include "test-meta-surface.h"
+
 #include "cairo-meta-surface-private.h"
 
 typedef struct _test_meta_surface {
diff --git a/src/test-paginated-surface.c b/src/test-paginated-surface.c
index d82749f..543422f 100644
--- a/src/test-paginated-surface.c
+++ b/src/test-paginated-surface.c
@@ -45,10 +45,10 @@
  * backend.
  */
 
-#include "test-paginated-surface.h"
-
 #include "cairoint.h"
 
+#include "test-paginated-surface.h"
+
 #include "cairo-paginated-surface-private.h"
 
 typedef struct _test_paginated_surface {
diff-tree ffc7d06da0f97390025a510b9532e4a64e9230f4 (from 3646839060de7ab51c805bf5614fc3d1ea8b7fc3)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Apr 3 20:22:44 2007 -0400

    [src/check-cairoint.h] Test to check that all source files #include "cairoint.h"
    
    as their first include.

diff --git a/src/Makefile.am b/src/Makefile.am
index 73420d4..66200a7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -287,5 +287,5 @@ install-data-local:
         fi
 
 TESTS_ENVIRONMENT = srcdir="$(srcdir)"
-TESTS = check-def.sh check-plt.sh check-headers.sh
+TESTS = check-def.sh check-plt.sh check-headers.sh check-cairoint.sh
 EXTRA_DIST += $(TESTS)
diff --git a/src/check-cairoint.sh b/src/check-cairoint.sh
new file mode 100755
index 0000000..a2a3197
--- /dev/null
+++ b/src/check-cairoint.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+LANG=C
+
+test -z "$srcdir" && srcdir=.
+status=0
+
+echo Checking source files for missing or misplaced \#include cairoint.h
+
+find "$srcdir" -name '*.c' -or -name '*.cpp' |
+while read x; do
+	grep 'include' "$x" /dev/null | head -n 1
+done |
+grep -v '"cairoint.h"' |
+grep . && status = 1
+
+exit $status


More information about the cairo-commit mailing list