[libc-commits] [libc] [libc] Add `ctime_s` (PR #110676)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Wed Jan 8 11:05:17 PST 2025


================
@@ -0,0 +1,23 @@
+//===-- Proxy for errno_t -------------------------------------------------===//
+//
+// 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_HDR_TYPES_ERRNO_T_H
+#define LLVM_LIBC_HDR_TYPES_ERRNO_T_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/errno_t.h"
+
+#else
+
+#define __need_errno_t
+#include <stddef.h>
+#undef __need_errno_t
----------------
nickdesaulniers wrote:

If you take a look at B.4 of the C standard (darft: https://www.open-std.org/jtc1/sc22/wg14/www/projects#9899):

```
Only if the implementation defines __STDC_LIB_EXT1__ and additionally the user code defines
__STDC_WANT_LIB_EXT1__ before any inclusion of <errno.h>:
errno_t
```

So this should be:
```suggestion
#define __STDC_WANT_LIB_EXT1__ 1
#include <errno.h>
```

https://github.com/llvm/llvm-project/pull/110676


More information about the libc-commits mailing list