diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2014-06-12 17:54:48 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2014-06-16 15:22:46 +0200 |
commit | d442e2ec6e896c312bc616be7607332d978a45c9 (patch) | |
tree | 59834ed3d5d96f9be1bc5314a05a7821cf145de5 /units/user | |
parent | 2e78fa79bbaebb358d2657c397180d2d08d69b12 (diff) |
macro: add DISABLE_WARNING_SHADOW
As it turns out, we cannot use _Pragma in compound-statements. Therefore,
constructs like MIN(MAX(a, b), x) will warn due to shadowed variable
declarations. The DISABLE_WARNING_SHADOW macro can be used to suppress
these.
Note that using UNIQUE(_var) does not work either as GCC uses the last
line of a macro-expansion for __LINE__, therefore, still causing both
macros to have the same variables. We could use different variable-names
for MIN and MAX, but that just hides the problem and still fails for
MIN(something(MIN(a, b)), c).
The only working solution is to use __COUNTER__ and pass it pre-evaluated
as extra argument to a macro to use as name-prefix. This, however, makes
all these macros much more complicated so I'll go with manual
DISABLE_WARNING_SHADOW so far.
Diffstat (limited to 'units/user')
0 files changed, 0 insertions, 0 deletions