[llvm-bugs] [Bug 37200] New: clang-format mangles a macro function named "and"

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 22 13:14:49 PDT 2018


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

            Bug ID: 37200
           Summary: clang-format mangles a macro function named "and"
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: solo-llvm at goeswhere.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

The macro:

#define and(x,y) 5

..gets rewritten to:

#define and (x, y) 5

..which causes this:

and(2, 3)

..to expand to:

(x, y) 5(2, 3)

..which is not what I was after, really.

This horribly breaks this project's sha512.c. Luckily the new code triggers
-Werror=comma-operator-used-at-all-ever, so this isn't introducing a horrible
bug.

It appears to be related to the token "and" being a keyword in something?

Tested with `clang-format-4.0` and `clang-format-6.0` on Ubuntu 18.04; default
settings.

-- 
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/20180422/f85e37ee/attachment.html>


More information about the llvm-bugs mailing list