Files
vlibc/include/vlibc/features.h.in
T
huntedbytheirsandSisyphus 6854c7771d style(string): satisfy clang-tidy and clang-format for final-wave gate
Suppress clang-analyzer-security buffer-handling diagnostics on the
plan-mandated __builtin_memcpy word loads and bugprone swappable-
parameter diagnostics on the C-standard signatures; wrap the autoconf
substitution tokens in clang-format off/on (the space clang-format wants
before the closing @ would break config.status substitution).

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
2026-08-31 21:34:25 -04:00

61 lines
1.8 KiB
C

#ifndef VLIBC_FEATURES_H
#define VLIBC_FEATURES_H
/*
* vlibc — compatibility feature gate.
*
* This header is generated by configure from include/vlibc/features.h.in; do
* not edit the generated file. It exposes the active compatibility profile as
* build-time constants, so headers and sources can gate declarations on the
* profile level (see configure.ac and docs/compatibility.md):
*
* 1 onlyposix pure POSIX, nothing more
* 2 muslmimic musl-like, light
* 3 muslext musl-extended
* 4 spoof glibc replica (drop-in compatibility)
* 5 vlibc glibc-extended, the default
*
* VLIBC_LEVEL is the numeric level (1..5); VLIBC_PROFILE is the profile name.
* Both are emitted only when not already defined: the library's own sources
* include config.h first (via HAVE_CONFIG_H), whose values win, and this
* header skips the redefinition. Consumers of the installed header get the
* values baked in at configure time.
*/
/* clang-format off */
#ifndef VLIBC_LEVEL
#define VLIBC_LEVEL @vlibc_level@
#endif
#ifndef VLIBC_PROFILE
#define VLIBC_PROFILE "@vlibc_profile@"
#endif
/* clang-format on */
/* True when the active profile is at least level n. */
#define VLIBC_LEVEL_GE(n) (VLIBC_LEVEL >= (n))
/*
* Per-profile feature booleans, derived from VLIBC_LEVEL. Levels are
* cumulative: level 3 implies the POSIX and musl feature sets as well. A
* macro is defined (as 1) when its feature set is present and left undefined
* otherwise, so `#if VLIBC_HAS_MUSL` works in both cases.
*/
#if VLIBC_LEVEL >= 1
#define VLIBC_HAS_POSIX 1
#endif
#if VLIBC_LEVEL >= 2
#define VLIBC_HAS_MUSL 1
#endif
#if VLIBC_LEVEL >= 3
#define VLIBC_HAS_MUSLEXT 1
#endif
#if VLIBC_LEVEL >= 4
#define VLIBC_HAS_GLIBC 1
#endif
#if VLIBC_LEVEL >= 5
#define VLIBC_HAS_VLIBC 1
#endif
#endif /* VLIBC_FEATURES_H */