all: clang-format-15.0.6

This commit is contained in:
Markus F.X.J. Oberhumer
2022-12-12 19:25:31 +01:00
parent 91aa5b55ab
commit d873a26f41
9 changed files with 68 additions and 52 deletions
+31 -17
View File
@@ -3,26 +3,40 @@
# for clang-format-15.0.6 from https://github.com/upx/upx-stubtools/releases # for clang-format-15.0.6 from https://github.com/upx/upx-stubtools/releases
--- ---
BasedOnStyle: LLVM BasedOnStyle: LLVM
AccessModifierOffset: -4
AlwaysBreakTemplateDeclarations: true
ColumnLimit: 100 ColumnLimit: 100
IndentWidth: 4 IndentWidth: 4
---
Language: Cpp
AccessModifierOffset: -4
AlwaysBreakTemplateDeclarations: true
AttributeMacros:
- __acc_cdecl
- __acc_cdecl_atexit
- __acc_cdecl_qsort
- __acc_cdecl_sighandler
- __acc_forceinline
- __acc_noinline
- __acc_static_noinline
- __acc_static_forceinline
EmptyLineBeforeAccessModifier: Leave
SortIncludes: false SortIncludes: false
SpaceAfterCStyleCast: true SpaceAfterCStyleCast: true
Standard: Cpp03 Standard: Cpp03
StatementMacros: [ StatementMacros:
ACCCHK_ASSERT, - ACCCHK_ASSERT
ACCCHK_ASSERT_IS_SIGNED_T, - ACCCHK_ASSERT_IS_SIGNED_T
ACCCHK_ASSERT_IS_UNSIGNED_T, - ACCCHK_ASSERT_IS_UNSIGNED_T
ACCCHK_ASSERT_SIGN_T, - ACCCHK_ASSERT_SIGN_T
ACC_BLOCK_BEGIN, - ACC_BLOCK_BEGIN
ACC_COMPILE_TIME_ASSERT, - ACC_COMPILE_TIME_ASSERT
ACC_COMPILE_TIME_ASSERT_HEADER, - ACC_COMPILE_TIME_ASSERT_HEADER
ACC_CXX_DISABLE_NEW_DELETE, - ACC_CXX_DISABLE_NEW_DELETE
ACC_CXX_TRIGGER_FUNCTION, - ACC_CXX_TRIGGER_FUNCTION
ACC_CXX_TRIGGER_FUNCTION_IMPL, - ACC_CXX_TRIGGER_FUNCTION_IMPL
CLANG_FORMAT_DUMMY_STATEMENT, - CLANG_FORMAT_DUMMY_STATEMENT
COMPILE_TIME_ASSERT, - COMPILE_TIME_ASSERT
COMPILE_TIME_ASSERT_ALIGNED1, - COMPILE_TIME_ASSERT_ALIGNED1
] WhitespaceSensitiveMacros:
- ACC_PP_MACRO_EXPAND
- ACC_PP_STRINGIZE
... ...
+15 -15
View File
@@ -198,8 +198,7 @@ void ElfLinker::preprocessSections(char *start, char const *end) {
char *n = strstr(start, name); char *n = strstr(start, name);
n[strlen(name)] = 0; n[strlen(name)] = 0;
addSection(n, input + offset, size, align); addSection(n, input + offset, size, align);
NO_printf("section %s preprocessed\n", n);
// printf("section %s preprocessed\n", n);
} }
} }
addSection("*ABS*", nullptr, 0, 0); addSection("*ABS*", nullptr, 0, 0);
@@ -224,13 +223,13 @@ void ElfLinker::preprocessSymbols(char *start, char const *end) {
assert(offset == 0); assert(offset == 0);
} }
#if 0 #if 0
else if (sscanf(start, "%x%*8c %1023s %*x %1023s", else if (sscanf(start, "%x%*8c %1023s %*x %1023s", &offset, section, symbol) == 3)
#else #else
// work around broken scanf() implementations // work around broken scanf() implementations
// http://bugs.winehq.org/show_bug.cgi?id=10401 (fixed in Wine 0.9.58) // http://bugs.winehq.org/show_bug.cgi?id=10401 (fixed in Wine 0.9.58)
else if (sscanf(start, "%x%*c%*c%*c%*c%*c%*c%*c%*c %1023s %*x %1023s", else if (sscanf(start, "%x%*c%*c%*c%*c%*c%*c%*c%*c %1023s %*x %1023s", &offset, section,
symbol) == 3)
#endif #endif
&offset, section, symbol) == 3)
{ {
char *s = strstr(start, symbol); char *s = strstr(start, symbol);
s[strlen(symbol)] = 0; s[strlen(symbol)] = 0;
@@ -290,8 +289,8 @@ void ElfLinker::preprocessRelocations(char *start, char const *end) {
if (section) { if (section) {
addRelocation(section->name, offset, t, symbol, add); addRelocation(section->name, offset, t, symbol, add);
// printf("relocation %s %s %x %llu preprocessed\n", section->name, symbol, offset, NO_printf("relocation %s %s %x %llu preprocessed\n", section->name, symbol, offset,
// (unsigned long long) add); (unsigned long long) add);
} }
} }
} }
@@ -317,7 +316,7 @@ ElfLinker::Symbol *ElfLinker::findSymbol(const char *name, bool fatal) const {
ElfLinker::Section *ElfLinker::addSection(const char *sname, const void *sdata, int slen, ElfLinker::Section *ElfLinker::addSection(const char *sname, const void *sdata, int slen,
unsigned p2align) { unsigned p2align) {
// printf("addSection: %s len=%d align=%d\n", sname, slen, p2align); NO_printf("addSection: %s len=%d align=%d\n", sname, slen, p2align);
if (!sdata && (!strcmp("ABS*", sname) || !strcmp("UND*", sname))) if (!sdata && (!strcmp("ABS*", sname) || !strcmp("UND*", sname)))
return nullptr; return nullptr;
if (update_capacity(nsections, &nsections_capacity)) if (update_capacity(nsections, &nsections_capacity))
@@ -335,7 +334,7 @@ ElfLinker::Section *ElfLinker::addSection(const char *sname, const void *sdata,
ElfLinker::Symbol *ElfLinker::addSymbol(const char *name, const char *section, ElfLinker::Symbol *ElfLinker::addSymbol(const char *name, const char *section,
upx_uint64_t offset) { upx_uint64_t offset) {
// printf("addSymbol: %s %s 0x%x\n", name, section, offset); NO_printf("addSymbol: %s %s 0x%llx\n", name, section, offset);
if (update_capacity(nsymbols, &nsymbols_capacity)) if (update_capacity(nsymbols, &nsymbols_capacity))
symbols = static_cast<Symbol **>(realloc(symbols, nsymbols_capacity * sizeof(Symbol *))); symbols = static_cast<Symbol **>(realloc(symbols, nsymbols_capacity * sizeof(Symbol *)));
assert(symbols != nullptr); assert(symbols != nullptr);
@@ -410,7 +409,7 @@ int ElfLinker::addLoader(const char *sname) {
} }
memcpy(output + outputlen, section->input, section->size); memcpy(output + outputlen, section->input, section->size);
section->output = output + outputlen; section->output = output + outputlen;
// printf("section added: 0x%04x %3d %s\n", outputlen, section->size, section->name); NO_printf("section added: 0x%04x %3d %s\n", outputlen, section->size, section->name);
outputlen += section->size; outputlen += section->size;
if (head) { if (head) {
@@ -479,11 +478,12 @@ void ElfLinker::relocate() {
value = rel->value->section->offset + rel->value->offset + rel->add; value = rel->value->section->offset + rel->value->offset + rel->add;
} }
upx_byte *location = rel->section->output + rel->offset; upx_byte *location = rel->section->output + rel->offset;
// printf("%-28s %-28s %-10s %#16llx %#16llx\n", rel->section->name, rel->value->name, NO_printf("%-28s %-28s %-10s %#16llx %#16llx\n", rel->section->name, rel->value->name,
// rel->type, (long long) value, (long long) value - rel->section->offset - rel->offset); rel->type, (long long) value,
// printf(" %llx %d %llx %d %llx : %d\n", (long long) value, (long long) value - rel->section->offset - rel->offset);
// (int)rel->value->section->offset, NO_printf(" %llx %d %llx %d %llx :%d\n", (long long) value,
// rel->value->offset, rel->offset, (long long) rel->add, *location); (int) rel->value->section->offset, rel->value->offset, rel->offset,
(long long) rel->add, *location);
relocate1(rel, location, value, rel->type); relocate1(rel, location, value, rel->type);
} }
} }
+3 -1
View File
@@ -81,7 +81,9 @@ struct screen_data_t {
}; };
/* atExit information */ /* atExit information */
static struct { int cursor_shape; } ae = {-1}; static struct {
int cursor_shape;
} ae = {-1};
#if USE_SCROLLBACK #if USE_SCROLLBACK
static __inline__ void sb_add(screen_t *this, int *val, int inc) { static __inline__ void sb_add(screen_t *this, int *val, int inc) {