Skip to content

Achieve C90 compliance and test in CI#12

Merged
mjosaarinen merged 4 commits into
mainfrom
ci-c90
Jul 15, 2025
Merged

Achieve C90 compliance and test in CI#12
mjosaarinen merged 4 commits into
mainfrom
ci-c90

Conversation

@mkannwischer

@mkannwischer mkannwischer commented Jun 19, 2025

Copy link
Copy Markdown
Contributor

@mkannwischer

mkannwischer commented Jun 19, 2025

Copy link
Copy Markdown
Contributor Author

First step would be to replace inline by SLH_INLINE and create a sys.h (or similar) that defines it.

In mlkem-native we are using

/*
 * C90 does not have the inline compiler directive yet.
 * We don't use it in C90 builds.
 * However, in that case the compiler warns about some inline functions in
 * header files not being used in every compilation unit that includes that
 * header. To work around it we silence that warning in that case using
 * __attribute__((unused)).
 */

/* Do not use inline for C90 builds*/
#if !defined(MLK_INLINE)
#if !defined(inline)
#if defined(_MSC_VER)
#define MLK_INLINE __inline
/* Don't combine __inline and __forceinline */
#define MLK_ALWAYS_INLINE __forceinline
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define MLK_INLINE inline
#define MLK_ALWAYS_INLINE MLK_INLINE __attribute__((always_inline))
#else
#define MLK_INLINE __attribute__((unused))
#define MLK_ALWAYS_INLINE MLK_INLINE
#endif

#else /* !inline */
#define MLK_INLINE inline
#define MLK_ALWAYS_INLINE MLK_INLINE __attribute__((always_inline))
#endif /* inline */
#endif /* !MLK_INLINE */

@mkannwischer mkannwischer changed the title CI: Add C90 tests in CI Achieve C90 compliance and test in CI Jun 30, 2025
@mkannwischer

Copy link
Copy Markdown
Contributor Author

We need to work on the speed of these tests. I want to avoid requiring parallel for basic testing. basic tests should work without installing dependencies.

Resolves #9

Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
@mkannwischer mkannwischer force-pushed the ci-c90 branch 2 times, most recently from 1c438a0 to 1073ad3 Compare July 11, 2025 13:04
snprintf was only standardized in C99, sadly.

Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
@mkannwischer mkannwischer marked this pull request as ready for review July 11, 2025 13:34
Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
@mjosaarinen mjosaarinen requested review from mjosaarinen and removed request for mjosaarinen July 15, 2025 07:38

@mjosaarinen mjosaarinen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all looks good.

@mjosaarinen mjosaarinen merged commit d3bb681 into main Jul 15, 2025
16 checks passed
@mjosaarinen mjosaarinen deleted the ci-c90 branch July 15, 2025 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: Test C90 compliance in CI

2 participants