dk / Prima

prima.eu.org
Other
108 stars 27 forks source link

Minor changes for Mac OSX to compile without warnings and Fontconfig ... #12

Closed vikasnkumar closed 10 years ago

vikasnkumar commented 10 years ago
dk commented 10 years ago

I don't like this diff .. I don't understand the first double typecast, it looks wrong to me . The second diff is also wrong, NEED_EXPLICIT_FC_SCALABLE is needed for the older FC version, not for the newer ones.

vikasnkumar commented 10 years ago

On 01/11/2014 04:59 PM, Dmitry Karasik wrote:

I don't like this diff .. I don't understand the first double typecast, it looks wrong to me . The second diff is also wrong, NEED_EXPLICIT_FC_SCALABLE is needed for the older FC version, not for the newer ones.

— Reply to this email directly or view it on GitHub https://github.com/dk/Prima/pull/12#issuecomment-32108488.

I agree. But when I set it this way the FontConfig warnings stop happening. Maybe it is just the behaviour of the MacPorts install of fontconfig and I have ignored it so far. It doesn't matter much as I just redirect STDERR to /dev/null.

gcc gives the following warning:

img/codec_Xpm.c:210: warning: cast from pointer to integer of different size img/codec_Xpm.c:219: warning: cast to pointer from integer of different size

I have a 64-bit Mac. So a pointer is 64-bits. uintptr_t refers to an unsigned int of 64-bits and is a typecast to convert a pointer to an integer value without issuing a warning. Then I convert that to the Color type which is a uint32_t. That's why the double type cast. Converting a 32-bit integer to a 64-bit pointer will inevitably lead to problems.

I am not sure if I saw this on Linux. the Mac OSX, even though they call it Unix, is a weird Unix and does some non-standard things.

You should see the amount of warnings spewed when the default C compiler on the Mac "clang" is used.

I believe you should be able to see the same issues on a FreeBSD system as it has clang as the default compiler or as an optional compiler. But it is not important, I use gcc as the compiler by setting the CC variable on the command line.