diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | builds/unix/ftconfig.in | 20 | ||||
-rw-r--r-- | builds/vms/ftconfig.h | 18 | ||||
-rw-r--r-- | include/config/ftconfig.h | 18 | ||||
-rw-r--r-- | include/internal/ftobjs.h | 5 | ||||
-rw-r--r-- | src/autofit/afwarp.h | 2 |
6 files changed, 72 insertions, 4 deletions
@@ -1,5 +1,18 @@ 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. (ft_alloc, ft_realloc, ft_ansi_stream_io, FT_Stream_Open): Do it. diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in index 6d28b6157..47ca2daf7 100644 --- a/builds/unix/ftconfig.in +++ b/builds/unix/ftconfig.in @@ -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 diff --git a/builds/vms/ftconfig.h b/builds/vms/ftconfig.h index 0e0502856..571c3e505 100644 --- a/builds/vms/ftconfig.h +++ b/builds/vms/ftconfig.h @@ -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 diff --git a/include/config/ftconfig.h b/include/config/ftconfig.h index c165fa5de..b9fbfe283 100644 --- a/include/config/ftconfig.h +++ b/include/config/ftconfig.h @@ -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 diff --git a/include/internal/ftobjs.h b/include/internal/ftobjs.h index f08b8fa34..80c12b399 100644 --- a/include/internal/ftobjs.h +++ b/include/internal/ftobjs.h @@ -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 ) diff --git a/src/autofit/afwarp.h b/src/autofit/afwarp.h index 3b1c87ad9..a2c5f7748 100644 --- a/src/autofit/afwarp.h +++ b/src/autofit/afwarp.h @@ -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 ) |