Bug 10150

Summary: Support inline with Sun Studio compiler
Product: cairo Reporter: Brian Cameron <brian.cameron>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.3.9   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: patch showing the issue and adding Sun Studio inline support.

Description Brian Cameron 2007-03-01 22:59:55 UTC
The attached patch fixes the INLINE macro so it also gets set properly when using the Sun Studio compiler.  It basically adds the __SUNPRO_C part:

#if defined(__GNUC__)
#define INLINE __inline__
#elif defined (__SUNPRO_C)
#define INLINE inline
#else
#define INLINE
#endif

It would be nice if this could go upstream so that Sun Studio also compiles cairo with inline properly.

I notice that there is some mess with how inline is handled in cairo/pixman/src.  The macro is defined in icint.h and fbpict.h.  Since fbpict.h indirectly includes icint.h, this causes the macro to be defined twice.  The macro is defined separately in pixregion.c.

Also it seems some code uses "__inline" when it would be more consistent to use the INLINE macro.  

The attached patch defines INLINE just once in icint.h and adds an "#include "icint.h" to pixregion.c to access this macro.

Note that the function fbmmx.c also uses __inline and could probably be made to just use INLINE.  Since I'm not building this code, I didn't make this change since I can't test it.  If so, then this code could be removed from icint.h

#ifndef __GNUC__
#define __inline
#endif

I'm not sure my attached patch is the best approach.  Perhaps the macro should be moved to a more general header file rather than in icint.h.  Perhaps pixman.h?  But this patch shows the issues and how to approach fixing them.
Comment 1 Brian Cameron 2007-03-01 23:00:30 UTC
Created attachment 8937 [details] [review]
patch showing the issue and adding Sun Studio inline support.
Comment 2 Behdad Esfahbod 2007-03-02 08:35:58 UTC
Our inline handling is currently a mess.  I'll take a look and clean it up.  We should really just use whatever autoconf detects, and that should automatically handle the Sun compiler too.
Comment 3 Behdad Esfahbod 2007-03-05 11:48:10 UTC
If you don't mind, I want to postpone this to 1.4.2.
We are currently trying to just build problems with 1.3.16, and I don't want to open new build bugs.
Comment 4 Behdad Esfahbod 2007-04-03 17:32:07 UTC
Fixed: 313a6f732112ca88fa4d590a604ce8219065655c
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Tue Apr 3 19:53:28 2007 -0400

    [pixman] Cleanup inline mess (#10150)
    
    Simply use "inline" instead of "INLINE" or "__inline__" and let
    configure figure out what to use.

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.