-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cxx-qt-lib: Add const_assert for asserting at compile-time
This is needed to ensure the Rust-side QMessageLogContext struct has the expected size.
- Loading branch information
Showing
3 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-FileCopyrightText: 2025 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
// SPDX-FileContributor: Joshua Goins <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
/// Asserts that a boolean expression is true at compile time. | ||
/// | ||
/// See [`core::assert!`] for more information. | ||
/// | ||
/// ```compile_fail | ||
/// const_assert!(5 == 4); | ||
/// ``` | ||
#[macro_export] | ||
macro_rules! const_assert { | ||
($x:expr $(,)?) => { | ||
const _: () = ::core::assert!($x); | ||
}; | ||
} |