wmaker: work around compilers that do not support nested functions
commit10371836ed5637c2faf718873b5866c7a8314134
authorChristophe CURIS <christophe.curis@free.fr>
Fri, 5 Dec 2014 17:02:40 +0000 (5 18:02 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Sun, 7 Dec 2014 09:52:21 +0000 (7 09:52 +0000)
tree81087b82e3a2c652959d999b25230e54d32d34c4
parenta24efec61f020b7a693f14d45d09fa331aee62e7
wmaker: work around compilers that do not support nested functions

There are a few cases in which nested functions are an helpful way to write
code, as this is explained in 'script/nested-func-to-macro.sh'. However,
some compiler do not support them (like clang), so this patch proposes an
elegant solution, where developers can get the benefit of them, but for
users they are automatically converted to C macro if needed.

The advantage of this solution is that we keep the code simple, there is no
hack in the source (like #ifdef and code duplication), yet still having the
full advantages.

The translation is done according to what have been detected by configure
(see the WM_PROG_CC_NESTEDFUNC macro) so that user has nothing to do.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Makefile.am
configure.ac
m4/wm_prog_cc_c11.m4
script/nested-func-to-macro.sh [new file with mode: 0755]
src/Makefile.am
src/misc.c