chore: move __attribute__ to modern [[attribute]]
This commit is contained in:
		
							parent
							
								
									3811f1b867
								
							
						
					
					
						commit
						2b3a27a398
					
				
					 15 changed files with 31 additions and 30 deletions
				
			
		|  | @ -17,7 +17,7 @@ void kmain(void); | |||
| static uint8_t early_heap[kib$(32)]; | ||||
| static DTBNode* dtb_root = NULL; | ||||
| 
 | ||||
| void rv32_start(__attribute__((unused)) size_t hartid, uintptr_t dtb) { | ||||
| void rv32_start([[gnu::unused]] size_t hartid, uintptr_t dtb) { | ||||
|     write_csr$(stvec, (uint32_t)interrupt_kernel); | ||||
| 
 | ||||
|     BumpAllocator alloc = bump_allocator_create((void*)early_heap, sizeof(early_heap)); | ||||
|  |  | |||
|  | @ -1,10 +1,10 @@ | |||
| #include <hal> | ||||
| #include <handover> | ||||
| #include <helpers/mem.h> | ||||
| #include <logger> | ||||
| #include <pmm> | ||||
| #include <string.h> | ||||
| 
 | ||||
| #include "base/mod.h" | ||||
| #include "paging.h" | ||||
| #include "regs.h" | ||||
| 
 | ||||
|  |  | |||
|  | @ -31,9 +31,9 @@ enum mapping_flags { | |||
|     MAPPING_USER    = 1 << 4, | ||||
| }; | ||||
| 
 | ||||
| struct _hal_page { | ||||
| struct [[gnu::packed]] _hal_page { | ||||
|     uint32_t* ptr; | ||||
| } __attribute__((packed)); | ||||
| }; | ||||
| 
 | ||||
| #define vpn1$(x) ((x >> 22) & 0x3FF) | ||||
| #define vpn0$(x) ((x >> 12) & 0x3FF) | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ | |||
| 
 | ||||
| #include <stdint.h> | ||||
| 
 | ||||
| typedef struct __attribute__((packed)) { | ||||
| typedef struct [[gnu::packed]] { | ||||
|     uint32_t ra; | ||||
|     uint32_t gp; | ||||
|     uint32_t tp; | ||||
|  |  | |||
|  | @ -3,9 +3,9 @@ | |||
| #include <logger> | ||||
| #include <pmm> | ||||
| 
 | ||||
| __attribute__((used, section(".limine_requests"))) static volatile LIMINE_BASE_REVISION(3); | ||||
| __attribute__((used, section(".limine_requests_start"))) static volatile LIMINE_REQUESTS_START_MARKER; | ||||
| __attribute__((used, section(".limine_requests_end"))) static volatile LIMINE_REQUESTS_END_MARKER; | ||||
| [[gnu::used, gnu::section(".limine_requests")]] static volatile LIMINE_BASE_REVISION(3); | ||||
| [[gnu::used, gnu::section(".limine_requests_start")]] static volatile LIMINE_REQUESTS_START_MARKER; | ||||
| [[gnu::used, gnu::section(".limine_requests_end")]] static volatile LIMINE_REQUESTS_END_MARKER; | ||||
| 
 | ||||
| void kmain(void); | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
| 
 | ||||
| #include "serial.h" | ||||
| 
 | ||||
| __attribute__((used, section(".limine_requests"))) static volatile struct limine_hhdm_request hhdm_req = { | ||||
| [[gnu::used, gnu::section(".limine_requests")]] static volatile struct limine_hhdm_request hhdm_req = { | ||||
|     .id       = LIMINE_HHDM_REQUEST, | ||||
|     .revision = 0, | ||||
| }; | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ void kmalloc_init(void) { | |||
|     slabs[5] = slab_create(256, &pmm); | ||||
| } | ||||
| 
 | ||||
| static void* _alloc(__attribute__((unused)) void* ctx, size_t len) { | ||||
| static void* _alloc([[gnu::unused]] void* ctx, size_t len) { | ||||
|     Allocator* alloc = NULL; | ||||
| 
 | ||||
|     if (len <= 8) { | ||||
|  | @ -38,7 +38,7 @@ static void* _alloc(__attribute__((unused)) void* ctx, size_t len) { | |||
|     return alloc->alloc(alloc, len); | ||||
| } | ||||
| 
 | ||||
| static void _free(__attribute__((unused)) void* ctx, void* ptr, size_t len) { | ||||
| static void _free([[gnu::unused]] void* ctx, void* ptr, size_t len) { | ||||
|     Allocator* alloc = NULL; | ||||
| 
 | ||||
|     if (len <= 8) { | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ static HandoverPayload* payload          = NULL; | |||
| 
 | ||||
| /* --- Limine requests ------------------------------------------------------ */ | ||||
| 
 | ||||
| __attribute__((used, section(".limine_requests"))) static volatile struct limine_memmap_request mmap_req = { | ||||
| [[gnu::used, gnu::section(".limine_requests")]] static volatile struct limine_memmap_request mmap_req = { | ||||
|     .id       = LIMINE_MEMMAP_REQUEST, | ||||
|     .revision = 0 | ||||
| }; | ||||
|  |  | |||
|  | @ -1,7 +1,8 @@ | |||
| #include "stdlib.h" | ||||
| #include <hal> | ||||
| #include <logger> | ||||
| 
 | ||||
| __attribute__((noreturn)) void abort(void) { | ||||
|     hal_brkpoint(); | ||||
| #include "stdlib.h" | ||||
| 
 | ||||
| [[noreturn]] void abort(void) { | ||||
|     panic$("Abort was called"); | ||||
|     __builtin_unreachable(); | ||||
| } | ||||
|  |  | |||
|  | @ -1,3 +1,3 @@ | |||
| #pragma once | ||||
| 
 | ||||
| __attribute__((noreturn)) void abort(void); | ||||
| [[noreturn]] void abort(void); | ||||
|  |  | |||
|  | @ -118,7 +118,7 @@ void pmm_free(PhysObj obj) { | |||
| 
 | ||||
| // === ALLOCATOR ===
 | ||||
| 
 | ||||
| static void* _alloc(__attribute__((unused)) void* ctx, size_t len) { | ||||
| static void* _alloc([[gnu::unused]] void* ctx, size_t len) { | ||||
|     PhysObj obj = pmm_alloc(len); | ||||
|     if (obj.len == 0) { | ||||
|         return NULL; | ||||
|  | @ -127,7 +127,7 @@ static void* _alloc(__attribute__((unused)) void* ctx, size_t len) { | |||
|     return hal_mmap_l2h(obj.base); | ||||
| } | ||||
| 
 | ||||
| static void _free(__attribute__((unused)) void* ctx, void* ptr, size_t len) { | ||||
| static void _free([[gnu::unused]] void* ctx, void* ptr, size_t len) { | ||||
|     PhysObj obj = {.base = (uintptr_t)hal_mmap_h2l((uintptr_t)ptr), .len = len}; | ||||
|     pmm_free(obj); | ||||
| } | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ static void* alloc(void* ctx, size_t len) { | |||
|     return (void*)ptr; | ||||
| } | ||||
| 
 | ||||
| static void free(void* ctx, __attribute__((unused)) void* ptr, __attribute__((unused)) size_t len) { | ||||
| static void free(void* ctx, [[gnu::unused]] void* ptr, [[gnu::unused]] size_t len) { | ||||
|     BumpAllocator* self = (BumpAllocator*)ctx; | ||||
|     self->allocations--; | ||||
| 
 | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ static size_t page_amount(size_t size) { | |||
|     } | ||||
| } | ||||
| 
 | ||||
| static void* _alloc(void* ctx, __attribute__((unused)) size_t len) { | ||||
| static void* _alloc(void* ctx, [[gnu::unused]] size_t len) { | ||||
|     SlabAllocator* alloc = (SlabAllocator*)ctx; | ||||
|     if (alloc->root == NULL) { | ||||
|         return NULL; | ||||
|  | @ -30,7 +30,7 @@ static void* _alloc(void* ctx, __attribute__((unused)) size_t len) { | |||
|     return ptr; | ||||
| } | ||||
| 
 | ||||
| static void _free(void* ctx, void* ptr, __attribute__((unused)) size_t len) { | ||||
| static void _free(void* ctx, void* ptr, [[gnu::unused]] size_t len) { | ||||
|     SlabAllocator* alloc = (SlabAllocator*)ctx; | ||||
|     Slab* free           = (Slab*)((uintptr_t)ptr - sizeof(Slab)); | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ | |||
| #define FDT_NOP        0x4 | ||||
| #define FDT_END        0x9 | ||||
| 
 | ||||
| typedef struct __attribute__((packed)) { | ||||
| typedef struct [[gnu::packed]] { | ||||
|     uint32_t magic; | ||||
|     uint32_t totalsize; | ||||
|     uint32_t off_dt_struct; | ||||
|  |  | |||
|  | @ -8,11 +8,11 @@ | |||
|         LIST(ENUM_ITEM)                  \ | ||||
|     } PREFIX##Error; | ||||
| 
 | ||||
| #define DECLARE_ERROR_STRING(PREFIX, LIST)                              \ | ||||
|     __attribute__((used)) static const char* PREFIX##ErrorStrings[] = { \ | ||||
|         LIST(STRINGIFY)                                                 \ | ||||
|     };                                                                  \ | ||||
|                                                                         \ | ||||
|     inline static char const* PREFIX##ErrorString(PREFIX##Error err) {  \ | ||||
|         return PREFIX##ErrorStrings[err];                               \ | ||||
| #define DECLARE_ERROR_STRING(PREFIX, LIST)                             \ | ||||
|     [[gnu::used]] static const char* PREFIX##ErrorStrings[] = {        \ | ||||
|         LIST(STRINGIFY)                                                \ | ||||
|     };                                                                 \ | ||||
|                                                                        \ | ||||
|     inline static char const* PREFIX##ErrorString(PREFIX##Error err) { \ | ||||
|         return PREFIX##ErrorStrings[err];                              \ | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue