I find this technique to be one of applications of X Macro pattern[1]. It's a very effective way to get around the rigidness of C language, but the price is sometimes you have to look at pre-processed source code to make sense of it. For gcc, this can be generated using -E flag.
[1] https://en.m.wikipedia.org/wiki/X_Macro