aboutsummaryrefslogtreecommitdiffhomepage
path: root/debian/sciteco-gtk.install
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2025-12-26 18:10:42 +0100
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2025-12-26 18:10:42 +0100
commitc2114fa0af73b42bc1ef302f7511ef87690cc0b1 (patch)
tree3a0ad484d1e4c06e20efa8358f4261f16abe7542 /debian/sciteco-gtk.install
parentd7330f252e6b0a1326eac6b5fc0b219a7b706eb7 (diff)
TECO_DEFINE_STATE() no longer constructs callback names for mandatory callbacks, but tries to use static assertionsHEADmaster
* Requiring state callbacks by generating their names (e.g. NAME##_input) has several disadvantages: * The callback is not explicitly referenced when the state is defined. So an unintroduced reader will see some static function, which is nowhere referenced and still doesn't cause "unused" warnings. * You cannot choose the name of function that implements the callback freely. * In "substates" you need to generate a callback function if you want to provide a default. You also need to provide dummy wrapper functions whenever you want to reuse some existing function as the implementation. * Instead, we are now using static assertions to check whether certain callbacks have been implemented. Unfortunately, this does not work on all compilers. In particular GCC won't consider references to state objects fully constant (even though they are) and does not allow them in _Static_assert (G_STATIC_ASSERT). This could only be made to work in newer GCC with -std=c2x or -std=gnu23 in combination with constexpr. It does work on Clang, though. So I introduced TECO_ASSERT_SAFE() which also passes if the expression is *not* constant. These static assertions are not crucial - they do not check anything that can differ between systems. So we can always rely on the checks performed by FreeBSD CI for instance. Also, you will of course quickly notice missing callbacks at runtime - with and without additional runtime assertions. * All mandatory callbacks must still be explicitly initialized in the TECO_DEFINE_STATE calls. * After getting rid of generated callback implementations, the TECO_DEFINE_STATE macros can finally be qualified with `static`. * The TECO_DECLARE_STATE() macro has been removed. It no longer abstracts anything and cannot be used to declare static teco_state_t anyway. Also TECO_DEFINE_UNDO_CALL() also doesn't have a DECLARE counterpart.
Diffstat (limited to 'debian/sciteco-gtk.install')
0 files changed, 0 insertions, 0 deletions