[cairo] Fix OS/2 build

Behdad Esfahbod behdad at behdad.org
Tue Nov 11 07:19:17 PST 2008


Peter Weilbacher wrote:
> On 10.11.08 17:13, Behdad Esfahbod wrote:
>> Doodle wrote:
>>> Just a note:
>>> Including os2.h from a library's header file might introduce problems
>>> sometimes.
>>> Imagine a case, when the library needs only INCL_PM and INCL_DOSERRORS
>>> parts from os2.h, so it defines those, and includes os2.h.
>>>
>>> Then the application includes the library's header file (thus,
>>> implicitly including the PM and DOSERRORS parts from os2.h), then it
>>> wants to include os2.h with INCL_SEMAPHORES, INCL_PM and INCL_DOSERRORS.
>>> However, as os2.h was already included, it won't be included again, and
>>> the INCL_SEMAPHORES will not take effect.
>>>
>>> That was the reason for not having os2.h includes in Cairo's public
>>> os2-specific header files.
>>
>> Other systems have similar problems.  The user can do their defines
>> before
>> including cairo-os2.h.
> 
> That is right, but Doodle has a good point there. How is the user supposed
> to _know_ that he has to #define the necessary macros before including
> cairo-os2.h?

Because, cairo-os2.h looks like a header that uses both cairo.h and os2.h?
The rule is, headers should be self-contained.  We now check that during make
check.

> If he defines none of too few he might get really weird error
> messages that can take long to track down. (Especially since it worked
> without those #defines in user code until now.)

Users essentially can't assume who includes what.  If you need to do some
defines before a certain header is included, do them before *any* include.

behdad

> The problematic checkin said
>    "Test that every cairo private header includes some other cairo
>     header before any other includes."
> That would still be correct when only moving the cairo-os2.h line down as
> Dave suggested.
> 
> That said, I can't build cairo to test any of the changes. I get
>    cairo-analysis-surface.c
>    In file included from cairoint.h:2365,
>                     from cairo-analysis-surface.c:37:
>    cairo-region-private.h:50: error: parse error before "pixman_region32_t"
>    cairo-region-private.h:50: warning: no semicolon at end of struct or
> union
>    cairo-analysis-surface.c:55: error: field `supported_region' has
> incomplete type
> with the 1.8.2 package (using pixman 0.12.0).
> 
>    Peter.
> 


More information about the cairo mailing list