Menu

#90 Incorrect of #define if deep under uncertain #if

v6.0.1
open
nobody
None
5
2016-10-24
2016-10-24
No

$ coan --version

coan, version 6.0.1 for 64 bit Unix/Linux(built Sep 15 2014,18:49:36)

Symbol gets defined through #define if the inner most #if is true, even though the

Example to reproduce the bug

$ cat bug2.c

#ifdef THIS_MAY_NOT_BE_DEFINED   // unknown
    #ifdef A                       // true - A is defined
        #define B                    // BUG! B gets defined, but should NOT,
                                                                  // because outer if is uncertain!
    #endif
#endif

#ifdef B        // this #ifdef line is incorrectly stripped
                                // because B got defined at line 3
    this line MUST remain enclosed inside #ifdef!
#endif

$ coan source -DA bug2.c

#ifdef THIS_MAY_NOT_BE_DEFINED    // unknown
    #define B                 // BUG! B gets defined, but should NOT,
                              // because outer if is uncertain!
#endif

this line MUST remain enclosed inside #ifdef!
1 Attachments

Discussion


Log in to post a comment.

MongoDB Logo MongoDB