freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] __builtin_shuffle() availability?


From: suzuki toshiya
Subject: [ft-devel] __builtin_shuffle() availability?
Date: Wed, 13 Sep 2017 17:03:07 +0900
User-agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100329)

Dear Werner,

Usually I don't make FreeType2 dependent with libpng, so I apologize if I make
some mistake.

I'm afraid that earlier gcc-4.6 (sorry for very legacy) could not build the
changeset on e1d0249e5aeb76fb0bd5b1b6a6ac71599be871bf .

$ gcc --version
gcc-4.6.real (Debian 4.6.2-11) 4.6.2
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ make
...
In file included from
/home/mpsuzuki/redhat/BUILD/freetype2-current/freetype2/src/sfnt/sfnt.c:22:0:
/home/mpsuzuki/redhat/BUILD/freetype2-current/freetype2/src/sfnt/pngshim.c: In
function 'premultiply_data':
/home/mpsuzuki/redhat/BUILD/freetype2-current/freetype2/src/sfnt/pngshim.c:107:7:
warning: implicit declaration of function '__builtin_shuffle'
[-Wimplicit-function-declaration]
/home/mpsuzuki/redhat/BUILD/freetype2-current/freetype2/src/sfnt/pngshim.c:107:11:
error: incompatible types when assigning to type 'v82' from type 'int'
/home/mpsuzuki/redhat/BUILD/freetype2-current/freetype2/src/sfnt/pngshim.c:109:11:
error: incompatible types when assigning to type 'v82' from type 'int'
make: *** [/home/mpsuzuki/redhat/BUILD/freetype2-current/freetype2/objs/sfnt.lo]
Error 1

I'm unsure the most appropriate method to check the availability of the builtin
functions,
but comparing these 2 sources:
https://github.com/gcc-mirror/gcc/blob/gcc-4_6-branch/gcc/c-family/c-common.c
https://github.com/gcc-mirror/gcc/blob/gcc-4_7-branch/gcc/c-family/c-common.c
I guess __builtin_shuffle() is since gcc-4.7.

Therefore,

     52   /* Premultiplies data and converts RGBA bytes => BGRA. */
     53   static void
     54   premultiply_data( png_structp    png,
     55                     png_row_infop  row_info,
     56                     png_bytep      data )
     57   {
     58     unsigned int  i = 0, limit;
     59
     60     /* the `vector_size' attribute was introduced in gcc 3.1, which */
     61     /* predates clang; the `__BYTE_ORDER__' preprocessor symbol was */
     62     /* introduced in gcc 4.6 and clang 3.2, respectively            */
     63 #if ( ( defined( __GNUC__ )                                &&           
  \
     64         ( ( __GNUC__ >= 5 )                              ||             
  \
     65         ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ >= 6 ) ) ) )         || 
  \
     66       ( defined( __clang__ )                                       &&   
  \
     67         ( ( __clang_major__ >= 4 )                               ||     
  \
     68         ( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) 
&& \
     69     defined( __OPTIMIZE__ )                                            
&& \
     70     __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
     71
     72 #ifdef __clang__
     73     /* the clang documentation doesn't cover the two-argument case of */
     74     /* `__builtin_shufflevector'; however, it is is implemented since */
     75     /* version 2.8                                                    */
     76 #define vector_shuffle  __builtin_shufflevector
     77 #else
     78 #define vector_shuffle  __builtin_shuffle
     79 #endif

__GNUC_MINOR__ on line #65 should be "> 6", instead of ">= 6".

Or, should we add some test for the availability, into configure script?

Regards,
mpsuzuki




reply via email to

[Prev in Thread] Current Thread [Next in Thread]