On 05/08/2015 12:15 PM, Christophe CURIS wrote:
Because the C compiler cannot check the consistency between the type of the
variable being pointed to, and the type expected by the call-back function
that is used to parse and store the value from the configuration file,
there is a risk of mismatch that can cause Window Maker to misbehave due to
data corruption, which depends strongly on the configuration values and the
architecture on which Window Maker is running.
This patch introduces a script that checks the consistency where possible, to
raise the issues when performing "make check".
Hi Christophe,
I'm getting lots of errors from the new script:
make check-local
make[5]: Entering directory '/build/buildd/wmaker-0.95.6+201505081753/src'
../script/check-wmaker-loaddef-callbacks.sh \
--source "./defaults.c" --structure "staticOptionList" \
--field-value-ptr 4 --field-callback 5 \
--struct-def "wPreferences=./WindowMaker.h" \
--callback "getBool=char, getEnum=char, getInt=int" \
--callback "getModMask=int"
../script/check-wmaker-loaddef-callbacks.sh \
--source "./defaults.c" --structure "optionList" \
--field-value-ptr 4 --field-callback 5 \
--struct-def "wPreferences=./WindowMaker.h" \
--struct-def "legacy_minipreview_config=./defaults.c" \
--callback "getBool=char, getEnum=char, getInt=int" \
--callback "getPathList=char*, getCoord=WCoord"
Error: type mismatch between function and variable in ./defaults.c:350
Function: getModMask expects "int"
Variable: wPreferences.modifier_mask has type "unsigned int"
Error: type mismatch between function and variable in ./defaults.c:352
Function: getEnum expects "char"
Variable: wPreferences.focus_mode has type "signed char"
Makefile:854: recipe for target 'defaults-callbacks-static' failed
make[5]: *** [defaults-callbacks-static] Error 1
make[5]: *** Waiting for unfinished jobs....
Error: type mismatch between function and variable in ./defaults.c:377
Function: getEnum expects "char"
Variable: wPreferences.icon_yard has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:379
Function: getEnum expects "char"
Variable: wPreferences.iconification_style has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:383
Function: getEnum expects "char"
Variable: wPreferences.mouse_button1 has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:385
Function: getEnum expects "char"
Variable: wPreferences.mouse_button2 has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:387
Function: getEnum expects "char"
Variable: wPreferences.mouse_button3 has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:389
Function: getEnum expects "char"
Variable: wPreferences.mouse_button8 has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:391
Function: getEnum expects "char"
Variable: wPreferences.mouse_button9 has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:393
Function: getEnum expects "char"
Variable: wPreferences.mouse_wheel_scroll has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:395
Function: getEnum expects "char"
Variable: wPreferences.mouse_wheel_tilt has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:401
Function: getEnum expects "char"
Variable: wPreferences.colormap_mode has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:415
Function: getEnum expects "char"
Variable: wPreferences.workspace_name_display_position has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:419
Function: getInt expects "int"
Variable: wPreferences.workspace_border_size has type "unsigned int"
Error: type mismatch between function and variable in ./defaults.c:429
Function: getEnum expects "char"
Variable: wPreferences.menu_scroll_speed has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:431
Function: getEnum expects "char"
Variable: wPreferences.icon_slide_speed has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:433
Function: getEnum expects "char"
Variable: wPreferences.shade_speed has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:459
Function: getEnum expects "char"
Variable: wPreferences.window_placement has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:489
Function: getEnum expects "char"
Variable: wPreferences.size_display has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:491
Function: getEnum expects "char"
Variable: wPreferences.move_display has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:535
Function: getEnum expects "char"
Variable: wPreferences.menu_style has type "signed char"
Error: type mismatch between function and variable in ./defaults.c:550
Function: getEnum expects "char"
Variable: wPreferences.title_justification has type "signed char"
Makefile:862: recipe for target 'defaults-callbacks-dynamic' failed