1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

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

View File

@ -3,26 +3,40 @@
# for clang-format-15.0.6 from https://github.com/upx/upx-stubtools/releases
---
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlwaysBreakTemplateDeclarations: true
ColumnLimit: 100
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
SpaceAfterCStyleCast: true
Standard: Cpp03
StatementMacros: [
ACCCHK_ASSERT,
ACCCHK_ASSERT_IS_SIGNED_T,
ACCCHK_ASSERT_IS_UNSIGNED_T,
ACCCHK_ASSERT_SIGN_T,
ACC_BLOCK_BEGIN,
ACC_COMPILE_TIME_ASSERT,
ACC_COMPILE_TIME_ASSERT_HEADER,
ACC_CXX_DISABLE_NEW_DELETE,
ACC_CXX_TRIGGER_FUNCTION,
ACC_CXX_TRIGGER_FUNCTION_IMPL,
CLANG_FORMAT_DUMMY_STATEMENT,
COMPILE_TIME_ASSERT,
COMPILE_TIME_ASSERT_ALIGNED1,
]
StatementMacros:
- ACCCHK_ASSERT
- ACCCHK_ASSERT_IS_SIGNED_T
- ACCCHK_ASSERT_IS_UNSIGNED_T
- ACCCHK_ASSERT_SIGN_T
- ACC_BLOCK_BEGIN
- ACC_COMPILE_TIME_ASSERT
- ACC_COMPILE_TIME_ASSERT_HEADER
- ACC_CXX_DISABLE_NEW_DELETE
- ACC_CXX_TRIGGER_FUNCTION
- ACC_CXX_TRIGGER_FUNCTION_IMPL
- CLANG_FORMAT_DUMMY_STATEMENT
- COMPILE_TIME_ASSERT
- COMPILE_TIME_ASSERT_ALIGNED1
WhitespaceSensitiveMacros:
- ACC_PP_MACRO_EXPAND
- ACC_PP_STRINGIZE
...

View File

@ -198,8 +198,7 @@ void ElfLinker::preprocessSections(char *start, char const *end) {
char *n = strstr(start, name);
n[strlen(name)] = 0;
addSection(n, input + offset, size, align);
// printf("section %s preprocessed\n", n);
NO_printf("section %s preprocessed\n", n);
}
}
addSection("*ABS*", nullptr, 0, 0);
@ -224,13 +223,13 @@ void ElfLinker::preprocessSymbols(char *start, char const *end) {
assert(offset == 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
// work around broken scanf() implementations
// 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
&offset, section, symbol) == 3)
{
char *s = strstr(start, symbol);
s[strlen(symbol)] = 0;
@ -290,8 +289,8 @@ void ElfLinker::preprocessRelocations(char *start, char const *end) {
if (section) {
addRelocation(section->name, offset, t, symbol, add);
// printf("relocation %s %s %x %llu preprocessed\n", section->name, symbol, offset,
// (unsigned long long) add);
NO_printf("relocation %s %s %x %llu preprocessed\n", section->name, symbol, offset,
(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,
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)))
return nullptr;
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,
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))
symbols = static_cast<Symbol **>(realloc(symbols, nsymbols_capacity * sizeof(Symbol *)));
assert(symbols != nullptr);
@ -410,7 +409,7 @@ int ElfLinker::addLoader(const char *sname) {
}
memcpy(output + outputlen, section->input, section->size);
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;
if (head) {
@ -479,11 +478,12 @@ void ElfLinker::relocate() {
value = rel->value->section->offset + rel->value->offset + rel->add;
}
upx_byte *location = rel->section->output + rel->offset;
// 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);
// printf(" %llx %d %llx %d %llx : %d\n", (long long) value,
// (int)rel->value->section->offset,
// rel->value->offset, rel->offset, (long long) rel->add, *location);
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);
NO_printf(" %llx %d %llx %d %llx :%d\n", (long long) value,
(int) rel->value->section->offset, rel->value->offset, rel->offset,
(long long) rel->add, *location);
relocate1(rel, location, value, rel->type);
}
}

View File

@ -81,7 +81,9 @@ struct screen_data_t {
};
/* atExit information */
static struct { int cursor_shape; } ae = {-1};
static struct {
int cursor_shape;
} ae = {-1};
#if USE_SCROLLBACK
static __inline__ void sb_add(screen_t *this, int *val, int inc) {