gramineproject / gramine

A library OS for Linux multi-process applications, with Intel SGX support
GNU Lesser General Public License v3.0
587 stars 193 forks source link

Enable C23 when available and nodiscard feature #1879

Closed oshogbo closed 3 months ago

oshogbo commented 4 months ago

Description of the changes

Change the build system to use C23 or C2x (the experimental version of C23 used before the official release). We plan to convert functions to return pal_error_t instead of int. This will be implemented in separate commits, each making small, incremental changes.

This commit is done also to enforce a new policy on a new code.

Why __has_c_attribute

The __has_c_attribute is used to check the availability of new attributes. It was added simultaneously with nodiscard in the experimental version: https://gcc.gnu.org/gcc-11/changes.html.

Documentation for __has_c_attribute can be found at: https://en.cppreference.com/w/c/language/attributes.

How to test this PR?

CI.


This change is Reviewable