mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 05:09:43 +00:00
Some clang-format improvements ##indent
* Fix for clang-format parsing error * Align consecutive macros for clang-format * Dont align escaped newlines * Use spaces for some alignment * Add clang-format script
This commit is contained in:
parent
e55d7c033b
commit
ef462a4800
@ -8,7 +8,7 @@ ContinuationIndentWidth: 8
|
|||||||
IndentCaseLabels: false
|
IndentCaseLabels: false
|
||||||
IndentFunctionDeclarationAfterType: false
|
IndentFunctionDeclarationAfterType: false
|
||||||
IndentWidth: 8
|
IndentWidth: 8
|
||||||
UseTab: Always
|
UseTab: ForContinuationAndIndentation
|
||||||
ColumnLimit: 0
|
ColumnLimit: 0
|
||||||
BreakBeforeBraces: Attach
|
BreakBeforeBraces: Attach
|
||||||
BreakBeforeTernaryOperators: true
|
BreakBeforeTernaryOperators: true
|
||||||
@ -17,8 +17,10 @@ AllowShortCaseLabelsOnASingleLine: true
|
|||||||
AllowShortFunctionsOnASingleLine: Inline
|
AllowShortFunctionsOnASingleLine: Inline
|
||||||
AllowShortLoopsOnASingleLine: false
|
AllowShortLoopsOnASingleLine: false
|
||||||
AlignAfterOpenBracket: DontAlign
|
AlignAfterOpenBracket: DontAlign
|
||||||
|
AlignEscapedNewlines: DontAlign
|
||||||
|
AlignConsecutiveMacros: true
|
||||||
AlignTrailingComments: false
|
AlignTrailingComments: false
|
||||||
AlignOperands: false
|
AlignOperands: false
|
||||||
Cpp11BracedListStyle: false
|
Cpp11BracedListStyle: false
|
||||||
ForEachMacros: ['r_list_foreach', 'ls_foreach', 'fcn_tree_foreach_intersect', 'r_skiplist_foreach', 'graph_foreach_anode']
|
ForEachMacros: ['r_list_foreach', 'ls_foreach', 'fcn_tree_foreach_intersect', 'r_skiplist_foreach', 'graph_foreach_anode', 'r_list_foreach_safe', 'r_pvector_foreach', 'r_rbtree_foreach', 'r_interval_ tree_foreach']
|
||||||
SortIncludes: false
|
SortIncludes: false
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
static insn_head_t c55x_list[] = {
|
||||||
{
|
{
|
||||||
.byte = 0x00,
|
.byte = 0x00,
|
||||||
.size = 0x03,
|
.size = 0x03,
|
||||||
@ -3970,3 +3971,4 @@
|
|||||||
.syntax = NULL,
|
.syntax = NULL,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
};
|
||||||
|
@ -1137,9 +1137,8 @@ int tms320_dasm(tms320_dasm_t * dasm, const ut8 * stream, int len)
|
|||||||
return full_insn_size(dasm);
|
return full_insn_size(dasm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static insn_head_t c55x_list[] = {
|
// insn_head_t c55x_list[]
|
||||||
# include "c55x/table.h"
|
#include "c55x/table.h"
|
||||||
};
|
|
||||||
|
|
||||||
int tms320_dasm_init(tms320_dasm_t * dasm) {
|
int tms320_dasm_init(tms320_dasm_t * dasm) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
60
sys/clang-format.py
Executable file
60
sys/clang-format.py
Executable file
@ -0,0 +1,60 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import glob
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
dirlist = [
|
||||||
|
"binrz",
|
||||||
|
"librz",
|
||||||
|
"shlr/ar",
|
||||||
|
"shlr/bochs",
|
||||||
|
"shlr/gdb",
|
||||||
|
"shlr/java",
|
||||||
|
"shlr/ptrace-wrap",
|
||||||
|
"shlr/qnx",
|
||||||
|
"shlr/rar",
|
||||||
|
"shlr/tcc",
|
||||||
|
"shlr/w32dbg_wrap",
|
||||||
|
"shlr/winkd",
|
||||||
|
"test/unit",
|
||||||
|
]
|
||||||
|
|
||||||
|
skiplist = [
|
||||||
|
"/gnu/",
|
||||||
|
"librz/asm/arch/vax/",
|
||||||
|
"librz/asm/arch/riscv/",
|
||||||
|
"librz/asm/arch/sh/gnu/",
|
||||||
|
"librz/asm/arch/i8080/",
|
||||||
|
"librz/asm/arch/z80/",
|
||||||
|
"librz/asm/arch/avr/",
|
||||||
|
"librz/asm/arch/arm/aarch64/",
|
||||||
|
"librz/hash/xxhash/",
|
||||||
|
"librz/bin/mangling/cxx/",
|
||||||
|
"librz/util/bdiff.c",
|
||||||
|
]
|
||||||
|
|
||||||
|
pattern = ["*.c", "*.cpp", "*.h", "*.hpp", "*.inc"]
|
||||||
|
|
||||||
|
|
||||||
|
def skip(filename):
|
||||||
|
for s in skiplist:
|
||||||
|
if s in filename:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
for d in dirlist:
|
||||||
|
print("Processing directory: {0}".format(d))
|
||||||
|
for pat in pattern:
|
||||||
|
print("Processing pattern: {0}".format(pat))
|
||||||
|
for filename in glob.iglob(d + "/**/" + pat, recursive=True):
|
||||||
|
if not skip(filename):
|
||||||
|
CMD = "clang-format -style=file -i {0}".format(filename)
|
||||||
|
print(CMD)
|
||||||
|
os.system(CMD)
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("clang-format.py interrupted by the user.")
|
||||||
|
sys.exit(1)
|
Loading…
Reference in New Issue
Block a user