1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-25 07:32:36 +01:00

wmaker: add script to check the call-back function used when loading configuration

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".

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2015-05-08 13:18:59 +02:00
committed by Carlos R. Mafra
parent 3d6da4b210
commit ba3e575971
3 changed files with 500 additions and 0 deletions

View File

@@ -165,3 +165,32 @@ wmaker_LDADD = \
@XLIBS@ \
@LIBM@ \
@INTLIBS@
######################################################################
# Create a 'silent rule' for our make check the same way automake does
AM_V_CHKOPTS = $(am__v_CHKOPTS_$(V))
am__v_CHKOPTS_ = $(am__v_CHKOPTS_$(AM_DEFAULT_VERBOSITY))
am__v_CHKOPTS_0 = @echo " CHK $@" ;
am__v_CHKOPTS_1 =
check-local: defaults-callbacks-static defaults-callbacks-dynamic
# Check that the callback functions used to load the configuration match
# the type of the variable where the value will be stored
defaults-callbacks-static:
$(AM_V_CHKOPTS)$(top_srcdir)/script/check-wmaker-loaddef-callbacks.sh \
--source "$(srcdir)/defaults.c" --structure "staticOptionList" \
--field-value-ptr 4 --field-callback 5 \
--struct-def "wPreferences=$(srcdir)/WindowMaker.h" \
--callback "getBool=char, getEnum=char, getInt=int" \
--callback "getModMask=int"
defaults-callbacks-dynamic:
$(AM_V_CHKOPTS)$(top_srcdir)/script/check-wmaker-loaddef-callbacks.sh \
--source "$(srcdir)/defaults.c" --structure "optionList" \
--field-value-ptr 4 --field-callback 5 \
--struct-def "wPreferences=$(srcdir)/WindowMaker.h" \
--struct-def "legacy_minipreview_config=$(srcdir)/defaults.c" \
--callback "getBool=char, getEnum=char, getInt=int" \
--callback "getPathList=char*, getCoord=WCoord"