mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-25 09:30:18 +01:00
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.
This commit is contained in:
parent
eb89bf049a
commit
d84752605a
14 changed files with 66 additions and 59 deletions
|
|
@ -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)])
|
||||
|
|
|
|||
|
|
@ -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 ====================================================================
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
48
src/check-includes.sh
Executable file
48
src/check-includes.sh
Executable file
|
|
@ -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
|
||||
Loading…
Add table
Reference in a new issue