[cairo-commit] 4 commits - build/configure.ac.warnings build/Makefile.am.common src/cairo-mutex.c src/cairo-mutex-impl-private.h src/cairo-mutex-list-private.h src/cairo-mutex-private.h src/Makefile.am src/Makefile.am.analysis

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Sep 19 15:52:06 PDT 2008


 build/Makefile.am.common       |    2 +-
 build/configure.ac.warnings    |    3 +++
 src/Makefile.am                |    6 +++++-
 src/Makefile.am.analysis       |   23 +++++++++++++++++------
 src/cairo-mutex-impl-private.h |    4 ----
 src/cairo-mutex-list-private.h |   20 ++++++++++++--------
 src/cairo-mutex-private.h      |    2 +-
 src/cairo-mutex.c              |    6 +++---
 8 files changed, 42 insertions(+), 24 deletions(-)

New commits:
commit 9c36a5f3f19ca5bb2e0bb23baeaa625ad6833ab4
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Sep 19 18:51:03 2008 -0400

    [src/Makefile.am.analysis] Check that all headers can be compiled standalone
    
    This ensures that each header includes all headers it depends on.
    This is now enforced by "make check".

diff --git a/src/Makefile.am b/src/Makefile.am
index 65f7017..9c43450 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -85,10 +85,14 @@ EXTRA_DIST += $(TESTS_SH) check-has-hidden-symbols.c
 check_PROGRAMS += check-link
 check_link_LDADD = libcairo.la
 
+check: headers-standalone
+
+PREPROCESS_ARGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)
+COMPILE_ARGS = $(PREPROCESS_ARGS) $(AM_CFLAGS) $(CFLAGS)
 
 # The pre-processed result is used by check-{def,plt}.sh to determine whether
 # cairo has been compiled with symbol hiding.
 .c.i: $(cairoinclude_HEADERS) $(nodist_cairoinclude_HEADERS) cairoint.h $(top_builddir)/config.h
-	$(CPP) -DHAVE_CONFIG_H -I$(top_builddir) -I. $(AM_CPPFLAGS) $< -o $@
+	$(CPP) $(PREPROCESS_ARGS) $< -o $@
 
 include $(srcdir)/Makefile.am.analysis
diff --git a/src/Makefile.am.analysis b/src/Makefile.am.analysis
index 800935a..108c50e 100644
--- a/src/Makefile.am.analysis
+++ b/src/Makefile.am.analysis
@@ -1,19 +1,30 @@
 
 SPARSE = sparse
 sparse:
+	@echo Checking enabled sources with sparse checker
 	@status=true; for f in $(enabled_cairo_sources); do \
-		echo $(SPARSE) $$f; \
-		$(SPARSE) -I$(top_builddir) $(AM_CPPFLAGS) -DHAVE_CONFIG_H $$f || status=false; \
+		echo $(SPARSE) $(PREPROCESS_ARGS) $$f; \
+		$(SPARSE) $(PREPROCESS_ARGS) $$f || status=false; \
 	done; $$status
 
 SPLINT = splint -badflag
 splint:
+	@echo Checking enabled sources with splint checker
 	@status=true; for f in $(enabled_cairo_sources); do \
-		echo $(SPLINT) $$f; \
-		$(SPLINT) -I$(top_builddir) $(AM_CPPFLAGS) -DHAVE_CONFIG_H $$f || status=false; \
+		echo $(SPLINT) $(PREPROCESS_ARGS) $$f; \
+		$(SPLINT) $(PREPROCESS_ARGS) $$f || status=false; \
 	done; $$status
 
 UNO = uno
 uno:
-	@cpp_flags=`echo $(AM_CPPFLAGS) | sed 's/\(-I.*\) /\1 /g'`; \
-	$(UNO) -I$(top_builddir) $$cpp_flags -DHAVE_CONFIG_H -U__GNUC__ $(enabled_cairo_sources)
+	@echo Checking enabled sources with uno checker
+	$(UNO) $(PREPROCESS_ARGS) -DHAVE_CONFIG_H -U__GNUC__ $(enabled_cairo_sources)
+
+headers-standalone:
+	@echo Checking that enabled public/private headers can be compiled standalone
+	@status=true; for f in $(enabled_cairo_headers) $(enabled_cairo_private); do \
+		echo $(COMPILE) -o /dev/null $$f; \
+		$(COMPILE) -o /dev/null $$f || status=false; \
+	done; $$status
+
+analysis: all headers-standalone sparse splint uno
diff --git a/src/cairo-mutex-impl-private.h b/src/cairo-mutex-impl-private.h
index ec7b578..95c666f 100644
--- a/src/cairo-mutex-impl-private.h
+++ b/src/cairo-mutex-impl-private.h
@@ -149,10 +149,6 @@
  *   poke around cairo-mutex-private.h for possible solutions.
  */
 
-#ifndef CAIRO_MUTEX_TYPE_PRIVATE_H
-#error "Do not include cairo-mutex-impl-private.h directly.  Include cairo-mutex-type-private.h instead."
-#endif
-
 #if CAIRO_NO_MUTEX
 
 /* No mutexes */
diff --git a/src/cairo-mutex-list-private.h b/src/cairo-mutex-list-private.h
index 5d0e3f2..49f29db 100644
--- a/src/cairo-mutex-list-private.h
+++ b/src/cairo-mutex-list-private.h
@@ -31,6 +31,11 @@
  *	Mathias Hasselmann <mathias.hasselmann at gmx.de>
  */
 
+#ifndef CAIRO_FEATURES_H
+/* This block is to just make this header file standalone */
+#define CAIRO_MUTEX_DECLARE(mutex)
+#endif
+
 CAIRO_MUTEX_DECLARE (_cairo_pattern_solid_pattern_cache_lock)
 CAIRO_MUTEX_DECLARE (_cairo_pattern_solid_surface_cache_lock)
 
commit 2dd90a6c94559374d995475fff8ffff5d0d3ff6f
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Sep 19 18:45:44 2008 -0400

    [cairo-mutex] Move semicolons out of cairo-mutex-list-private.h
    
    Previously cairo-mutex-list-private.h assumed that every use of the file
    will produce a statement for each mutex by including a semicolon after
    each.  But some uses (like enumerating all static mutexes  in an array
    for example, can't be implemented with the semicolon in place.  So, move
    the semicolon out to the users of the header file.

diff --git a/src/cairo-mutex-list-private.h b/src/cairo-mutex-list-private.h
index 5393790..5d0e3f2 100644
--- a/src/cairo-mutex-list-private.h
+++ b/src/cairo-mutex-list-private.h
@@ -31,24 +31,23 @@
  *	Mathias Hasselmann <mathias.hasselmann at gmx.de>
  */
 
+CAIRO_MUTEX_DECLARE (_cairo_pattern_solid_pattern_cache_lock)
+CAIRO_MUTEX_DECLARE (_cairo_pattern_solid_surface_cache_lock)
 
-CAIRO_MUTEX_DECLARE (_cairo_pattern_solid_pattern_cache_lock);
-CAIRO_MUTEX_DECLARE (_cairo_pattern_solid_surface_cache_lock);
-
-CAIRO_MUTEX_DECLARE (_cairo_font_face_mutex);
-CAIRO_MUTEX_DECLARE (_cairo_scaled_font_map_mutex);
-CAIRO_MUTEX_DECLARE (_cairo_scaled_font_error_mutex);
+CAIRO_MUTEX_DECLARE (_cairo_font_face_mutex)
+CAIRO_MUTEX_DECLARE (_cairo_scaled_font_map_mutex)
+CAIRO_MUTEX_DECLARE (_cairo_scaled_font_error_mutex)
 
 #if CAIRO_HAS_FT_FONT
-CAIRO_MUTEX_DECLARE (_cairo_ft_unscaled_font_map_mutex);
+CAIRO_MUTEX_DECLARE (_cairo_ft_unscaled_font_map_mutex)
 #endif
 
 #if CAIRO_HAS_XLIB_SURFACE
-CAIRO_MUTEX_DECLARE (_cairo_xlib_display_mutex);
+CAIRO_MUTEX_DECLARE (_cairo_xlib_display_mutex)
 #endif
 
 #if !defined (CAIRO_HAS_ATOMIC_OPS) || defined (ATOMIC_OP_NEEDS_MEMORY_BARRIER)
-CAIRO_MUTEX_DECLARE (_cairo_atomic_mutex);
+CAIRO_MUTEX_DECLARE (_cairo_atomic_mutex)
 #endif
 
 /* Undefine, to err on unintended inclusion */
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
index 61b87d7..a3a7271 100644
--- a/src/cairo-mutex-private.h
+++ b/src/cairo-mutex-private.h
@@ -58,7 +58,7 @@ cairo_private void _cairo_mutex_finalize (void);
 
 /* Finally, extern the static mutexes and undef */
 
-#define CAIRO_MUTEX_DECLARE(mutex) cairo_private extern cairo_mutex_t mutex
+#define CAIRO_MUTEX_DECLARE(mutex) cairo_private extern cairo_mutex_t mutex;
 #include "cairo-mutex-list-private.h"
 #undef CAIRO_MUTEX_DECLARE
 
diff --git a/src/cairo-mutex.c b/src/cairo-mutex.c
index 5149ee8..5b6a6e1 100644
--- a/src/cairo-mutex.c
+++ b/src/cairo-mutex.c
@@ -35,7 +35,7 @@
 
 #include "cairo-mutex-private.h"
 
-#define CAIRO_MUTEX_DECLARE(mutex) cairo_mutex_t mutex = CAIRO_MUTEX_NIL_INITIALIZER
+#define CAIRO_MUTEX_DECLARE(mutex) cairo_mutex_t mutex = CAIRO_MUTEX_NIL_INITIALIZER;
 #include "cairo-mutex-list-private.h"
 #undef   CAIRO_MUTEX_DECLARE
 
@@ -61,7 +61,7 @@ void _cairo_mutex_initialize (void)
 
     _cairo_mutex_initialized = TRUE;
 
-#define  CAIRO_MUTEX_DECLARE(mutex) CAIRO_MUTEX_INIT (mutex)
+#define  CAIRO_MUTEX_DECLARE(mutex) CAIRO_MUTEX_INIT (mutex);
 #include "cairo-mutex-list-private.h"
 #undef   CAIRO_MUTEX_DECLARE
 }
@@ -75,7 +75,7 @@ void _cairo_mutex_finalize (void)
 
     _cairo_mutex_initialized = FALSE;
 
-#define  CAIRO_MUTEX_DECLARE(mutex) CAIRO_MUTEX_FINI (mutex)
+#define  CAIRO_MUTEX_DECLARE(mutex) CAIRO_MUTEX_FINI (mutex);
 #include "cairo-mutex-list-private.h"
 #undef   CAIRO_MUTEX_DECLARE
 }
commit 8ae8189327f383fa033032d7d4280b91d650171d
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Sep 19 18:43:43 2008 -0400

    [configure.ac.warnings] Add -Wp,-D_FORTIFY_SOURCE=2 to warning flags
    
    It enables various checks in glibc and gcc preprocessor.

diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings
index f6f68c5..3756439 100644
--- a/build/configure.ac.warnings
+++ b/build/configure.ac.warnings
@@ -19,6 +19,9 @@ dnl We also abuse the warning-flag facility to enable other compiler
 dnl options.  Namely, the following:
 MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing"
 
+dnl Also to turn various gcc/glibc-specific preprocessor checks
+MAYBE_WARN="$MAYBE_WARN -Wp,-D_FORTIFY_SOURCE=2"
+
 # invalidate cached value if MAYBE_WARN has changed
 if test "x$cairo_cv_warn_maybe" != "x$MAYBE_WARN"; then
 	unset cairo_cv_warn_cflags
commit 54b60dadb9f8393f834c4709b37ffb163a00445c
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Sep 19 18:42:54 2008 -0400

    [Makefile.am.common] Remove gcc precompiled headers in "make clean"
    
    Stale gcc precompiled headers can cause bugs very tricky to pin down.

diff --git a/build/Makefile.am.common b/build/Makefile.am.common
index bf5bde3..b955af5 100644
--- a/build/Makefile.am.common
+++ b/build/Makefile.am.common
@@ -8,7 +8,7 @@ MAINTAINERCLEANFILES =
 TESTS =
 check_PROGRAMS =
 
-CLEANFILES += *.i *.s
+CLEANFILES += *.i *.s *.gch
 CLEANFILES += $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) $(check_PROGRAMS)
 DISTCLEANFILES += $(BUILT_SOURCES)
 MAINTAINERCLEANFILES += Makefile.in


More information about the cairo-commit mailing list