[CN-Exec] Idiomatic encoding of constants not supported #798
Labels
CN-exec
Related to CN executable spec generation, called using `cn instrument`
enhancement
New feature or request
Summary
cn test
doesn't support the style guide's recommended encoding of macro-defined constants. We need this for the OpenSUT MKM proof (target code here).Problem
In order to support macro-defined constants, the CN style guide recommends the following idiom (see here, from which this example is taken):
cn test
doesn't support this idiom:CN version:
git-140db7a8a [2024-12-26 17:38:30 +0000]
Analysis
We need this capability for the MKM proof. See the boilerplate code here which lifts the constants defined in
policy.h
into CN-level functions.We could work around this limitation in MKM, but the obvious way to do it would be to concretize all these values - expensive to maintain and unnecessary for
cn verify
. This is a bit of an annoying problem to have, because the only reason we introduced these functions in the first place is to work around another CN limitation, the lack of support for macro constants.Intuitively seems like this should be relatively easy limitation to lift, since the whole point is the CN-level function is something very simple, a constant value. But this fact isn't apparent from the code, it's just a consequence of the way we use the idiom.
We have separately talked about whether there should be a more developed facility / keyword for lifting constants into CN. See #378 and various backchannel discussions. To me this gives more evidence we should add a
cn_const
keyword, or just lift all constants by default.cc: @yav since we talked recently about
cn test
and improving the way CN preprocesses files, @bcpierce00 since we want to eventually port the CN manual to a 'testing-first' style of exposition, and @podhrmic re the OpenSUT MKM code.The text was updated successfully, but these errors were encountered: