bugThe FreeType Project - Bugs: bug #50560, Clang warnings when sizeof(void*)...

 
 

bug #50560: Clang warnings when sizeof(void*) != sizeof(unsigned long)

Submitted by:  bungeman <bungeman>
Submitted on:  Thu 16 Mar 2017 03:19:36 PM UTC  
 
Severity: 3 - NormalItem Group: Wishlist
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.8

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 03 Apr 2017 04:15:36 PM UTC, comment #5:

I forgot to run ./configure. I do enjoy quick ccache'd rebuilds.

Alexei Podtelezhnikov <podtelez>
Project Member
Mon 03 Apr 2017 02:07:27 AM UTC, comment #4:

It is very seriously broken. I still get the same warnings and crash later with

symbol lookup error: ~/freetype2/objs/.libs/libfreetype.so.6: undefined symbol: FT_UINT_TO_POINTER

Alexei Podtelezhnikov <podtelez>
Project Member
Sat 01 Apr 2017 02:28:46 AM UTC, comment #3:

I get these gcc warnings now:

In file included from /home/apodtele/freetype2/src/truetype/truetype.c:23:0:
/home/apodtele/freetype2/src/truetype/ttgload.c: In function ‘load_truetype_glyph’:
/home/apodtele/freetype2/src/truetype/ttgload.c:1714:26: warning: implicit declaration of function ‘FT_UINT_TO_POINTER’ [-Wimplicit-function-declaration]
FT_UINT_TO_POINTER( glyph_index ) ) )
^~~~~~~~~~~~~~~~~~
/home/apodtele/freetype2/src/truetype/ttgload.c:1714:26: warning: passing argument 2 of ‘FT_List_Find’ makes pointer from integer without a cast [-Wint-conversion]
In file included from /home/apodtele/freetype2/src/truetype/ttgload.c:27:0,
from /home/apodtele/freetype2/src/truetype/truetype.c:23:
/home/apodtele/freetype2/include/freetype/ftlist.h:94:3: note: expected ‘void *’ but argument is of type ‘int’
FT_List_Find( FT_List list,
^~~~~~~~~~~~
In file included from /home/apodtele/freetype2/src/truetype/truetype.c:23:0:
/home/apodtele/freetype2/src/truetype/ttgload.c:1723:20: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
node->data = FT_UINT_TO_POINTER( glyph_index );
^
/home/apodtele/freetype2/src/truetype/ttgload.c:1729:20: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
node->data = FT_UINT_TO_POINTER( glyph_index );
^

Alexei Podtelezhnikov <podtelez>
Project Member
Sat 18 Mar 2017 04:37:24 PM UTC, comment #2:

FreeType still assumes C89, which makes it complicated to properly define a 64bit data type without compiler warnings. Additionally, `uintptr_t' doesn't exist.

Using `sizeof' would exacerbate the problem: Since it is part of the compilation and not the preprocessing step, you had to provide a 64bit data type even if you are not going to use it, e.g.

On the other hand, the only system that uses LLP64 is Windows. So to me the glib solution seems straightforward, and I have implemented a similar solution. Please test.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Thu 16 Mar 2017 07:43:45 PM UTC, comment #1:

I just noticed the one mention of GUINT_TO_POINTER in ttgload.c. It appears that glib has to handle this as well, so in glib's glib/glibconfig.h.win32.in it effectively does something like

#ifdef _WIN64
#define GUINT_TO_POINTER(u) ((gpointer) (guint64) (u))
#endif

This seems overly Windows specific, it seems that detecting LLP64 directly with sizeof would be nicer.

bungeman <bungeman>
Thu 16 Mar 2017 03:19:36 PM UTC, original submission:

When building FreeType with clang for Windows with a target of x64, the following warnings (which are here treated as errors) are produced

The issue here being that sizeof(void*) == 8 and sizeof(unsigned long) == 4 on this particular platform (LLP64). This seems to be the kind of issue uintptr_t was designed to solve, but not sure if FreeType can use that. Perhaps a FT_UIntPtr typedef could be added to ftconfig.h for this?

bungeman <bungeman>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by podtelez (Posted a comment)
  • -unavailable- added by wl (Posted a comment)
  • -unavailable- added by bungeman (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 18 Mar 2017 04:37:24 PM UTCwlStatusNone=>Fixed
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.8

    Back to the top


    Powered by Savane 3.1-cleanup1