New `TYPEOF' macro.
This helps suppress signedness warnings, avoiding issues with implicit conversion changes. * include/config/ftconfig.h, builds/unix/ftconfig.in, builds/vms/ftconfig.h (TYPEOF): Define. * include/internal/ftobjs.h (FT_PAD_FLOOR, FT_PIX_FLOOR), src/autofit/afwarp.h (AF_WARPER_FLOOR): Use it.
This commit is contained in:
parent
1f377f0d50
commit
6f325c26cf
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
2015-02-16 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
New `TYPEOF' macro.
|
||||
|
||||
This helps suppress signedness warnings, avoiding issues with
|
||||
implicit conversion changes.
|
||||
|
||||
* include/config/ftconfig.h, builds/unix/ftconfig.in,
|
||||
builds/vms/ftconfig.h (TYPEOF): Define.
|
||||
|
||||
* include/internal/ftobjs.h (FT_PAD_FLOOR, FT_PIX_FLOOR),
|
||||
src/autofit/afwarp.h (AF_WARPER_FLOOR): Use it.
|
||||
|
||||
2015-02-16 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/base/ftsystem.c: Use casts in standard C function wrappers.
|
||||
|
@ -89,7 +89,7 @@ FT_BEGIN_HEADER
|
||||
/* is copied from default include/config/ftconfig.h. */
|
||||
/* If any improvement is required for this file, it should be */
|
||||
/* applied to the original header file for the builders that */
|
||||
/* does not use configure script. */
|
||||
/* do not use configure script. */
|
||||
|
||||
/* The size of an `int' type. */
|
||||
#if FT_UINT_MAX == 0xFFFFUL
|
||||
@ -349,11 +349,29 @@ FT_BEGIN_HEADER
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Section> */
|
||||
/* miscellaneous */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#define FT_BEGIN_STMNT do {
|
||||
#define FT_END_STMNT } while ( 0 )
|
||||
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
|
||||
|
||||
|
||||
/* typeof condition taken from gnulib's `intprops.h' header file */
|
||||
#if ( __GNUC__ >= 2 || \
|
||||
defined( __IBM__TYPEOF__ ) || \
|
||||
( __SUNPRO_C >= 0x5110 && !__STDC__ ) )
|
||||
#define TYPEOF( type, x ) (__typeof__ (type))(x)
|
||||
#else
|
||||
#define TYPEOF( type, x ) (x)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
|
||||
|
||||
#define FT_LOCAL( x ) static x
|
||||
|
@ -292,11 +292,29 @@ FT_BEGIN_HEADER
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Section> */
|
||||
/* miscellaneous */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#define FT_BEGIN_STMNT do {
|
||||
#define FT_END_STMNT } while ( 0 )
|
||||
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
|
||||
|
||||
|
||||
/* typeof condition taken from gnulib's `intprops.h' header file */
|
||||
#if ( __GNUC__ >= 2 || \
|
||||
defined( __IBM__TYPEOF__ ) || \
|
||||
( __SUNPRO_C >= 0x5110 && !__STDC__ ) )
|
||||
#define TYPEOF( type, x ) (__typeof__ (type))(x)
|
||||
#else
|
||||
#define TYPEOF( type, x ) (x)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
|
||||
|
||||
#define FT_LOCAL( x ) static x
|
||||
|
@ -319,11 +319,29 @@ FT_BEGIN_HEADER
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Section> */
|
||||
/* miscellaneous */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#define FT_BEGIN_STMNT do {
|
||||
#define FT_END_STMNT } while ( 0 )
|
||||
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
|
||||
|
||||
|
||||
/* typeof condition taken from gnulib's `intprops.h' header file */
|
||||
#if ( __GNUC__ >= 2 || \
|
||||
defined( __IBM__TYPEOF__ ) || \
|
||||
( __SUNPRO_C >= 0x5110 && !__STDC__ ) )
|
||||
#define TYPEOF( type, x ) (__typeof__ (type))(x)
|
||||
#else
|
||||
#define TYPEOF( type, x ) (x)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
|
||||
|
||||
#define FT_LOCAL( x ) static x
|
||||
|
@ -83,11 +83,12 @@ FT_BEGIN_HEADER
|
||||
x > y ? x + ( 3 * y >> 3 ) \
|
||||
: y + ( 3 * x >> 3 ) )
|
||||
|
||||
#define FT_PAD_FLOOR( x, n ) ( (x) & ~((n)-1) )
|
||||
/* we use the TYPEOF macro to suppress signedness compilation warnings */
|
||||
#define FT_PAD_FLOOR( x, n ) ( (x) & ~TYPEOF( x, (n)-1 ) )
|
||||
#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n )
|
||||
#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n )
|
||||
|
||||
#define FT_PIX_FLOOR( x ) ( (x) & ~63 )
|
||||
#define FT_PIX_FLOOR( x ) ( (x) & ~TYPEOF( x, 63 ) )
|
||||
#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 )
|
||||
#define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 )
|
||||
|
||||
|
@ -25,7 +25,7 @@ FT_BEGIN_HEADER
|
||||
|
||||
#define AF_WARPER_SCALE
|
||||
|
||||
#define AF_WARPER_FLOOR( x ) ( (x) & ~63 )
|
||||
#define AF_WARPER_FLOOR( x ) ( (x) & ~TYPEOF( x, 63 ) )
|
||||
#define AF_WARPER_CEIL( x ) AF_WARPER_FLOOR( (x) + 63 )
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user