llvm-project/libc/include/errno.h.def
Victor Campos 27ba9e2a44
[libc] Define Annex K's errno_t in specified headers (#187700)
- Change `errno.h.def` to include a placeholder where hdrgen emits the
public API, which contains the `errno_t` definition.
- Make headers `stdio.h`, `stdlib.h`, `string.h` and `time.h` also
define `errno_t` as specified in the standard.
2026-03-25 12:30:19 +00:00

45 lines
912 B
Modula-2

//===-- C standard library header errno.h ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_ERRNO_H
#define LLVM_LIBC_ERRNO_H
#include "__llvm-libc-common.h"
#ifdef __linux__
#include <linux/errno.h>
#ifndef ENOTSUP
#define ENOTSUP EOPNOTSUPP
#endif // ENOTSUP
#include "llvm-libc-macros/linux/error-number-macros.h"
#elif defined(__APPLE__)
#include <sys/errno.h>
#else // __APPLE__
#include "llvm-libc-macros/generic-error-number-macros.h"
#endif
%%public_api()
__BEGIN_C_DECLS
int *__llvm_libc_errno(void) __NOEXCEPT;
__END_C_DECLS
#define errno (*__llvm_libc_errno())
#endif // LLVM_LIBC_ERRNO_H