Fix redundant declaration warning in PIC mode.

Originally FT_DEFINE_{DRIVER,MODULE,RENDERER}() macros were
designed to declare xxx_pic_{free,init} by themselves.
Because these macros are used at the end of the module
interface (e.g. ttdriver.c) and the wrapper source to build
a module as a single object (e.g. truetype.c) includes
the PIC file (e.g. ttpic.c) before the module interface,
these macros are expanded AFTER xxx_pic_{free,init} body
when the modules are built as single object.
The declaration after the implementation causes the redundant
declaration warnings, so the declarations are moved to module
PIC headers (e.g. ttpic.h).  Separating to other header files
are needed for multi build.

* include/freetype/internal/ftdriver.h (FT_DEFINE_DRIVER):
Remove class_##_pic_free and class_##_pic_init declarations.
* include/freetype/internal/ftobjs.h (FT_DEFINE_RENDERER,
FT_DEFINE_MODULE): Ditto.

* src/base/basepic.h: Insert a comment and fix coding style.
* src/autofit/afpic.h: Declare autofit_module_class_pic_{free,
init}.
* src/cff/cffpic.h: Declare cff_driver_class_pic_{free,init}.
* src/pshinter/pshpic.h: Declare pshinter_module_class_pic_{free,
init}.
* src/psnames/pspic.h: Declare psnames_module_class_pic_{free,
init}.
* src/raster/rastpic.h: Declare
ft_raster{1,5}_renderer_class_pic_{free,init}
* src/sfnt/sfntpic.h: Declare sfnt_module_class_pic_{free,init}.
* src/smooth/ftspic.h: Declare
ft_smooth_{,lcd_,lcdv_}renderer_class_pic_{free,init}.
* src/truetype/ttpic.h: Declare tt_driver_class_pic_{free,init}.
This commit is contained in:
suzuki toshiya 2012-01-15 23:35:31 +09:00
parent e38acb0d53
commit 3c96681856
12 changed files with 122 additions and 11 deletions

View File

@ -1,3 +1,40 @@
2012-01-15 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Fix redundant declaration warning in PIC mode.
Originally FT_DEFINE_{DRIVER,MODULE,RENDERER}() macros were
designed to declare xxx_pic_{free,init} by themselves.
Because these macros are used at the end of the module
interface (e.g. ttdriver.c) and the wrapper source to build
a module as a single object (e.g. truetype.c) includes
the PIC file (e.g. ttpic.c) before the module interface,
these macros are expanded AFTER xxx_pic_{free,init} body
when the modules are built as single object.
The declaration after the implementation causes the redundant
declaration warnings, so the declarations are moved to module
PIC headers (e.g. ttpic.h). Separating to other header files
are needed for multi build.
* include/freetype/internal/ftdriver.h (FT_DEFINE_DRIVER):
Remove class_##_pic_free and class_##_pic_init declarations.
* include/freetype/internal/ftobjs.h (FT_DEFINE_RENDERER,
FT_DEFINE_MODULE): Ditto.
* src/base/basepic.h: Insert a comment and fix coding style.
* src/autofit/afpic.h: Declare autofit_module_class_pic_{free,
init}.
* src/cff/cffpic.h: Declare cff_driver_class_pic_{free,init}.
* src/pshinter/pshpic.h: Declare pshinter_module_class_pic_{free,
init}.
* src/psnames/pspic.h: Declare psnames_module_class_pic_{free,
init}.
* src/raster/rastpic.h: Declare
ft_raster{1,5}_renderer_class_pic_{free,init}
* src/sfnt/sfntpic.h: Declare sfnt_module_class_pic_{free,init}.
* src/smooth/ftspic.h: Declare
ft_smooth_{,lcd_,lcdv_}renderer_class_pic_{free,init}.
* src/truetype/ttpic.h: Declare tt_driver_class_pic_{free,init}.
2012-01-15 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Make pspic.c to include module error header to fix multi build.

View File

@ -267,7 +267,9 @@ FT_BEGIN_HEADER
/* and initialize any additional global data, like module specific */
/* interface, and put them in the global pic container defined in */
/* ftpic.h. if you don't need them just implement the functions as */
/* empty to resolve the link error. */
/* empty to resolve the link error. Also the pic_init and pic_free */
/* functions should be declared in pic.h, to be referred by driver */
/* definition calling FT_DEFINE_DRIVER() in following. */
/* */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */
@ -347,8 +349,6 @@ FT_BEGIN_HEADER
old_set_char_sizes_, old_set_pixel_sizes_, \
load_glyph_, get_kerning_, attach_file_, \
get_advances_, request_size_, select_size_ ) \
void class_##_pic_free( FT_Library library ); \
FT_Error class_##_pic_init( FT_Library library ); \
\
void \
FT_Destroy_Class_##class_( FT_Library library, \

View File

@ -1119,7 +1119,9 @@ FT_BEGIN_HEADER
/* and initialize any additional global data, like module specific */
/* interface, and put them in the global pic container defined in */
/* ftpic.h. if you don't need them just implement the functions as */
/* empty to resolve the link error. */
/* empty to resolve the link error. Also the pic_init and pic_free */
/* functions should be declared in pic.h, to be referred by renderer */
/* definition calling FT_DEFINE_RENDERER() in following. */
/* */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */
@ -1159,8 +1161,6 @@ FT_BEGIN_HEADER
interface_, init_, done_, get_interface_, \
glyph_format_, render_glyph_, transform_glyph_, \
get_glyph_cbox_, set_mode_, raster_class_ ) \
void class_##_pic_free( FT_Library library ); \
FT_Error class_##_pic_init( FT_Library library ); \
\
void \
FT_Destroy_Class_##class_( FT_Library library, \
@ -1290,7 +1290,9 @@ FT_BEGIN_HEADER
/* and initialize any additional global data, like module specific */
/* interface, and put them in the global pic container defined in */
/* ftpic.h. if you don't need them just implement the functions as */
/* empty to resolve the link error. */
/* empty to resolve the link error. Also the pic_init and pic_free */
/* functions should be declared in pic.h, to be referred by module */
/* definition calling FT_DEFINE_MODULE() in following. */
/* */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */
@ -1371,8 +1373,6 @@ FT_BEGIN_HEADER
#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \
interface_, init_, done_, get_interface_) \
void class_##_pic_free( FT_Library library ); \
FT_Error class_##_pic_init( FT_Library library ); \
\
void \
FT_Destroy_Class_##class_( FT_Library library, \

View File

@ -57,6 +57,13 @@ FT_BEGIN_HEADER
#define AF_AF_AUTOFITTER_SERVICE_GET \
( GET_PIC( library )->af_autofitter_service )
/* see afpic.c for the implementation */
void
autofit_module_class_pic_free( FT_Library library );
FT_Error
autofit_module_class_pic_init( FT_Library library );
#endif /* FT_CONFIG_OPTION_PIC */
/* */

View File

@ -45,11 +45,12 @@ FT_BEGIN_HEADER
#define FT_BITMAP_GLYPH_CLASS_GET (&GET_PIC(library)->ft_bitmap_glyph_class)
#define FT_DEFAULT_MODULES_GET (GET_PIC(library)->default_module_classes)
/* see basepic.c for the implementation. */
void
ft_base_pic_free( FT_Library library );
ft_base_pic_free( FT_Library library );
FT_Error
ft_base_pic_init( FT_Library library );
ft_base_pic_init( FT_Library library );
#endif /* FT_CONFIG_OPTION_PIC */
/* */

View File

@ -68,6 +68,13 @@ FT_BEGIN_HEADER
#define FT_CFF_CMAP_UNICODE_CLASS_REC_GET (GET_PIC(library)->cff_cmap_unicode_class_rec)
#define FT_CFF_FIELD_HANDLERS_GET (GET_PIC(library)->cff_field_handlers)
/* see cffpic.c for the implementation */
void
cff_driver_class_pic_free( FT_Library library );
FT_Error
cff_driver_class_pic_init( FT_Library library );
#endif /* FT_CONFIG_OPTION_PIC */
/* */

View File

@ -40,6 +40,12 @@ FT_BEGIN_HEADER
#define GET_PIC(lib) ((PSHinterPIC*)((lib)->pic_container.autofit))
#define FTPSHINTER_INTERFACE_GET (GET_PIC(library)->pshinter_interface)
/* see pshpic.c for the implementation */
void
pshinter_module_class_pic_free( FT_Library library );
FT_Error
pshinter_module_class_pic_init( FT_Library library );
#endif /* FT_CONFIG_OPTION_PIC */

View File

@ -42,6 +42,13 @@ FT_BEGIN_HEADER
#define FT_PSCMAPS_SERVICES_GET (GET_PIC(library)->pscmaps_services)
#define FT_PSCMAPS_INTERFACE_GET (GET_PIC(library)->pscmaps_interface)
/* see pspic.c for the implementation */
void
psnames_module_class_pic_free( FT_Library library );
FT_Error
psnames_module_class_pic_init( FT_Library library );
#endif /* FT_CONFIG_OPTION_PIC */
/* */

View File

@ -38,6 +38,19 @@ FT_BEGIN_HEADER
#define GET_PIC(lib) ((RasterPIC*)((lib)->pic_container.raster))
#define FT_STANDARD_RASTER_GET (GET_PIC(library)->ft_standard_raster)
/* see rastpic.c for the implementation */
void
ft_raster1_renderer_class_pic_free( FT_Library library );
void
ft_raster5_renderer_class_pic_free( FT_Library library );
FT_Error
ft_raster1_renderer_class_pic_init( FT_Library library );
FT_Error
ft_raster5_renderer_class_pic_init( FT_Library library );
#endif /* FT_CONFIG_OPTION_PIC */
/* */

View File

@ -76,6 +76,13 @@ typedef struct sfntModulePIC_
#define FT_SFNT_SERVICE_BDF_GET (GET_PIC(library)->sfnt_service_bdf)
#define FT_SFNT_INTERFACE_GET (GET_PIC(library)->sfnt_interface)
/* see sfntpic.c for the implementation */
void
sfnt_module_class_pic_free( FT_Library library );
FT_Error
sfnt_module_class_pic_init( FT_Library library );
#endif /* FT_CONFIG_OPTION_PIC */
/* */

View File

@ -38,6 +38,25 @@ FT_BEGIN_HEADER
#define GET_PIC(lib) ((SmoothPIC*)((lib)->pic_container.smooth))
#define FT_GRAYS_RASTER_GET (GET_PIC(library)->ft_grays_raster)
/* see ftspic.c for the implementation */
void
ft_smooth_renderer_class_pic_free( FT_Library library );
void
ft_smooth_lcd_renderer_class_pic_free( FT_Library library );
void
ft_smooth_lcdv_renderer_class_pic_free( FT_Library library );
FT_Error
ft_smooth_renderer_class_pic_init( FT_Library library );
FT_Error
ft_smooth_lcd_renderer_class_pic_init( FT_Library library );
FT_Error
ft_smooth_lcdv_renderer_class_pic_init( FT_Library library );
#endif /* FT_CONFIG_OPTION_PIC */
/* */

View File

@ -47,6 +47,13 @@ FT_BEGIN_HEADER
#define FT_TT_SERVICE_GX_MULTI_MASTERS_GET (GET_PIC(library)->tt_service_gx_multi_masters)
#define FT_TT_SERVICE_TRUETYPE_GLYF_GET (GET_PIC(library)->tt_service_truetype_glyf)
/* see ttpic.c for the implementation */
void
tt_driver_class_pic_free( FT_Library library );
FT_Error
tt_driver_class_pic_init( FT_Library library );
#endif /* FT_CONFIG_OPTION_PIC */
/* */