Small clangd fixes

This commit is contained in:
Luke Street 2024-10-25 21:02:55 -06:00
parent 6be96bb361
commit c41440e3fb
3 changed files with 55 additions and 48 deletions

View File

@ -1,17 +1,23 @@
#ifndef __PPC_EABI_LINKER #ifndef __PPC_EABI_LINKER
#define __PPC_EABI_LINKER #define __PPC_EABI_LINKER
__declspec(section ".init") extern char _stack_addr[]; #ifdef __MWERKS__
__declspec(section ".init") extern char _stack_end[]; #define DECL_SECTION(name) __declspec(section name)
__declspec(section ".init") extern char _heap_addr[]; #else
__declspec(section ".init") extern char _heap_end[]; #define DECL_SECTION(name)
__declspec(section ".init") extern const char _fextabindex_rom[]; #endif
__declspec(section ".init") extern char _fextabindex[];
__declspec(section ".init") extern char _eextabindex[];
__declspec(section ".init") extern char _SDA_BASE_[]; DECL_SECTION(".init") extern char _stack_addr[];
DECL_SECTION(".init") extern char _stack_end[];
DECL_SECTION(".init") extern char _heap_addr[];
DECL_SECTION(".init") extern char _heap_end[];
DECL_SECTION(".init") extern const char _fextabindex_rom[];
DECL_SECTION(".init") extern char _fextabindex[];
DECL_SECTION(".init") extern char _eextabindex[];
__declspec(section ".init") extern char _SDA2_BASE_[]; DECL_SECTION(".init") extern char _SDA_BASE_[];
DECL_SECTION(".init") extern char _SDA2_BASE_[];
typedef struct __rom_copy_info { typedef struct __rom_copy_info {
char* rom; char* rom;
@ -19,14 +25,14 @@ typedef struct __rom_copy_info {
unsigned int size; unsigned int size;
} __rom_copy_info; } __rom_copy_info;
__declspec(section ".init") extern __rom_copy_info _rom_copy_info[]; DECL_SECTION(".init") extern __rom_copy_info _rom_copy_info[];
typedef struct __bss_init_info { typedef struct __bss_init_info {
char* addr; char* addr;
unsigned int size; unsigned int size;
} __bss_init_info; } __bss_init_info;
__declspec(section ".init") extern __bss_init_info _bss_init_info[]; DECL_SECTION(".init") extern __bss_init_info _bss_init_info[];
typedef struct __eti_init_info { typedef struct __eti_init_info {
void* eti_start; void* eti_start;
@ -35,39 +41,39 @@ typedef struct __eti_init_info {
unsigned long code_size; unsigned long code_size;
} __eti_init_info; } __eti_init_info;
__declspec(section ".init") extern __eti_init_info _eti_init_info[]; DECL_SECTION(".init") extern __eti_init_info _eti_init_info[];
__declspec(section ".init") extern const char _f_init_rom[]; DECL_SECTION(".init") extern const char _f_init_rom[];
__declspec(section ".init") extern char _f_init[]; DECL_SECTION(".init") extern char _f_init[];
__declspec(section ".init") extern char _e_init[]; DECL_SECTION(".init") extern char _e_init[];
__declspec(section ".init") extern const char _f_text_rom[]; DECL_SECTION(".init") extern const char _f_text_rom[];
__declspec(section ".init") extern char _f_text[]; DECL_SECTION(".init") extern char _f_text[];
__declspec(section ".init") extern char _e_text[]; DECL_SECTION(".init") extern char _e_text[];
__declspec(section ".init") extern const char _f_rodata_rom[]; DECL_SECTION(".init") extern const char _f_rodata_rom[];
__declspec(section ".init") extern char _f_rodata[]; DECL_SECTION(".init") extern char _f_rodata[];
__declspec(section ".init") extern char _e_rodata[]; DECL_SECTION(".init") extern char _e_rodata[];
__declspec(section ".init") extern const char _fextab_rom[]; DECL_SECTION(".init") extern const char _fextab_rom[];
__declspec(section ".init") extern char _fextab[]; DECL_SECTION(".init") extern char _fextab[];
__declspec(section ".init") extern char _eextab[]; DECL_SECTION(".init") extern char _eextab[];
__declspec(section ".init") extern const char _f_data_rom[]; DECL_SECTION(".init") extern const char _f_data_rom[];
__declspec(section ".init") extern char _f_data[]; DECL_SECTION(".init") extern char _f_data[];
__declspec(section ".init") extern char _e_data[]; DECL_SECTION(".init") extern char _e_data[];
__declspec(section ".init") extern char _f_bss[]; DECL_SECTION(".init") extern char _f_bss[];
__declspec(section ".init") extern char _e_bss[]; DECL_SECTION(".init") extern char _e_bss[];
__declspec(section ".init") extern const char _f_sdata_rom[]; DECL_SECTION(".init") extern const char _f_sdata_rom[];
__declspec(section ".init") extern char _f_sdata[]; DECL_SECTION(".init") extern char _f_sdata[];
__declspec(section ".init") extern char _e_sdata[]; DECL_SECTION(".init") extern char _e_sdata[];
__declspec(section ".init") extern char _f_sbss[]; DECL_SECTION(".init") extern char _f_sbss[];
__declspec(section ".init") extern char _e_sbss[]; DECL_SECTION(".init") extern char _e_sbss[];
__declspec(section ".init") extern const char _f_sdata2_rom[]; DECL_SECTION(".init") extern const char _f_sdata2_rom[];
__declspec(section ".init") extern char _f_sdata2[]; DECL_SECTION(".init") extern char _f_sdata2[];
__declspec(section ".init") extern char _e_sdata2[]; DECL_SECTION(".init") extern char _e_sdata2[];
__declspec(section ".init") extern char _f_sbss2[]; DECL_SECTION(".init") extern char _f_sbss2[];
__declspec(section ".init") extern char _e_sbss2[]; DECL_SECTION(".init") extern char _e_sbss2[];
__declspec(section ".init") extern const char _f_PPC_EMB_sdata0_rom[]; DECL_SECTION(".init") extern const char _f_PPC_EMB_sdata0_rom[];
__declspec(section ".init") extern char _f_PPC_EMB_sdata0[]; DECL_SECTION(".init") extern char _f_PPC_EMB_sdata0[];
__declspec(section ".init") extern char _e_PPC_EMB_sdata0[]; DECL_SECTION(".init") extern char _e_PPC_EMB_sdata0[];
__declspec(section ".init") extern char _f_PPC_EMB_sbss0[]; DECL_SECTION(".init") extern char _f_PPC_EMB_sbss0[];
__declspec(section ".init") extern char _e_PPC_EMB_sbss0[]; DECL_SECTION(".init") extern char _e_PPC_EMB_sbss0[];
#endif // __PPC_EABI_LINKER #endif // __PPC_EABI_LINKER

View File

@ -23,11 +23,12 @@ typedef unsigned long size_t;
#define offsetof(type, member) ((size_t) & (((type*)0)->member)) #define offsetof(type, member) ((size_t) & (((type*)0)->member))
#endif #endif
#define CHECK_SIZEOF(cls, size) extern int cls##_check[check_sizeof< cls, size >::value]; #define CHECK_SIZEOF(cls, size) extern int cls##_check[check_sizeof< cls, size >::value];
#define NESTED_CHECK_SIZEOF(parent, cls, size) extern int cls##_check[check_sizeof< parent::cls, size >::value]; #define NESTED_CHECK_SIZEOF(parent, cls, size) \
extern int cls##_check[check_sizeof< parent::cls, size >::value];
#define CHECK_OFFSETOF(cls, member, offset) \ #define CHECK_OFFSETOF(cls, member, offset) \
extern int cls##_check_offset##[_n_is_equal< offsetof(cls, member), offset >::value]; extern int cls##_check_offset##[_n_is_equal< offsetof(cls, member), offset >::value];
#elif defined(__clang__) && defined(__powerpc__) // Enable for clangd #elif defined(__clang__) && defined(__powerpc__) // Enable for clangd
#pragma clang diagnostic ignored "-Wc11-extensions" // Allow _Static_assert #pragma clang diagnostic ignored "-Wc11-extensions" // Allow _Static_assert
#pragma clang diagnostic ignored "-Wc++17-extensions" // Allow _Static_assert without message #pragma clang diagnostic ignored "-Wc++17-extensions" // Allow _Static_assert without message
#define CHECK_SIZEOF(cls, size) _Static_assert(sizeof(cls) == size); #define CHECK_SIZEOF(cls, size) _Static_assert(sizeof(cls) == size);
#define NESTED_CHECK_SIZEOF(parent, cls, size) _Static_assert(sizeof(parent::cls) == size); #define NESTED_CHECK_SIZEOF(parent, cls, size) _Static_assert(sizeof(parent::cls) == size);

View File

@ -24,7 +24,7 @@ include_dirs = [
os.path.join(root_dir, "extern/musyx/include") os.path.join(root_dir, "extern/musyx/include")
] ]
include_pattern = re.compile(r'^#\s*include\s*[<"](.+?)[>"]$') include_pattern = re.compile(r'^#\s*include\s*[<"](.+?)[>"]')
guard_pattern = re.compile(r"^#\s*ifndef\s+(.*)$") guard_pattern = re.compile(r"^#\s*ifndef\s+(.*)$")
defines = set() defines = set()