[llvm-bugs] [Bug 40116] New: complex #define formatting

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 20 06:31:52 PST 2018


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

            Bug ID: 40116
           Summary: complex #define formatting
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Keywords: code-cleanup, code-quality
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: marcin.sus at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

This is part of CryEngine base code (very ugly). They have macro based approach
to generate enum with some helpers functions to return enum as string.
Sometimes is necessary (makes life easier) to register, access some vars in lua
and code.

// start

#define EList(f) \
  f(e_A)  \
  f(e_B)  \
  f(e_C)  \
  f(e_D)  \
  f(e_E)  \

// another macro generates enum using definition above
AUTOENUM_BUILDENUMWITHTYPE_WITHNUM(EEnumName, EList, e_Last);

// end


Clang is not able to format it correctly. Result is:

#define EList(f)       \
        f(e_A)             \
            f(e_B)         \
                f(e_C)     \
                    f(e_D) \
                        f(e_E)

Is there any hope to force clang-format to format those blocks correctly (or
skip it)?

Thanks

-- 
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/20181220/0d49e698/attachment.html>


More information about the llvm-bugs mailing list