Added minimal example for VF bug involving testing for macro defines in headers.

This commit is contained in:
Tobias Reinhard 2022-10-13 09:16:54 -04:00
parent 8ef03612b5
commit c71025fda0
4 changed files with 49 additions and 0 deletions

View file

@ -0,0 +1,17 @@
// Problem: Both branches branch conditions evaluate to true.
/* `main.c` included this header after including `defining_header.h`.
* Hence, `#ifdef ABC` should evaluate to true and `#ifndef ABC should
* evaluate to false.
*/
/*
#ifdef ABC // ok: evaluates to true.
#error "ABC defined"
#endif
*/
#ifndef ABC // bug: evaluates to true
#error "ABC defined"
#endif