Use clang-format-18 for source formatting (#256)

* Updating clang-format to v18

- Updates the pre-commit-config
- Formats source files according to the utility

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Update format source workflow

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Update CONTRIBUTING

* Update comment in .clang-format

* Update CONTRIBUTING.md

* Update helper script

---------

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

[ROCm/rocprofiler-systems commit: 1e13b590e7]
This commit is contained in:
David Galiffi
2025-06-22 08:48:08 -04:00
committed by GitHub
parent 6a8cef771e
commit 0403aaa97f
76 changed files with 258 additions and 255 deletions
@@ -273,7 +273,7 @@ DYNINST_instForkEntry()
DLLEXPORT void
DYNINST_instForkExit(void* arg1)
{
//#warning "This function is not implemented for AARCH64 yet!"
// #warning "This function is not implemented for AARCH64 yet!"
#if !defined(arch_aarch64)
tc_lock_lock(&DYNINST_trace_lock);
@@ -306,7 +306,7 @@ DYNINST_instForkExit(void* arg1)
DLLEXPORT void
DYNINST_instExecEntry(void* arg1)
{
//#warning "This function is not implemented for AARCH64 yet!"
// #warning "This function is not implemented for AARCH64 yet!"
#if !defined(arch_aarch64)
tc_lock_lock(&DYNINST_trace_lock);
@@ -446,7 +446,7 @@ cacheLookup(void* calculation)
* bit 1: true if interpAsTarget
* bit 2: true if interpAsReturnAddr
**/
//#define STACKDUMP
// #define STACKDUMP
void
DYNINST_stopThread(void* pointAddr, void* callBackID, void* flags, void* calculation)
{
@@ -61,7 +61,7 @@ map_region(void* addr, int len, int fd)
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, lastError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)(lpMessage), 0, NULL);
(LPTSTR) (lpMessage), 0, NULL);
fprintf(stderr, "VirtualAlloc failed in RTlib: %s\n", lpMessage);
LocalFree((LPVOID) lpMessage);
}
@@ -377,8 +377,8 @@ DYNINST_am_initial_thread(dyntid_t tid)
# define UC_PC(x) x->uc_mcontext.uc_regs->gregs[32]
# endif // power
# elif defined(arch_aarch64)
//#warning "UC_PC: in aarch64, pc is not directly accessable."
// aarch64 pc is not one of 31 GPRs, but an independent reg
// #warning "UC_PC: in aarch64, pc is not directly accessable."
// aarch64 pc is not one of 31 GPRs, but an independent reg
# define UC_PC(x) x->uc_mcontext.pc
# endif // UC_PC
@@ -55,7 +55,7 @@ struct MemoryMapper RTmemoryMapper = { 0, 0, 0, 0, { { 0 } } };
#endif
extern FILE* stOut;
//#define DEBUG_MEM_EM
// #define DEBUG_MEM_EM
unsigned long
RTtranslateMemory(unsigned long input, unsigned long origAddr, unsigned long currAddr)
@@ -28,7 +28,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
//#warning "This file is not implemented yet!"
// #warning "This file is not implemented yet!"
#if defined(DYNINST_RT_STATIC_LIB)
@@ -37,19 +37,19 @@
void (*DYNINSTctors_addr)(void);
void (*DYNINSTdtors_addr)(void);
//#if defined(MUTATEE64)
// static const unsigned long long CTOR_LIST_TERM = 0x0000000000000000ULL;
// static const unsigned long long CTOR_LIST_START = 0xffffffffffffffffULL;
// static const unsigned long long DTOR_LIST_TERM = 0x0000000000000000ULL;
// static const unsigned long long DTOR_LIST_START = 0xffffffffffffffffULL;
//#else
// #if defined(MUTATEE64)
// static const unsigned long long CTOR_LIST_TERM = 0x0000000000000000ULL;
// static const unsigned long long CTOR_LIST_START = 0xffffffffffffffffULL;
// static const unsigned long long DTOR_LIST_TERM = 0x0000000000000000ULL;
// static const unsigned long long DTOR_LIST_START = 0xffffffffffffffffULL;
// #else
/*
static const unsigned CTOR_LIST_TERM = 0x00000000;
static const unsigned CTOR_LIST_START = 0xffffffff;
static const unsigned DTOR_LIST_TERM = 0x00000000;
static const unsigned DTOR_LIST_START = 0xffffffff;
*/
//#endif
// #endif
extern void
DYNINSTBaseInit();
@@ -68,14 +68,14 @@ DYNINSTBaseInit();
void
DYNINSTglobal_ctors_handler()
{
//#warning "This function is not implemented yet!"
// #warning "This function is not implemented yet!"
assert(0);
}
void
DYNINSTglobal_dtors_handler()
{
//#warning "This function is not implemented yet!"
// #warning "This function is not implemented yet!"
assert(0);
}
@@ -119,7 +119,7 @@ DYNINSTglobal_irel_handler()
long (*ptr)(void) = 0;
long result = 0;
if(rel->info != 0x2a) continue;
ptr = (funcptr)(*rel->offset);
ptr = (funcptr) (*rel->offset);
result = ptr();
*(rel->offset) = result;
}
@@ -45,7 +45,7 @@ extern int DYNINST_multithread_capable;
typedef dyninst_lock_t tc_lock_t;
#define DECLARE_TC_LOCK(l) tc_lock_t l = { 0, (dyntid_t) -1 }
#define DECLARE_TC_LOCK(l) tc_lock_t l = { 0, (dyntid_t) - 1 }
int
tc_lock_init(tc_lock_t*);
@@ -363,10 +363,10 @@ getStaticTrapMap(unsigned long addr, unsigned long* allocBase)
// see if the last section has been tagged with "DYNINST_REWRITE"
numSections = peHdr->FileHeader.NumberOfSections;
curSecn = *(PIMAGE_SECTION_HEADER)(((unsigned char*) peHdr) + sizeof(DWORD) +
sizeof(IMAGE_FILE_HEADER) +
peHdr->FileHeader.SizeOfOptionalHeader +
sizeof(IMAGE_SECTION_HEADER) * (numSections - 1));
curSecn = *(PIMAGE_SECTION_HEADER) (((unsigned char*) peHdr) + sizeof(DWORD) +
sizeof(IMAGE_FILE_HEADER) +
peHdr->FileHeader.SizeOfOptionalHeader +
sizeof(IMAGE_SECTION_HEADER) * (numSections - 1));
// fprintf(stderr, "RTLIB: PE section header address = %lx\n", curSecn);
// fprintf(stderr, "curSecn.chars = %lx %s[%d]\n",curSecn.Characteristics,