From 3c96681856f2d4ac8bdd1f6a1e64fbfd9fd30d8e Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Sun, 15 Jan 2012 23:35:31 +0900 Subject: [PATCH] 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}. --- ChangeLog | 37 ++++++++++++++++++++++++++++ include/freetype/internal/ftdriver.h | 6 ++--- include/freetype/internal/ftobjs.h | 12 ++++----- src/autofit/afpic.h | 7 ++++++ src/base/basepic.h | 5 ++-- src/cff/cffpic.h | 7 ++++++ src/pshinter/pshpic.h | 6 +++++ src/psnames/pspic.h | 7 ++++++ src/raster/rastpic.h | 13 ++++++++++ src/sfnt/sfntpic.h | 7 ++++++ src/smooth/ftspic.h | 19 ++++++++++++++ src/truetype/ttpic.h | 7 ++++++ 12 files changed, 122 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index c4f42abcc..7e4342275 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,40 @@ +2012-01-15 suzuki toshiya + + 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 Make pspic.c to include module error header to fix multi build. diff --git a/include/freetype/internal/ftdriver.h b/include/freetype/internal/ftdriver.h index 625a040d2..4d541cfc8 100644 --- a/include/freetype/internal/ftdriver.h +++ b/include/freetype/internal/ftdriver.h @@ -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, \ diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 670eb78a8..b38b41ee9 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -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, \ diff --git a/src/autofit/afpic.h b/src/autofit/afpic.h index c1632e76e..69e442f69 100644 --- a/src/autofit/afpic.h +++ b/src/autofit/afpic.h @@ -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 */ /* */ diff --git a/src/base/basepic.h b/src/base/basepic.h index bb1774576..f551cb6cb 100644 --- a/src/base/basepic.h +++ b/src/base/basepic.h @@ -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 */ /* */ diff --git a/src/cff/cffpic.h b/src/cff/cffpic.h index e29d06813..342bf31d3 100644 --- a/src/cff/cffpic.h +++ b/src/cff/cffpic.h @@ -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 */ /* */ diff --git a/src/pshinter/pshpic.h b/src/pshinter/pshpic.h index 3555d8e85..317a2df7f 100644 --- a/src/pshinter/pshpic.h +++ b/src/pshinter/pshpic.h @@ -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 */ diff --git a/src/psnames/pspic.h b/src/psnames/pspic.h index 75a14fdcb..e585e8565 100644 --- a/src/psnames/pspic.h +++ b/src/psnames/pspic.h @@ -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 */ /* */ diff --git a/src/raster/rastpic.h b/src/raster/rastpic.h index dcd82b8ca..ee39f2a50 100644 --- a/src/raster/rastpic.h +++ b/src/raster/rastpic.h @@ -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 */ /* */ diff --git a/src/sfnt/sfntpic.h b/src/sfnt/sfntpic.h index 6943b4250..11a78f775 100644 --- a/src/sfnt/sfntpic.h +++ b/src/sfnt/sfntpic.h @@ -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 */ /* */ diff --git a/src/smooth/ftspic.h b/src/smooth/ftspic.h index c7e0ce9d8..e83e4579d 100644 --- a/src/smooth/ftspic.h +++ b/src/smooth/ftspic.h @@ -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 */ /* */ diff --git a/src/truetype/ttpic.h b/src/truetype/ttpic.h index 84de0fee9..d9ea9d18c 100644 --- a/src/truetype/ttpic.h +++ b/src/truetype/ttpic.h @@ -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 */ /* */