[cups-devel] cups #defines __attribute__ to be empty

Philip Race philip.race at oracle.com
Sun Jul 8 21:43:38 PDT 2018


The SunStudio compilers for Solaris and Linux support this and have done for many years it seems,
(since 2011 per docs) https://docs.oracle.com/cd/E18659_01/html/821-1384/gjzke.html
and we hit this when OpenJDK starting to use it (at a much more global level for OpenJDK than printing),
and not when updating compiler versions.
It looks like a bit of a pain since Cups versions that are in the wild will insist on disabling it
and we will be stuck with this for many years.
I can only suppose that usage of this is currently rare else world+dog would have issues.
The fix is to remove the define to empty .. and in general, perhaps not to assume that
GCC extensions won't get adopted by other compilers.
SAP filed a bug:https://github.com/apple/cups/issues/5349

-phil

On 7/8/18, 8:18 PM, Michael Sweet wrote:
> Phil,
>
>> On Jul 5, 2018, at 4:30 PM, Phil Race<philip.race at oracle.com>  wrote:
>>
>> OpenJDK builds use the __attribute__  keyword to indicate symbols are exported
>> However cups/versioning.h #defines this to be empty unless the compiler is GNU C.
>> See the last few lines here :
>> https://github.com/apple/cups/blob/master/cups/versioning.h
>>
>> So in our code when we include cups/cups.h cups we lose the value of __attribute__
>> and you only find out at runtime when these symbols are loaded via JNI and
>> we get a linkage error.
>>
>> Why is CUPS doing this ?
> Because __attribute__ is a GNU C extension that is also supported by Clang, and there are other source files where we need to use __attribute__ for other GNUisms.  If you are using a different compiler that also supports __attribute__, please let us know and we can update this header accordingly.
>
>> And more importantly can it be fixed ?
> Of course, if we know what the fix should be...
>
> _________________________________________________________
> Michael Sweet, Senior Printing System Engineer
>
> _______________________________________________
> cups-devel mailing list
> cups-devel at cups.org
> https://lists.cups.org/mailman/listinfo/cups-devel


More information about the cups-devel mailing list