1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:38:13 +00:00

LibC: Don't export ALWAYS_INLINE from sys/cdefs.h

POSIX doesn't tell us to export a macro like this, and it's largely
going to never be defined when compiling a serenity-native C++ file,
since AK defines it already.

This does raise a strange issue where some futex-related helpers in
serenity.h are declared with ALWAYS_INLINE. Whether these helpers belong
in a C-visible header as file-static methods is questionable, but let's
work around the issue but adding some preprocessor magic to make sure
these declarations get the behavior they used to have without leaking
macros.
This commit is contained in:
Andrew Kaster 2022-02-28 18:48:32 -07:00 committed by Brian Gianforcaro
parent 8dd08a1103
commit fcb64311dc
2 changed files with 9 additions and 4 deletions

View file

@ -22,6 +22,11 @@ int profiling_free_buffer(pid_t);
int futex(uint32_t* userspace_address, int futex_op, uint32_t value, const struct timespec* timeout, uint32_t* userspace_address2, uint32_t value3);
#ifndef ALWAYS_INLINE
# define ALWAYS_INLINE inline __attribute__((always_inline))
# define ALWAYS_INLINE_SERENITY_H
#endif
static ALWAYS_INLINE int futex_wait(uint32_t* userspace_address, uint32_t value, const struct timespec* abstime, int clockid)
{
int op;
@ -42,6 +47,10 @@ static ALWAYS_INLINE int futex_wake(uint32_t* userspace_address, uint32_t count)
return futex(userspace_address, FUTEX_WAKE, count, NULL, NULL, 0);
}
#ifdef ALWAYS_INLINE_SERENITY_H
# undef ALWAYS_INLINE
#endif
int purge(int mode);
int perf_event(int type, uintptr_t arg1, uintptr_t arg2);

View file

@ -8,10 +8,6 @@
#define _POSIX_VERSION 200809L
#ifndef ALWAYS_INLINE
# define ALWAYS_INLINE inline __attribute__((always_inline))
#endif
#ifdef __cplusplus
# ifndef __BEGIN_DECLS
# define __BEGIN_DECLS extern "C" {