Description of Problem: CDL objects with flavor 'bool' should be forced to evaluate to either 0 or 1 and a warning provided if they do not. This has been the source of many a bug... Version-Release number of selected component (if applicable): How Reproducible: Steps to Reproduce: 1. 2. 3. Actual Results: Expected Results: Additional Information:
Fixing this should be relatively simple. It would require a patch along the following lines: Index: cdllint =================================================================== RCS file: /home/cvs/ecc/host/tools/cdllint/cdllint,v retrieving revision 1.207 diff -u -u -r1.207 cdllint + proc cdllint_test286_boolflavor_plus_nonbool_value { valuable } { + + if { "bool" == [cdl_info $valuable flavor] } { + set expr "" + if { [cdl_info $valuable has_property "default_value"] } { + set expr [cdl_info $valuable get_property "default_value"] + } elseif { [cdl_info $valuable has_property "calculated"] } { + set expr [cdl_info $valuable get_property "calculated"] + } + if { "" != $expr } { + set result [cdl_eval $expr] + if { (0 != $result) && (1 != $result) } { + cdllint_report_failure "Valuable [cdl_info $valuable get_name] \ + is boolean but the default_value or calculated \ + expression evaluates to something other than 0 or 1. + } + } + } + } + + cdllint_apply_valuables cdllint_test286_boolflavor_plus_nonbool_value Obviously the same thing could be done at the libcdl C++ level, but it would require somewhat more code and certainly more development effort. A script-based solution is much easier to extend over time. There are only two minor problems with the above patch: 1) there is no functional Tcl interface to the libcdl data yet. As far as I am concerned this is the single largest hole in the current eCos host-side tools, and quite possible in all of eCos. 2) and hence there is no cdllint script yet. Once script access to the CDL data is available it should be possible to write a cdllint framework in just a few days, providing utility functions such as apply_values and report_failure, and then additional tests can be added as and when problems are reported. However progress is blocked until resources are allocated to work on the scripting.
This bug has moved to http://bugs.ecos.sourceware.org/show_bug.cgi?id=57736