aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/preprocessor/dynamic.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-03-12 08:07:05 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-03-16 00:48:45 +0100
commit0558317d0c7a2e20a6d82b7ef35357ec02e2ad38 (patch)
tree2eb0f950e593e0a816861a6289bc81807ec29052 /validation/preprocessor/dynamic.c
parent6e5fbe9870a8a593230a16cafc2de69aa2b91f78 (diff)
downloadsparse-dev-0558317d0c7a2e20a6d82b7ef35357ec02e2ad38.tar.gz
cpp: fix redefinition of a macro during its own expansion
The presence of preprocessor directives within the arguments of a macro invocation is Undefined Behaviour but most of these directives, like the conditionals, are well-defined and harmless. OTOH, the redefinition of a macro during its own expansion makes much less sense. However, it can be given a reasonable meaning: * use the initial definition for the macro body * use the new defintion for its arguments, in text order. It's what gcc & clang do but Sparse can't handle this because, during the expansion, a reference to the initial macro's body is not kept. What is used instead is what is currently associated with the macro. Fix this by using the body associated with the macro at the time of its invocation. Testcase-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/preprocessor/dynamic.c')
0 files changed, 0 insertions, 0 deletions