[llvm-bugs] [Bug 48580] New: clang-format mistakenly recognize C file as Objective C and fails to format it

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 22 18:53:22 PST 2020


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

            Bug ID: 48580
           Summary: clang-format mistakenly recognize C file as Objective
                    C and fails to format it
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: anton.kochkov at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

If I try to run "clang-format -i minimized.h" fails with the following
".clang-format" it returns the following error:

Configuration file(s) do(es) not support Objective-C: /home/user/.clang-format

Here is the minimized.h: 

static insn_head_t c55x_list[] = {
  {    
      .insn = {
        .i_list = (insn_item_t []) {
              {
                  .syntax = INSN_SYNTAX(mack[r] Tx, K8, [ACx,] ACy),
              },
          },
      },  
  },      
  };   


As you can see there is nothing about Objective C in this file.

Here is .clang-format contents:

Language: Cpp
MaxEmptyLinesToKeep: 1
SpaceBeforeParens: ControlStatementsExceptForEachMacros
SpaceInEmptyParentheses: false
SpacesInContainerLiterals: true
BasedOnStyle: LLVM
ContinuationIndentWidth: 8
IndentCaseLabels: false
IndentFunctionDeclarationAfterType: false
IndentWidth: 8
UseTab: ForContinuationAndIndentation
ColumnLimit: 0
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
AllowShortIfStatementsOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false
AlignAfterOpenBracket: DontAlign
AlignEscapedNewlines: DontAlign
AlignConsecutiveMacros: true
AlignTrailingComments: false
AlignOperands: false
Cpp11BracedListStyle: false
ForEachMacros: ['r_list_foreach', 'ls_foreach', 'fcn_tree_foreach_intersect',
'r_skiplist_foreach', 'graph_foreach_anode']
SortIncludes: false


See the pull requests that tries to add `clang-format` support in our project
for more details if there is a need for any:
https://github.com/rizinorg/rizin/pull/159

-- 
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/20201223/f0fe8f4d/attachment.html>


More information about the llvm-bugs mailing list