-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[meson,common] Enable C23 and nodiscard feature when available
Signed-off-by: Mariusz Zaborski <oshogbo@invisiblethingslab.com>
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* SPDX-License-Identifier: LGPL-3.0-or-later */ | ||
/* Copyright (C) 2024 Intel Corporation | ||
* Mariusz Zaborski <oshogbo@invisiblethingslab.com> | ||
*/ | ||
|
||
/* | ||
* This file contains a definition for NODISCARD, a macro that wraps | ||
* the nodiscard attribute introduced in C23. However, because Gramine supports | ||
* older systems that might not have support for C23, we have to wrap it on our | ||
* own and change it to a no-op on systems that don't support it. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#if defined(__has_c_attribute) | ||
#if __has_c_attribute(nodiscard) | ||
#define NODISCARD [[nodiscard]] | ||
#endif | ||
#endif | ||
|
||
#ifndef NODISCARD | ||
#define NODISCARD | ||
#endif |
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