I had the idea after seeing this pastebin from Andy.
With this PR the following code
will be replaced at compile time with
Each replacement generates a warning and the replacement is done only if the switch expression doesn't have side effects (no STORE_TEMP() nor STORE_PERM()) and if there's a default return.
Stats compiling iron-horse
NFO size: 20269741
NFO size: 18352185
So compilation is a lot slower, for a very small improvement.
Edit: and then I discovered -c nmlc option, with it GRF size is the same with both nmlc and grfcodec :)