Rewrite macros (#121)

This commit is contained in:
Alex Kotov 2022-11-29 05:19:35 +04:00 committed by GitHub
parent fb5ff7f964
commit 7ea1d4b2b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 222 additions and 136 deletions

1
.gitignore vendored
View File

@ -111,6 +111,7 @@
/examples/generic_mutex
/examples/macro_bits
/examples/macro_container_of
/examples/macro_packing
/examples/memmap
/examples/ntoa
/examples/panic

View File

@ -1,3 +1,10 @@
2022-11-29 Alex Kotov <kotovalexarian@gmail.com>
* include/kernaux/macro.h: Rename macro "KERNAUX_PACKING_ATTR" to
"KERNAUX_PACKED"
* include/kernaux/macro.h: Add macros "KERNAUX_UNUSED", "KERNAUX_NORETURN",
"KERNAUX_RETURNS_TWICE", "KERNAUX_ASM"
2022-11-26 Alex Kotov <kotovalexarian@gmail.com>
libkernaux 0.5.0 released

View File

@ -40,7 +40,8 @@ zero). Work-in-progress APIs can change at any time.
* Basic features
* [Feature macros](/include/kernaux/version.h.in) (*work in progress*)
* [Macros](/include/kernaux/macro.h) (*non-breaking since* **0.5.0**)
* [Macros](/include/kernaux/macro.h) (*non-breaking since* **?.?.?**)
* [Example: packing](/examples/macro_packing.c)
* [Example: CONTAINER_OF](/examples/macro_container_of.c)
* [Example: BITS](/examples/macro_bits.c)
* [Assertions](/include/kernaux/assert.h) (*non-breaking since* **0.4.0**)

View File

@ -7,6 +7,10 @@ extern "C" {
#include <stdbool.h>
#include <kernaux/macro.h>
#include <kernaux/macro/packing_start.run>
struct DynArg {
bool use_dbl;
double dbl;
@ -16,8 +20,11 @@ struct DynArg {
long long ll;
const char *str;
unsigned long long ull;
} __attribute__((packed)) arg;
};
} KERNAUX_PACKED arg;
}
KERNAUX_PACKED;
#include <kernaux/macro/packing_end.run>
struct DynArg DynArg_create();
void DynArg_init(struct DynArg *dynarg);

View File

@ -40,7 +40,7 @@ VALUE rb_KernAux_assert_cb_EQ(const VALUE self, const VALUE assert_cb_rb)
}
VALUE rb_KernAux_assert_do(
const VALUE self_rb __attribute__((unused)),
const VALUE self_rb KERNAUX_UNUSED,
VALUE file_rb,
const VALUE line_rb,
VALUE msg_rb

View File

@ -7,6 +7,10 @@ extern "C" {
#include <stdbool.h>
#include <kernaux/macro.h>
#include <kernaux/macro/packing_start.run>
struct DynArg {
bool use_dbl;
double dbl;
@ -16,8 +20,11 @@ struct DynArg {
long long ll;
const char *str;
unsigned long long ull;
} __attribute__((packed)) arg;
};
} KERNAUX_PACKED arg;
}
KERNAUX_PACKED;
#include <kernaux/macro/packing_end.run>
struct DynArg DynArg_create();
void DynArg_init(struct DynArg *dynarg);

View File

@ -138,7 +138,7 @@ VALUE rb_KernAux_itoa(const int argc, const VALUE *argv, const VALUE self)
}
VALUE rb_KernAux_utoa2(
const VALUE self_rb __attribute__((unused)),
const VALUE self_rb KERNAUX_UNUSED,
const VALUE number_rb
) {
const uint64_t number = NUM2ULL(number_rb);
@ -151,7 +151,7 @@ VALUE rb_KernAux_utoa2(
}
VALUE rb_KernAux_itoa2(
const VALUE self_rb __attribute__((unused)),
const VALUE self_rb KERNAUX_UNUSED,
const VALUE number_rb
) {
const int64_t number = NUM2LL(number_rb);
@ -161,7 +161,7 @@ VALUE rb_KernAux_itoa2(
}
VALUE rb_KernAux_utoa8(
const VALUE self_rb __attribute__((unused)),
const VALUE self_rb KERNAUX_UNUSED,
const VALUE number_rb
) {
const uint64_t number = NUM2ULL(number_rb);
@ -174,7 +174,7 @@ VALUE rb_KernAux_utoa8(
}
VALUE rb_KernAux_itoa8(
const VALUE self_rb __attribute__((unused)),
const VALUE self_rb KERNAUX_UNUSED,
const VALUE number_rb
) {
const int64_t number = NUM2LL(number_rb);
@ -184,7 +184,7 @@ VALUE rb_KernAux_itoa8(
}
VALUE rb_KernAux_utoa10(
const VALUE self_rb __attribute__((unused)),
const VALUE self_rb KERNAUX_UNUSED,
const VALUE number_rb
) {
const uint64_t number = NUM2ULL(number_rb);
@ -197,7 +197,7 @@ VALUE rb_KernAux_utoa10(
}
VALUE rb_KernAux_itoa10(
const VALUE self_rb __attribute__((unused)),
const VALUE self_rb KERNAUX_UNUSED,
const VALUE number_rb
) {
const int64_t number = NUM2LL(number_rb);
@ -207,7 +207,7 @@ VALUE rb_KernAux_itoa10(
}
VALUE rb_KernAux_utoa16(
const VALUE self_rb __attribute__((unused)),
const VALUE self_rb KERNAUX_UNUSED,
const VALUE number_rb
) {
const uint64_t number = NUM2ULL(number_rb);
@ -220,7 +220,7 @@ VALUE rb_KernAux_utoa16(
}
VALUE rb_KernAux_itoa16(
const VALUE self_rb __attribute__((unused)),
const VALUE self_rb KERNAUX_UNUSED,
const VALUE number_rb
) {
const int64_t number = NUM2LL(number_rb);

View File

@ -68,7 +68,7 @@ void init_printf()
VALUE rb_KernAux_snprintf1(
const int argc,
const VALUE *const argv_rb,
const VALUE self __attribute__((unused))
const VALUE self KERNAUX_UNUSED
) {
if (argc < 2 || argc > 5) rb_raise(rb_eArgError, "expected 2, 3, 4 or 5 args");

View File

@ -53,6 +53,14 @@ TESTS += macro_container_of
macro_container_of_LDADD = $(top_builddir)/libkernaux.la
macro_container_of_SOURCES = main.c macro_container_of.c
#################
# macro_packing #
#################
TESTS += macro_packing
macro_packing_LDADD = $(top_builddir)/libkernaux.la
macro_packing_SOURCES = main.c macro_packing.c
##########
# memmap #
##########

25
examples/macro_packing.c Normal file
View File

@ -0,0 +1,25 @@
#include <kernaux/macro.h>
#include <assert.h>
#include <stdint.h>
struct Foo {
uint8_t a;
uint32_t b;
};
#include <kernaux/macro/packing_start.run>
struct Bar {
uint8_t a;
uint32_t b;
}
KERNAUX_PACKED;
#include <kernaux/macro/packing_end.run>
void example_main()
{
assert(sizeof(struct Foo) > 5);
assert(sizeof(struct Bar) == 5);
}

View File

@ -60,7 +60,7 @@ struct KernAux_Arch_I386_DTR {
uint16_t size;
uint32_t offset;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_DTR, 6);
@ -83,7 +83,7 @@ struct KernAux_Arch_I386_DTE {
unsigned gran : 1;
unsigned base_high : 8;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
// Interrupt descriptor table entry
// TODO: validate this according to spec
@ -94,7 +94,7 @@ typedef struct KernAux_Arch_I386_IDTE {
uint8_t flags;
uint16_t offset_high;
}
KERNAUX_PACKING_ATTR
KERNAUX_PACKED
*KernAux_Arch_I386_IDTE;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_DTE, 8);
@ -153,7 +153,7 @@ struct KernAux_Arch_I386_TSS {
uint16_t _zero11;
uint16_t io_map_base;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_TSS, 104);
@ -171,7 +171,7 @@ struct KernAux_Arch_I386_PDE {
unsigned available1 : 4;
unsigned addr : 20;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_PDE, 4);
@ -190,7 +190,7 @@ struct KernAux_Arch_I386_PTE {
unsigned available : 3;
unsigned addr : 20;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_PDE, 4);
@ -198,7 +198,7 @@ KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_PDE, 4);
struct KernAux_Arch_I386_PageDir {
struct KernAux_Arch_I386_PDE pdes[KERNAUX_ARCH_I386_PAGE_DIR_ENTRIES_COUNT];
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_PageDir, KERNAUX_ARCH_I386_PAGE_SIZE);
@ -206,7 +206,7 @@ KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_PageDir, KERNAUX_ARCH_I386_PAG
struct KernAux_Arch_I386_PageTable {
struct KernAux_Arch_I386_PTE ptes[KERNAUX_ARCH_I386_PAGE_TABLE_ENTRIES_COUNT];
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Arch_I386_PageTable, KERNAUX_ARCH_I386_PAGE_SIZE);

View File

@ -6,6 +6,7 @@ extern "C" {
#endif
#include <kernaux/arch/x86.h>
#include <kernaux/macro.h>
#include <stdint.h>
@ -20,37 +21,37 @@ inline static void kernaux_asm_x86_outportd(uint16_t port, uint32_t value);
uint8_t kernaux_asm_x86_inportb(const uint16_t port)
{
register uint8_t result;
__asm__ volatile("inb %1, %0" : "=a" (result) : "dN" (port));
KERNAUX_ASM("inb %1, %0" : "=a" (result) : "dN" (port));
return result;
}
uint16_t kernaux_asm_x86_inportw(const uint16_t port)
{
register uint16_t result;
__asm__ volatile("inw %1, %0" : "=a" (result) : "dN" (port));
KERNAUX_ASM("inw %1, %0" : "=a" (result) : "dN" (port));
return result;
}
uint32_t kernaux_asm_x86_inportd(const uint16_t port)
{
register uint32_t result;
__asm__ volatile("inl %1, %0" : "=a" (result) : "dN" (port));
KERNAUX_ASM("inl %1, %0" : "=a" (result) : "dN" (port));
return result;
}
void kernaux_asm_x86_outportb(const uint16_t port, const uint8_t value)
{
__asm__ volatile("outb %1, %0" : : "dN" (port), "a" (value));
KERNAUX_ASM("outb %1, %0" : : "dN" (port), "a" (value));
}
void kernaux_asm_x86_outportw(const uint16_t port, const uint16_t value)
{
__asm__ volatile("outw %1, %0" : : "dN" (port), "a" (value));
KERNAUX_ASM("outw %1, %0" : : "dN" (port), "a" (value));
}
void kernaux_asm_x86_outportd(const uint16_t port, const uint32_t value)
{
__asm__ volatile("outl %1, %0" : : "dN" (port), "a" (value));
KERNAUX_ASM("outl %1, %0" : : "dN" (port), "a" (value));
}
#ifdef __cplusplus

View File

@ -5,7 +5,9 @@
extern "C" {
#endif
__attribute__((noreturn))
#include <kernaux/macro.h>
KERNAUX_NORETURN
void kernaux_drivers_shutdown_halt();
void kernaux_drivers_shutdown_poweroff();

View File

@ -36,7 +36,7 @@ struct KernAux_ELF_Header {
unsigned sect_entr_num : 16;
unsigned sect_names_idx : 16;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_ELF_Header, 52);
@ -50,7 +50,7 @@ struct KernAux_ELF_ProgramEntry {
unsigned flags : 32;
unsigned align : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_ELF_ProgramEntry, 32);
@ -66,7 +66,7 @@ struct KernAux_ELF_SectionEntry {
unsigned alignment : 32;
unsigned ent_size : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_ELF_SectionEntry, 40);
@ -74,7 +74,7 @@ struct KernAux_ELF_RelocationEntry {
unsigned virt_addr : 32;
unsigned info : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_ELF_RelocationEntry, 8);

View File

@ -8,17 +8,25 @@ extern "C" {
#include <stddef.h>
#include <stdint.h>
#define KERNAUX_EOF (-1)
/*********************
* Language features *
*********************/
#define KERNAUX_CONTAINER_OF(ptr, type, member) \
((type*)((uintptr_t)(ptr) - offsetof(type, member)))
#define KERNAUX_UNUSED __attribute__((unused))
#define KERNAUX_NORETURN __attribute__((noreturn))
#define KERNAUX_RETURNS_TWICE __attribute__((returns_twice))
#define KERNAUX_BITS(n) (1u << (n))
#ifdef __TINYC__
# define KERNAUX_PACKED
#else
# define KERNAUX_PACKED __attribute__((packed))
#endif
#define KERNAUX_BITS8(n) ((uint8_t )(((uint8_t )1) << (n)))
#define KERNAUX_BITS16(n) ((uint16_t)(((uint16_t)1) << (n)))
#define KERNAUX_BITS32(n) ((uint32_t)(((uint32_t)1) << (n)))
#define KERNAUX_BITS64(n) ((uint64_t)(((uint64_t)1) << (n)))
#define KERNAUX_ASM(...) do { __asm__ __volatile__(__VA_ARGS__); } while (0)
/**************
* Visibility *
**************/
#ifdef KERNAUX_ACCESS_PRIVATE
# define KERNAUX_PRIVATE_FIELD(id) id
@ -33,11 +41,9 @@ extern "C" {
# endif
#endif // KERNAUX_ACCESS_PRIVATE
#ifdef __TINYC__
# define KERNAUX_PACKING_ATTR
#else
# define KERNAUX_PACKING_ATTR __attribute__((packed))
#endif
/*********************
* Static assertions *
*********************/
#define KERNAUX_STATIC_TEST_STRUCT_SIZE(name, size) \
__attribute__((unused)) \
@ -46,6 +52,26 @@ _kernaux_static_test_struct_size_##name[ \
sizeof(struct name) == (size) ? 1 : -1 \
]
/*****************
* Simple values *
*****************/
#define KERNAUX_EOF (-1)
/*********************
* Calculated values *
*********************/
#define KERNAUX_CONTAINER_OF(ptr, type, member) \
((type*)((uintptr_t)(ptr) - offsetof(type, member)))
#define KERNAUX_BITS(n) (1u << (n))
#define KERNAUX_BITS8(n) ((uint8_t )(((uint8_t )1) << (n)))
#define KERNAUX_BITS16(n) ((uint16_t)(((uint16_t)1) << (n)))
#define KERNAUX_BITS32(n) ((uint32_t)(((uint32_t)1) << (n)))
#define KERNAUX_BITS64(n) ((uint64_t)(((uint64_t)1) << (n)))
#ifdef __cplusplus
}
#endif

View File

@ -27,7 +27,7 @@ struct KernAux_Mbr_Entry {
uint32_t first_sector_lba_addr;
uint32_t sectors_count;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Mbr_Entry, 16);
@ -37,7 +37,7 @@ struct KernAux_Mbr_Info {
struct KernAux_Mbr_Entry entries[KERNAUX_MBR_ENTRIES];
uint16_t magic;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(
KernAux_Mbr_Info,
@ -48,7 +48,7 @@ struct KernAux_Mbr {
uint8_t bootstrap[KERNAUX_MBR_BOOTSTRAP_SIZE];
struct KernAux_Mbr_Info info;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(
KernAux_Mbr,

View File

@ -58,7 +58,7 @@ struct KernAux_Multiboot2_Header {
unsigned total_size : 32;
unsigned checksum : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_Header, 16);
@ -81,7 +81,7 @@ struct KernAux_Multiboot2_HTagBase {
unsigned flags : 16;
unsigned size : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTagBase, 8);
@ -93,7 +93,7 @@ struct KernAux_Multiboot2_Info {
unsigned total_size : 32;
unsigned reserved1 : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_Info, 8);
@ -126,7 +126,7 @@ struct KernAux_Multiboot2_ITagBase {
enum KernAux_Multiboot2_ITag type : 32;
unsigned size : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITagBase, 8);
@ -150,7 +150,7 @@ struct KernAux_Multiboot2_ITag_MemoryMap_EntryBase {
unsigned type : 32;
unsigned reserved1 : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_MemoryMap_EntryBase, 24);
@ -163,7 +163,7 @@ struct KernAux_Multiboot2_HTag_None {
// size = 8
struct KernAux_Multiboot2_HTagBase base;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_None, 8);
@ -172,7 +172,7 @@ struct KernAux_Multiboot2_HTag_InfoReq {
// size > 8
struct KernAux_Multiboot2_HTagBase base;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_InfoReq, 8);
@ -186,7 +186,7 @@ struct KernAux_Multiboot2_HTag_Addr {
unsigned load_end_addr : 32;
unsigned bss_end_addr : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_Addr, 24);
@ -197,7 +197,7 @@ struct KernAux_Multiboot2_HTag_EntryAddr {
unsigned entry_addr : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_EntryAddr, 12);
@ -208,7 +208,7 @@ struct KernAux_Multiboot2_HTag_Flags {
unsigned console_flags : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_Flags, 12);
@ -221,7 +221,7 @@ struct KernAux_Multiboot2_HTag_Framebuffer {
unsigned height : 32;
unsigned depth : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_Framebuffer, 20);
@ -230,7 +230,7 @@ struct KernAux_Multiboot2_HTag_ModuleAlign {
// size = 8
struct KernAux_Multiboot2_HTagBase base;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_ModuleAlign, 8);
@ -239,7 +239,7 @@ struct KernAux_Multiboot2_HTag_EFIBootServices {
// size = 8
struct KernAux_Multiboot2_HTagBase base;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_EFIBootServices, 8);
@ -250,7 +250,7 @@ struct KernAux_Multiboot2_HTag_EFII386EntryAddr {
unsigned entry_addr : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_EFII386EntryAddr, 12);
@ -261,7 +261,7 @@ struct KernAux_Multiboot2_HTag_EFIAmd64EntryAddr {
unsigned entry_addr : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_EFIAmd64EntryAddr, 12);
@ -275,7 +275,7 @@ struct KernAux_Multiboot2_HTag_RelocatableHeader {
unsigned align : 32;
enum KernAux_Multiboot2_HTag_RelocatableHeader_Preference preferences : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_HTag_RelocatableHeader, 24);
@ -288,7 +288,7 @@ struct KernAux_Multiboot2_ITag_None {
// size = 8
struct KernAux_Multiboot2_ITagBase base;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_None, 8);
@ -297,7 +297,7 @@ struct KernAux_Multiboot2_ITag_BootCmdLine {
// size > 8
struct KernAux_Multiboot2_ITagBase base;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_BootCmdLine, 8);
@ -306,7 +306,7 @@ struct KernAux_Multiboot2_ITag_BootLoaderName {
// size > 8
struct KernAux_Multiboot2_ITagBase base;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_BootLoaderName, 8);
@ -318,7 +318,7 @@ struct KernAux_Multiboot2_ITag_Module {
unsigned mod_start : 32;
unsigned mod_end : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_Module, 16);
@ -330,7 +330,7 @@ struct KernAux_Multiboot2_ITag_BasicMemoryInfo {
unsigned mem_lower : 32;
unsigned mem_upper : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_BasicMemoryInfo, 16);
@ -343,7 +343,7 @@ struct KernAux_Multiboot2_ITag_BIOSBootDevice {
unsigned partition : 32;
unsigned sub_partition : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_BIOSBootDevice, 20);
@ -355,7 +355,7 @@ struct KernAux_Multiboot2_ITag_MemoryMap {
unsigned entry_size : 32;
unsigned entry_version : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_MemoryMap, 16);
@ -371,7 +371,7 @@ struct KernAux_Multiboot2_ITag_VBEInfo {
unsigned char vbe_control_info[512];
unsigned char vbe_mode_info[256];
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_VBEInfo, 784);
@ -388,7 +388,7 @@ struct KernAux_Multiboot2_ITag_FramebufferInfo {
unsigned framebuffer_type : 8;
unsigned reserved1 : 8;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_FramebufferInfo, 31);
@ -402,7 +402,7 @@ struct KernAux_Multiboot2_ITag_ELFSymbols {
unsigned shndx : 16;
unsigned reserved1 : 16;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_ELFSymbols, 16);
@ -421,7 +421,7 @@ struct KernAux_Multiboot2_ITag_APMTable {
unsigned cseg_16_len : 16;
unsigned dseg_len : 16;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_APMTable, 28);
@ -432,7 +432,7 @@ struct KernAux_Multiboot2_ITag_EFI32bitSystemTablePtr {
unsigned pointer : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_EFI32bitSystemTablePtr, 12);
@ -443,7 +443,7 @@ struct KernAux_Multiboot2_ITag_EFI64bitSystemTablePtr {
unsigned long long pointer : 64;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_EFI64bitSystemTablePtr, 16);
@ -456,7 +456,7 @@ struct KernAux_Multiboot2_ITag_SMBIOSTables {
unsigned minor : 8;
unsigned char reserved1[6];
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_SMBIOSTables, 16);
@ -465,7 +465,7 @@ struct KernAux_Multiboot2_ITag_ACPIOldRSDP {
// size > 8
struct KernAux_Multiboot2_ITagBase base;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_ACPIOldRSDP, 8);
@ -474,7 +474,7 @@ struct KernAux_Multiboot2_ITag_ACPINewRSDP {
// size > 8
struct KernAux_Multiboot2_ITagBase base;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_ACPINewRSDP, 8);
@ -483,7 +483,7 @@ struct KernAux_Multiboot2_ITag_NetworkingInfo {
// size > 8
struct KernAux_Multiboot2_ITagBase base;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_NetworkingInfo, 8);
@ -495,7 +495,7 @@ struct KernAux_Multiboot2_ITag_EFIMemoryMap {
unsigned descriptor_size : 32;
unsigned descriptor_version : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(KernAux_Multiboot2_ITag_EFIMemoryMap, 16);
@ -504,7 +504,7 @@ struct KernAux_Multiboot2_ITag_EFIBootServicesNotTerminated {
// size = 8
struct KernAux_Multiboot2_ITagBase base;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(
KernAux_Multiboot2_ITag_EFIBootServicesNotTerminated,
@ -518,7 +518,7 @@ struct KernAux_Multiboot2_ITag_EFI32bitImageHandlePtr {
unsigned pointer : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(
KernAux_Multiboot2_ITag_EFI32bitImageHandlePtr,
@ -532,7 +532,7 @@ struct KernAux_Multiboot2_ITag_EFI64bitImageHandlePtr {
unsigned long long pointer : 64;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(
KernAux_Multiboot2_ITag_EFI64bitImageHandlePtr,
@ -546,7 +546,7 @@ struct KernAux_Multiboot2_ITag_ImageLoadBasePhysAddr {
unsigned load_base_addr : 32;
}
KERNAUX_PACKING_ATTR;
KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(
KernAux_Multiboot2_ITag_ImageLoadBasePhysAddr,

View File

@ -22,7 +22,7 @@
static void file_putc(char c, void *arg);
#endif
void kernaux_drivers_console_putc(const char c __attribute__((unused)))
void kernaux_drivers_console_putc(const char c KERNAUX_UNUSED)
{
#ifdef ASM_X86
kernaux_asm_x86_outportb(0x3f8, c);
@ -68,7 +68,7 @@ void kernaux_drivers_console_write(const char *const data, const size_t size)
}
#ifdef WITH_PRINTF
void file_putc(char c, void *arg __attribute__((unused)))
void file_putc(char c, void *arg KERNAUX_UNUSED)
{
kernaux_drivers_console_putc(c);
}

View File

@ -3,6 +3,7 @@
#endif
#include <kernaux/drivers/framebuffer.h>
#include <kernaux/macro.h>
__attribute__((unused))
KERNAUX_UNUSED
static const int foobar = 0;

View File

@ -9,7 +9,7 @@ void kernaux_drivers_shutdown_halt()
{
#ifdef ASM_X86
// Disable interrupts
__asm__ __volatile__("cli");
KERNAUX_ASM("cli");
#endif
volatile int x = 0;

View File

@ -34,7 +34,7 @@ static const struct {
struct KernAux_Multiboot2_HTag_RelocatableHeader tag_relocatable_header;
struct KernAux_Multiboot2_HTag_None tag_none;
} KERNAUX_PACKING_ATTR multiboot2_header_example2 = {
} KERNAUX_PACKED multiboot2_header_example2 = {
.multiboot2_header = {
.magic = KERNAUX_MULTIBOOT2_HEADER_MAGIC,
.arch = KERNAUX_MULTIBOOT2_HEADER_ARCH_I386,

View File

@ -105,7 +105,7 @@ static const struct {
uint8_t _align11[4];
struct KernAux_Multiboot2_ITag_None tag_none;
} KERNAUX_PACKING_ATTR multiboot2_info_example2 = {
} KERNAUX_PACKED multiboot2_info_example2 = {
.multiboot2_info = {
.total_size = sizeof(multiboot2_info_example2),
.reserved1 = 0,

View File

@ -4,6 +4,7 @@
#define KERNAUX_ACCESS_PROTECTED
#include <kernaux/macro.h>
#include <kernaux/printf.h>
#include <assert.h>
@ -19,7 +20,7 @@ static const char *const data = "foobar";
static char buffer[BUFFER_SIZE];
static size_t buffer_index;
static void test_putc(char c, __attribute__((unused)) void *arg)
static void test_putc(char c, KERNAUX_UNUSED void *arg)
{
if (buffer_index >= BUFFER_SIZE) {
printf("Buffer overflow!\n");

View File

@ -5,6 +5,7 @@
#define KERNAUX_ACCESS_PRIVATE
#include <kernaux/assert.h>
#include <kernaux/macro.h>
#include <kernaux/memmap.h>
#include <assert.h>
@ -21,8 +22,8 @@ static const char *assert_last_file = NULL;
static void assert_cb(
const char *const file,
__attribute__((unused)) const int line,
__attribute__((unused)) const char *const msg
const int line KERNAUX_UNUSED,
const char *const msg KERNAUX_UNUSED
) {
++assert_count_ctr;
assert_last_file = file;

View File

@ -15,7 +15,7 @@
static const struct {
struct KernAux_Multiboot2_Info multiboot2_info;
struct KernAux_Multiboot2_ITag_None tag_none;
} KERNAUX_PACKING_ATTR multiboot2_without_boot_cmd_line = {
} KERNAUX_PACKED multiboot2_without_boot_cmd_line = {
.multiboot2_info = {
.total_size = sizeof(multiboot2_without_boot_cmd_line),
.reserved1 = 0,
@ -39,7 +39,7 @@ static const struct {
unsigned char _align1[2];
struct KernAux_Multiboot2_ITag_None tag_none;
} KERNAUX_PACKING_ATTR multiboot2_with_some_boot_cmd_line = {
} KERNAUX_PACKED multiboot2_with_some_boot_cmd_line = {
.multiboot2_info = {
.total_size = sizeof(multiboot2_with_some_boot_cmd_line),
.reserved1 = 0,
@ -81,7 +81,7 @@ static const struct {
unsigned char _align2[3];
struct KernAux_Multiboot2_ITag_None tag_none;
} KERNAUX_PACKING_ATTR multiboot2_with_two_boot_cmd_lines = {
} KERNAUX_PACKED multiboot2_with_two_boot_cmd_lines = {
.multiboot2_info = {
.total_size = sizeof(multiboot2_with_two_boot_cmd_lines),
.reserved1 = 0,

View File

@ -44,7 +44,7 @@ static const struct KernAux_Multiboot2_ITag_None tag_none_invalid_size = {
static const struct {
struct KernAux_Multiboot2_ITag_BootCmdLine tag;
char cmdline[1];
} KERNAUX_PACKING_ATTR tag_boot_cmd_line_with_empty_cmdline_valid = {
} KERNAUX_PACKED tag_boot_cmd_line_with_empty_cmdline_valid = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_CMD_LINE,
@ -57,7 +57,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_BootCmdLine tag;
char cmdline[14];
} KERNAUX_PACKING_ATTR tag_boot_cmd_line_with_some_cmdline_valid = {
} KERNAUX_PACKED tag_boot_cmd_line_with_some_cmdline_valid = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_CMD_LINE,
@ -70,7 +70,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_BootCmdLine tag;
char cmdline[1];
} KERNAUX_PACKING_ATTR tag_boot_cmd_line_invalid_type = {
} KERNAUX_PACKED tag_boot_cmd_line_invalid_type = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_NONE,
@ -83,7 +83,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_BootCmdLine tag;
char cmdline[1];
} KERNAUX_PACKING_ATTR tag_boot_cmd_line_with_empty_cmdline_invalid_size = {
} KERNAUX_PACKED tag_boot_cmd_line_with_empty_cmdline_invalid_size = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_CMD_LINE,
@ -96,7 +96,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_BootCmdLine tag;
char cmdline[14];
} KERNAUX_PACKING_ATTR tag_boot_cmd_line_with_some_cmdline_invalid_size = {
} KERNAUX_PACKED tag_boot_cmd_line_with_some_cmdline_invalid_size = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_CMD_LINE,
@ -113,7 +113,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_BootLoaderName tag;
char name[1];
} KERNAUX_PACKING_ATTR tag_boot_loader_name_with_empty_name_valid = {
} KERNAUX_PACKED tag_boot_loader_name_with_empty_name_valid = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_LOADER_NAME,
@ -126,7 +126,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_BootLoaderName tag;
char name[14];
} KERNAUX_PACKING_ATTR tag_boot_loader_name_with_some_name_valid = {
} KERNAUX_PACKED tag_boot_loader_name_with_some_name_valid = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_LOADER_NAME,
@ -139,7 +139,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_BootLoaderName tag;
char name[1];
} KERNAUX_PACKING_ATTR tag_boot_loader_name_invalid_type = {
} KERNAUX_PACKED tag_boot_loader_name_invalid_type = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_NONE,
@ -152,7 +152,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_BootLoaderName tag;
char name[1];
} KERNAUX_PACKING_ATTR tag_boot_loader_name_with_empty_name_invalid_size = {
} KERNAUX_PACKED tag_boot_loader_name_with_empty_name_invalid_size = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_LOADER_NAME,
@ -165,7 +165,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_BootLoaderName tag;
char name[14];
} KERNAUX_PACKING_ATTR tag_boot_loader_name_with_some_name_invalid_size = {
} KERNAUX_PACKED tag_boot_loader_name_with_some_name_invalid_size = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_BOOT_LOADER_NAME,
@ -182,7 +182,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_Module tag;
char cmdline[1];
} KERNAUX_PACKING_ATTR tag_module_with_empty_name_valid = {
} KERNAUX_PACKED tag_module_with_empty_name_valid = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_MODULE,
@ -197,7 +197,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_Module tag;
char cmdline[14];
} KERNAUX_PACKING_ATTR tag_module_with_some_name_valid = {
} KERNAUX_PACKED tag_module_with_some_name_valid = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_MODULE,
@ -212,7 +212,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_Module tag;
char cmdline[1];
} KERNAUX_PACKING_ATTR tag_module_invalid_type = {
} KERNAUX_PACKED tag_module_invalid_type = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_NONE,
@ -227,7 +227,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_Module tag;
char cmdline[1];
} KERNAUX_PACKING_ATTR tag_module_with_empty_name_invalid_size = {
} KERNAUX_PACKED tag_module_with_empty_name_invalid_size = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_MODULE,
@ -242,7 +242,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_Module tag;
char cmdline[14];
} KERNAUX_PACKING_ATTR tag_module_with_some_name_invalid_size = {
} KERNAUX_PACKED tag_module_with_some_name_invalid_size = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_MODULE,
@ -257,7 +257,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_Module tag;
char cmdline[14];
} KERNAUX_PACKING_ATTR tag_module_with_equal_start_end_invalid = {
} KERNAUX_PACKED tag_module_with_equal_start_end_invalid = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_MODULE,
@ -272,7 +272,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_Module tag;
char cmdline[14];
} KERNAUX_PACKING_ATTR tag_module_with_reversed_start_end_invalid = {
} KERNAUX_PACKED tag_module_with_reversed_start_end_invalid = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_MODULE,
@ -372,7 +372,7 @@ tag_memory_map_with_empty_data_valid = {
static const struct {
struct KernAux_Multiboot2_ITag_MemoryMap tag;
unsigned char data[8 * 2];
} KERNAUX_PACKING_ATTR tag_memory_map_with_some_small_data_items_valid = {
} KERNAUX_PACKED tag_memory_map_with_some_small_data_items_valid = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP,
@ -386,7 +386,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_MemoryMap tag;
unsigned char data[64 * 2];
} KERNAUX_PACKING_ATTR tag_memory_map_with_some_large_data_items_valid = {
} KERNAUX_PACKED tag_memory_map_with_some_large_data_items_valid = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP,
@ -420,7 +420,7 @@ tag_memory_map_with_empty_data_invalid_size = {
static const struct {
struct KernAux_Multiboot2_ITag_MemoryMap tag;
unsigned char data[64 * 2 + 1];
} KERNAUX_PACKING_ATTR tag_memory_map_with_some_large_data_items_invalid_size = {
} KERNAUX_PACKED tag_memory_map_with_some_large_data_items_invalid_size = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP,
@ -454,7 +454,7 @@ tag_memory_map_with_empty_data_invalid_entry_size_not_mul8 = {
static const struct {
struct KernAux_Multiboot2_ITag_MemoryMap tag;
unsigned char data[9 * 2];
} KERNAUX_PACKING_ATTR tag_memory_map_with_some_small_data_items_invalid_entry_size_not_mul8 = {
} KERNAUX_PACKED tag_memory_map_with_some_small_data_items_invalid_entry_size_not_mul8 = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP,
@ -468,7 +468,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_ITag_MemoryMap tag;
unsigned char data[63 * 2];
} KERNAUX_PACKING_ATTR tag_memory_map_with_some_large_data_items_invalid_entry_size_not_mul8 = {
} KERNAUX_PACKED tag_memory_map_with_some_large_data_items_invalid_entry_size_not_mul8 = {
.tag = {
.base = {
.type = KERNAUX_MULTIBOOT2_ITAG_MEMORY_MAP,
@ -548,7 +548,7 @@ tag_elf_symbols_with_zero_ent_size_valid = {
static const struct {
struct KernAux_Multiboot2_Info multiboot2_info;
struct KernAux_Multiboot2_ITag_None tag_none;
} KERNAUX_PACKING_ATTR multiboot2_empty_valid = {
} KERNAUX_PACKED multiboot2_empty_valid = {
.multiboot2_info = {
.total_size = 8 + 8,
.reserved1 = 0,
@ -565,7 +565,7 @@ static const struct {
struct KernAux_Multiboot2_Info multiboot2_info;
struct KernAux_Multiboot2_ITag_BasicMemoryInfo tag_basic_memory_info;
struct KernAux_Multiboot2_ITag_None tag_none;
} KERNAUX_PACKING_ATTR multiboot2_with_some_additional_tag_valid = {
} KERNAUX_PACKED multiboot2_with_some_additional_tag_valid = {
.multiboot2_info = {
.total_size = 8 + 16 + 8,
.reserved1 = 0,
@ -592,7 +592,7 @@ static const struct {
struct KernAux_Multiboot2_ITag_BIOSBootDevice tag_bios_boot_device;
unsigned char _align1[4];
struct KernAux_Multiboot2_ITag_None tag_none;
} KERNAUX_PACKING_ATTR multiboot2_with_more_additional_tags_valid = {
} KERNAUX_PACKED multiboot2_with_more_additional_tags_valid = {
.multiboot2_info = {
.total_size = 8 + 16 + (20 + 4) + 8,
.reserved1 = 0,
@ -625,7 +625,7 @@ static const struct {
static const struct {
struct KernAux_Multiboot2_Info multiboot2_info;
struct KernAux_Multiboot2_ITag_None tag_none;
} KERNAUX_PACKING_ATTR multiboot2_empty_invalid_size = {
} KERNAUX_PACKED multiboot2_empty_invalid_size = {
.multiboot2_info = {
.total_size = 8,
.reserved1 = 0,
@ -647,7 +647,7 @@ multiboot2_without_none_tag_invalid = {
static const struct {
struct KernAux_Multiboot2_Info multiboot2_info;
struct KernAux_Multiboot2_ITag_BasicMemoryInfo tag_basic_memory_info;
} KERNAUX_PACKING_ATTR multiboot2_with_invalid_last_tag_invalid = {
} KERNAUX_PACKED multiboot2_with_invalid_last_tag_invalid = {
.multiboot2_info = {
.total_size = 8 + 16,
.reserved1 = 0,
@ -669,7 +669,7 @@ static const struct {
struct KernAux_Multiboot2_ITag_BIOSBootDevice tag_bios_boot_device;
unsigned char _align1[4];
struct KernAux_Multiboot2_ITag_None tag_none2;
} KERNAUX_PACKING_ATTR multiboot2_with_early_none_tag_invalid = {
} KERNAUX_PACKED multiboot2_with_early_none_tag_invalid = {
.multiboot2_info = {
.total_size = 8 + 16 + 8 + (20 + 4) + 8,
.reserved1 = 0,
@ -711,7 +711,7 @@ static const struct {
struct KernAux_Multiboot2_ITag_BIOSBootDevice tag_bios_boot_device;
unsigned char _align1[4];
struct KernAux_Multiboot2_ITag_None tag_none;
} KERNAUX_PACKING_ATTR multiboot2_with_more_additional_tags_invalid_size_too_big = {
} KERNAUX_PACKED multiboot2_with_more_additional_tags_invalid_size_too_big = {
.multiboot2_info = {
.total_size = 8 + 16 + (20 + 4) + 8 + 1,
.reserved1 = 0,
@ -747,7 +747,7 @@ static const struct {
struct KernAux_Multiboot2_ITag_BIOSBootDevice tag_bios_boot_device;
unsigned char _align1[4];
struct KernAux_Multiboot2_ITag_None tag_none;
} KERNAUX_PACKING_ATTR multiboot2_with_more_additional_tags_invalid_size_too_small = {
} KERNAUX_PACKED multiboot2_with_more_additional_tags_invalid_size_too_small = {
.multiboot2_info = {
.total_size = 8 + 16 + (20 + 4) + 8 - 1,
.reserved1 = 0,

View File

@ -3,6 +3,7 @@
#endif
#include <kernaux/assert.h>
#include <kernaux/macro.h>
#include <kernaux/pfa.h>
#include <assert.h>
@ -14,12 +15,9 @@ static unsigned int count = 0;
static jmp_buf jmpbuf;
static void assert_cb(
__attribute__((unused))
const char *const file,
__attribute__((unused))
const int line,
__attribute__((unused))
const char *const str
const char *const file KERNAUX_UNUSED,
const int line KERNAUX_UNUSED,
const char *const str KERNAUX_UNUSED
) {
++count;
longjmp(jmpbuf, 1);