Bug 24995

Summary: CAIRO_FORMAT_VALID failed to work with Sun Studio C compiler
Product: cairo Reporter: Ginn Chen <ginn.chen>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: major    
Priority: medium    
Version: 1.9.3   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 24384    
Attachments: test
patch

Description Ginn Chen 2009-11-09 03:10:01 UTC
Created attachment 31059 [details]
test

Test program attached.

ginn@opensolaris:~$ cc cairotest.c 
"cairotest.c", line 18: warning: initializer does not fit or is out of range: 0xffffffff
ginn@opensolaris:~$ ./a.out 
valid? 1
ginn@opensolaris:~$ gcc-4.3.2 cairotest.c 
ginn@opensolaris:~$ ./a.out 
valid? 0

I'm not sure if the behavior is implement dependent.
I think it would be safer if we use 0x7fffffff for CAIRO_FORMAT_INVALID or case it to unsigned it in CAIRO_FORMAT_VALID.
Comment 1 Ginn Chen 2009-11-09 03:12:14 UTC
Created attachment 31060 [details] [review]
patch

This bug is causing crashes of Firefox 3.6/3.7 on xBGR frame buffer.
See https://bugzilla.mozilla.org/show_bug.cgi?id=526976
Comment 2 Ginn Chen 2010-01-12 23:21:36 UTC
I understood you are considering change the value of CAIRO_FORMAT_INVALID.

Please at least take the workaround for 1.10.
Comment 3 M Joonas Pihlaja 2010-01-13 00:30:34 UTC
Okay, things are moving again!  Apologies for playing the dead brick part for the last good while.  We want to expose the invalid value explicitly in the enum so that the enum type isn't abused so hard in the code.  This ought to be an ABI compatible change AFAICT, since Sun's cc is telling me that sizeof() the type won't change, and anyway we're only passing the format to/from the client via formal arguments or as a return value.
Comment 4 M Joonas Pihlaja 2010-02-28 15:59:46 UTC
This should now be fixed in git master.

http://cgit.freedesktop.org/cairo/commit/?id=5b7f4bb241f3191c1589cd714f373719efded56e

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.