[llvm-bugs] [Bug 39255] New: Clang-Format ignores disabled conditional preprocessor blocks

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 11 08:29:44 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39255

            Bug ID: 39255
           Summary: Clang-Format ignores disabled conditional preprocessor
                    blocks
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Bumblebritches57 at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

preprocessor blocks aren't formatted properly at all.

Example:

Before:

#if (defined(__UNIX__))
#define _FILE_OFFSET_BITS 64
#elif (defined _WIN32)
#define _UNICODE
#endif

After:
#if   (defined(__UNIX__))
# define _FILE_OFFSET_BITS 64
#elif (defined _WIN32)
#define _UNICODE
#endif

and let's say we're compiling on a UNIX platform, so the first branch of the
preprocessor directive is enabled, but not the second.

Only the enabled block would actually be formatted, the disabled block is
completely ignored.

I'm not sure if this is just because the formatter is running after the
preprocessor, or if it's a lot deeper than that, and Clang is removing the
unavailable preprocessor tokens before anyone else has access to it?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181011/4ce0d633/attachment-0001.html>


More information about the llvm-bugs mailing list