Eli Zaretskii writes: >> The hooks I'm referring to are ones that AFAIU don't make any sense on >> non-HAVE_WINDOW_SYSTEM, and their calls are (should be) already #ifdef'd >> out (with non-window-system frames never reaching the call). Including >> the #ifdefs in the declaration side would allow for Hydra to detect >> cases where an undefined hook is called, which would mean adding the >> appropriate #ifdef or an appropriate check around that call. > > Can you show the list of those hooks you want to #ifdef? Maybe I'm > misinterpreting your suggestion. I've included a diff at the end of my email. >> I'm a bit confused by your comment on testing. Didn't you say that it >> was okay that the code that was under HAVE_WINDOW_SYSTEM didn't test for >> existence of required HAVE_WINDOW_SYSTEM hooks? Those hooks are the ones >> I was thinking about wrapping into #ifdefs. > > Ah, I see the misunderstanding. Yes, it would be okay to #ifdef the > calls to those which are only available on window-systems, but then > why would we test the other kind of hooks for being non-NULL? The calls should already be #ifdef'd; it's the declarations that would be #ifdef'd. > I thought those which don't need to be tested are available on both > GUI and TTY frames. I believe there are (currently) three categories: (a) Hooks implemented by all backends, which don't need to be tested. (b) Hooks implemented by only GUI frames, but occurring in branches that non-GUI frames are used. These have to be tested. (c) Hooks implemented by only GUI frames, and occurring in branches that only GUI frames are used, and are in a preprocessor conditional. These don't have to be (and some currently aren't) tested. The #ifdefs I'm proposing (around declarations of (c) hooks) would allow Hydra and terminal-only users to catch code that assumes (c) when it should be (b). The alternatives would be to test all code in (c) anyway, or just hope that no one made an error by omitting any checks. P.S. I noticed that the only caller of buffer_flipping_unblocked_hook is unblock_buffer_flips in xdisp.c. Should this code be #ifdef'd out to only platforms that do this buffer flipping (HAVE_X_WINDOWS, I believe)? I'm not sure how much of a performance impact this code has on redisplay, but it introduces a record_unwind_protect in redisplay_preserve_echo_area.