The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=32568e5f2435a2539b0c4177a6fefe7a9e0a0c89

commit 32568e5f2435a2539b0c4177a6fefe7a9e0a0c89
Author:     Warner Losh <[email protected]>
AuthorDate: 2024-02-21 15:48:32 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2024-02-21 15:51:34 +0000

    loader: Retire CTASSERT
    
    The project is moving away from CTASSERT in favor of
    _Static_assert. Cleanup the few instances in the loader proactively.
    
    Sponsored by:           Netflix
    Reviewed by:            manu, tsoome
    Differential Revision:  https://reviews.freebsd.org/D44006
---
 stand/common/bootstrap.h                 | 4 ----
 stand/efi/loader/arch/amd64/multiboot2.c | 2 +-
 stand/i386/libi386/multiboot.c           | 2 +-
 stand/i386/loader/main.c                 | 9 ++++-----
 4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h
index 7387569ad65a..b7d6e538f9be 100644
--- a/stand/common/bootstrap.h
+++ b/stand/common/bootstrap.h
@@ -382,8 +382,4 @@ int gen_setcurrdev(struct env_var *ev, int flags, const 
void *value);
 int mount_currdev(struct env_var *, int, const void *);
 void set_currdev(const char *devname);
 
-#ifndef CTASSERT
-#define        CTASSERT(x)     _Static_assert(x, "compile-time assertion 
failed")
-#endif
-
 #endif /* !_BOOTSTRAP_H_ */
diff --git a/stand/efi/loader/arch/amd64/multiboot2.c 
b/stand/efi/loader/arch/amd64/multiboot2.c
index 4d7b2713685d..6c96d7dc0073 100644
--- a/stand/efi/loader/arch/amd64/multiboot2.c
+++ b/stand/efi/loader/arch/amd64/multiboot2.c
@@ -334,7 +334,7 @@ exec(struct preloaded_file *fp)
        struct mb2hdr                   *hdr;
 
 
-       CTASSERT(sizeof(header) <= PAGE_SIZE);
+       _Static_assert(sizeof(header) <= PAGE_SIZE, "header too big");
 
        if ((md = file_findmetadata(fp,
            MODINFOMD_NOCOPY | MODINFOMD_MB2HDR)) == NULL) {
diff --git a/stand/i386/libi386/multiboot.c b/stand/i386/libi386/multiboot.c
index e11da0444fcd..b69895de9706 100644
--- a/stand/i386/libi386/multiboot.c
+++ b/stand/i386/libi386/multiboot.c
@@ -165,7 +165,7 @@ multiboot_exec(struct preloaded_file *fp)
        int                              error, mod_num;
        struct xen_header                header;
 
-       CTASSERT(sizeof(header) <= PAGE_SIZE);
+       _Static_assert(sizeof(header) <= PAGE_SIZE, "header too large for 
page");
 
        /*
         * Don't pass the memory size found by the bootloader, the memory
diff --git a/stand/i386/loader/main.c b/stand/i386/loader/main.c
index 97c4448afdc3..8a3c1cbc6a42 100644
--- a/stand/i386/loader/main.c
+++ b/stand/i386/loader/main.c
@@ -51,14 +51,13 @@
 #include "libzfs.h"
 #endif
 
-CTASSERT(sizeof(struct bootargs) == BOOTARGS_SIZE);
-CTASSERT(offsetof(struct bootargs, bootinfo) == BA_BOOTINFO);
-CTASSERT(offsetof(struct bootargs, bootflags) == BA_BOOTFLAGS);
-CTASSERT(offsetof(struct bootinfo, bi_size) == BI_SIZE);
+_Static_assert(sizeof(struct bootargs) == BOOTARGS_SIZE, "Bootarg size bad");
+_Static_assert(offsetof(struct bootargs, bootinfo) == BA_BOOTINFO, 
"BA_BOOTINFO");
+_Static_assert(offsetof(struct bootargs, bootflags) == BA_BOOTFLAGS, 
"BA_BOOTFLAGS");
+_Static_assert(offsetof(struct bootinfo, bi_size) == BI_SIZE, "BI_SIZE");
 
 /* Arguments passed in from the boot1/boot2 loader */
 static struct bootargs *kargs;
-
 static uint32_t                initial_howto;
 static uint32_t                initial_bootdev;
 static struct bootinfo *initial_bootinfo;

Reply via email to