FT_USE_MODULE declares things as:
extern const FT_Module_Class (or similar for C++). However, the actual types of the variables being declared are often different, e.g., FT_Driver_ClassRec or FT_Renderer_Class. (Some are, indeed, FT_Module_Class.) This works with most C compilers (since those structs begin with an FT_Module_Class struct), but technically it's undefined behavior. To quote the ISO/IEC 9899:TC2 final committee draft, section 6.2.7 paragraph 2: All declarations that refer to the same object or function shall have compatible type; otherwise, the behavior is undefined. (And they are not compatible types.) Most C compilers don't reject (or even detect!) code which has this issue, but the GCC LTO development branch compiler does. (It outputs the types of the objects while generating .o files, along with a bunch of other information, then compares them when doing the final link-time code generation pass.) Patch from Savannah bug #25133. * src/base/ftinit.c (FT_USE_MODULE): Include variable type. * builds/amiga/include/freetype/config/ftmodule.h, include/freetype/config/ftmodule.h, */module.mk: Updated to declare pass correct types to FT_USE_MODULE.
This commit is contained in:
parent
b6fa845146
commit
ce33a312da
38
ChangeLog
38
ChangeLog
@ -1,8 +1,44 @@
|
||||
2008-12-21 anonymous
|
||||
|
||||
FT_USE_MODULE declares things as:
|
||||
|
||||
extern const FT_Module_Class
|
||||
|
||||
(or similar for C++). However, the actual types of the variables
|
||||
being declared are often different, e.g., FT_Driver_ClassRec or
|
||||
FT_Renderer_Class. (Some are, indeed, FT_Module_Class.)
|
||||
|
||||
This works with most C compilers (since those structs begin with an
|
||||
FT_Module_Class struct), but technically it's undefined behavior.
|
||||
|
||||
To quote the ISO/IEC 9899:TC2 final committee draft, section 6.2.7
|
||||
paragraph 2:
|
||||
|
||||
All declarations that refer to the same object or function shall
|
||||
have compatible type; otherwise, the behavior is undefined.
|
||||
|
||||
(And they are not compatible types.)
|
||||
|
||||
Most C compilers don't reject (or even detect!) code which has this
|
||||
issue, but the GCC LTO development branch compiler does. (It
|
||||
outputs the types of the objects while generating .o files, along
|
||||
with a bunch of other information, then compares them when doing the
|
||||
final link-time code generation pass.)
|
||||
|
||||
Patch from Savannah bug #25133.
|
||||
|
||||
* src/base/ftinit.c (FT_USE_MODULE): Include variable type.
|
||||
|
||||
* builds/amiga/include/freetype/config/ftmodule.h,
|
||||
include/freetype/config/ftmodule.h, */module.mk: Updated to declare
|
||||
pass correct types to FT_USE_MODULE.
|
||||
|
||||
2008-12-21 Hongbo Ni <hongbo@njstar.com>
|
||||
|
||||
* src/autofit/aflatin.c (af_latin_hint_edges),
|
||||
src/autofit/aflatin2.c (af_latin2_hint_edges), src/autofit/afcjk.c
|
||||
(af_cjk_hint_edges): Protect against division by zero.
|
||||
(af_cjk_hint_edges): Protect against division by zero. This fixes
|
||||
Savannah bug #25124.
|
||||
|
||||
2008-12-18 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
|
@ -80,77 +80,77 @@
|
||||
/* Now include the modules */
|
||||
|
||||
#ifdef FT_USE_AUTOFIT
|
||||
FT_USE_MODULE(autofit_module_class)
|
||||
FT_USE_MODULE( FT_Module_Class, autofit_module_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_TT
|
||||
FT_USE_MODULE(tt_driver_class)
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_T1
|
||||
FT_USE_MODULE(t1_driver_class)
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_CFF
|
||||
FT_USE_MODULE(cff_driver_class)
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_T1CID
|
||||
FT_USE_MODULE(t1cid_driver_class)
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_PFR
|
||||
FT_USE_MODULE(pfr_driver_class)
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_T42
|
||||
FT_USE_MODULE(t42_driver_class)
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_WINFNT
|
||||
FT_USE_MODULE(winfnt_driver_class)
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_PCF
|
||||
FT_USE_MODULE(pcf_driver_class)
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_PSAUX
|
||||
FT_USE_MODULE(psaux_module_class)
|
||||
FT_USE_MODULE( FT_Module_Class, psaux_module_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_PSNAMES
|
||||
FT_USE_MODULE(psnames_module_class)
|
||||
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_PSHINT
|
||||
FT_USE_MODULE(pshinter_module_class)
|
||||
FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_RASTER
|
||||
FT_USE_MODULE(ft_raster1_renderer_class)
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_SFNT
|
||||
FT_USE_MODULE(sfnt_module_class)
|
||||
FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_SMOOTH
|
||||
FT_USE_MODULE(ft_smooth_renderer_class)
|
||||
FT_USE_MODULE(ft_smooth_lcd_renderer_class)
|
||||
FT_USE_MODULE(ft_smooth_lcdv_renderer_class)
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_OTV
|
||||
FT_USE_MODULE(otv_module_class)
|
||||
FT_USE_MODULE( FT_Module_Class, otv_module_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_BDF
|
||||
FT_USE_MODULE(bdf_driver_class)
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
|
||||
#endif
|
||||
|
||||
#ifdef FT_USE_GXV
|
||||
FT_USE_MODULE(gxv_module_class)
|
||||
FT_USE_MODULE( FT_Module_Class, gxv_module_class )
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -10,23 +10,23 @@
|
||||
*
|
||||
*/
|
||||
|
||||
FT_USE_MODULE(autofit_module_class)
|
||||
FT_USE_MODULE(tt_driver_class)
|
||||
FT_USE_MODULE(t1_driver_class)
|
||||
FT_USE_MODULE(cff_driver_class)
|
||||
FT_USE_MODULE(t1cid_driver_class)
|
||||
FT_USE_MODULE(pfr_driver_class)
|
||||
FT_USE_MODULE(t42_driver_class)
|
||||
FT_USE_MODULE(winfnt_driver_class)
|
||||
FT_USE_MODULE(pcf_driver_class)
|
||||
FT_USE_MODULE(psaux_module_class)
|
||||
FT_USE_MODULE(psnames_module_class)
|
||||
FT_USE_MODULE(pshinter_module_class)
|
||||
FT_USE_MODULE(ft_raster1_renderer_class)
|
||||
FT_USE_MODULE(sfnt_module_class)
|
||||
FT_USE_MODULE(ft_smooth_renderer_class)
|
||||
FT_USE_MODULE(ft_smooth_lcd_renderer_class)
|
||||
FT_USE_MODULE(ft_smooth_lcdv_renderer_class)
|
||||
FT_USE_MODULE(bdf_driver_class)
|
||||
FT_USE_MODULE( FT_Module_Class, autofit_module_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
|
||||
FT_USE_MODULE( FT_Module_Class, psaux_module_class )
|
||||
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
|
||||
FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
|
||||
FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
|
||||
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
|
||||
FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
|
||||
|
||||
/* EOF */
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += AUTOFIT_MODULE
|
||||
|
||||
define AUTOFIT_MODULE
|
||||
$(OPEN_DRIVER)autofit_module_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Module_Class, autofit_module_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)autofit $(ECHO_DRIVER_DESC)automatic hinting module$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -55,9 +55,9 @@
|
||||
|
||||
#undef FT_USE_MODULE
|
||||
#ifdef __cplusplus
|
||||
#define FT_USE_MODULE( x ) extern "C" const FT_Module_Class x;
|
||||
#define FT_USE_MODULE( type, x ) extern "C" const type x;
|
||||
#else
|
||||
#define FT_USE_MODULE( x ) extern const FT_Module_Class x;
|
||||
#define FT_USE_MODULE( type, x ) extern const type x;
|
||||
#endif
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
|
||||
|
||||
#undef FT_USE_MODULE
|
||||
#define FT_USE_MODULE( x ) (const FT_Module_Class*)&(x),
|
||||
#define FT_USE_MODULE( type, x ) (const FT_Module_Class*)&(x),
|
||||
|
||||
static
|
||||
const FT_Module_Class* const ft_default_modules[] =
|
||||
|
@ -27,7 +27,7 @@
|
||||
FTMODULE_H_COMMANDS += BDF_DRIVER
|
||||
|
||||
define BDF_DRIVER
|
||||
$(OPEN_DRIVER)bdf_driver_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Driver_ClassRec, bdf_driver_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)bdf $(ECHO_DRIVER_DESC)bdf bitmap fonts$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += CFF_DRIVER
|
||||
|
||||
define CFF_DRIVER
|
||||
$(OPEN_DRIVER)cff_driver_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Driver_ClassRec, cff_driver_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)cff $(ECHO_DRIVER_DESC)OpenType fonts with extension *.otf$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += TYPE1CID_DRIVER
|
||||
|
||||
define TYPE1CID_DRIVER
|
||||
$(OPEN_DRIVER)t1cid_driver_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Driver_ClassRec, t1cid_driver_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)cid $(ECHO_DRIVER_DESC)Postscript CID-keyed fonts, no known extension$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += GXVALID_MODULE
|
||||
|
||||
define GXVALID_MODULE
|
||||
$(OPEN_DRIVER)gxv_module_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Module_Class, gxv_module_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)gxvalid $(ECHO_DRIVER_DESC)TrueTypeGX/AAT validation module$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += OTVALID_MODULE
|
||||
|
||||
define OTVALID_MODULE
|
||||
$(OPEN_DRIVER)otv_module_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Module_Class, otv_module_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)otvalid $(ECHO_DRIVER_DESC)OpenType validation module$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
FTMODULE_H_COMMANDS += PCF_DRIVER
|
||||
|
||||
define PCF_DRIVER
|
||||
$(OPEN_DRIVER)pcf_driver_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Driver_ClassRec, pcf_driver_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)pcf $(ECHO_DRIVER_DESC)pcf bitmap fonts$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += PFR_DRIVER
|
||||
|
||||
define PFR_DRIVER
|
||||
$(OPEN_DRIVER)pfr_driver_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Driver_ClassRec, pfr_driver_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)pfr $(ECHO_DRIVER_DESC)PFR/TrueDoc font files with extension *.pfr$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += PSAUX_MODULE
|
||||
|
||||
define PSAUX_MODULE
|
||||
$(OPEN_DRIVER)psaux_module_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Module_Class, psaux_module_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)psaux $(ECHO_DRIVER_DESC)Postscript Type 1 & Type 2 helper module$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += PSHINTER_MODULE
|
||||
|
||||
define PSHINTER_MODULE
|
||||
$(OPEN_DRIVER)pshinter_module_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Module_Class, pshinter_module_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)pshinter $(ECHO_DRIVER_DESC)Postscript hinter module$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += PSNAMES_MODULE
|
||||
|
||||
define PSNAMES_MODULE
|
||||
$(OPEN_DRIVER)psnames_module_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Module_Class, psnames_module_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)psnames $(ECHO_DRIVER_DESC)Postscript & Unicode Glyph name handling$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += RASTER_MODULE
|
||||
|
||||
define RASTER_MODULE
|
||||
$(OPEN_DRIVER)ft_raster1_renderer_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Renderer_Class, ft_raster1_renderer_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)raster $(ECHO_DRIVER_DESC)monochrome bitmap renderer$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += SFNT_MODULE
|
||||
|
||||
define SFNT_MODULE
|
||||
$(OPEN_DRIVER)sfnt_module_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Module_Class, sfnt_module_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)sfnt $(ECHO_DRIVER_DESC)helper module for TrueType & OpenType formats$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,11 +16,11 @@
|
||||
FTMODULE_H_COMMANDS += SMOOTH_RENDERER
|
||||
|
||||
define SMOOTH_RENDERER
|
||||
$(OPEN_DRIVER)ft_smooth_renderer_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_renderer_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer$(ECHO_DRIVER_DONE)
|
||||
$(OPEN_DRIVER)ft_smooth_lcd_renderer_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcd_renderer_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for LCDs$(ECHO_DRIVER_DONE)
|
||||
$(OPEN_DRIVER)ft_smooth_lcdv_renderer_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Renderer_Class, ft_smooth_lcdv_renderer_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)smooth $(ECHO_DRIVER_DESC)anti-aliased bitmap renderer for vertical LCDs$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += TRUETYPE_DRIVER
|
||||
|
||||
define TRUETYPE_DRIVER
|
||||
$(OPEN_DRIVER)tt_driver_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Driver_ClassRec, tt_driver_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)truetype $(ECHO_DRIVER_DESC)Windows/Mac font files with extension *.ttf or *.ttc$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += TYPE1_DRIVER
|
||||
|
||||
define TYPE1_DRIVER
|
||||
$(OPEN_DRIVER)t1_driver_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Driver_ClassRec, t1_driver_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)type1 $(ECHO_DRIVER_DESC)Postscript font files with extension *.pfa or *.pfb$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += TYPE42_DRIVER
|
||||
|
||||
define TYPE42_DRIVER
|
||||
$(OPEN_DRIVER)t42_driver_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Driver_ClassRec, t42_driver_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)type42 $(ECHO_DRIVER_DESC)Type 42 font files with no known extension$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
FTMODULE_H_COMMANDS += WINDOWS_DRIVER
|
||||
|
||||
define WINDOWS_DRIVER
|
||||
$(OPEN_DRIVER)winfnt_driver_class$(CLOSE_DRIVER)
|
||||
$(OPEN_DRIVER) FT_Driver_ClassRec, winfnt_driver_class $(CLOSE_DRIVER)
|
||||
$(ECHO_DRIVER)winfnt $(ECHO_DRIVER_DESC)Windows bitmap fonts with extension *.fnt or *.fon$(ECHO_DRIVER_DONE)
|
||||
endef
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user