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

Rajveer Singh Bharadwaj via libc-commits libc-commits at lists.llvm.org
Mon Dec 2 23:57:34 PST 2024


================
@@ -0,0 +1,25 @@
+//===-- Implementation header of ctime_s ------------------------*- C++ -*-===//
+//
+// 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_SRC_TIME_CTIME_S_H
+#define LLVM_LIBC_SRC_TIME_CTIME_S_H
+
+#define __STDC_WANT_LIB_EXT1__ 1
+
+#include "hdr/types/rsize_t.h"
+#include "hdr/types/time_t.h"
+#include "src/__support/macros/config.h"
+#include "stdint.h"
----------------
Rajveer100 wrote:

It's indeed a full build:

```shell
ninja: Entering directory `build'
[3/5] Building CXX object libc/test/src/time/CMakeFiles/libc.test.src.time.ctime_s_test.__build__.dir/ctime_s_test.cpp.o
FAILED: libc/test/src/time/CMakeFiles/libc.test.src.time.ctime_s_test.__build__.dir/ctime_s_test.cpp.o 
/usr/bin/clang++-18 -DLIBC_NAMESPACE=__llvm_libc_20_0_0_git -I/cross-projects/llvm-project/llvm-project/libc -isystem /cross-projects/llvm-project/llvm-project/build/libc/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -std=gnu++17 -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -MD -MT libc/test/src/time/CMakeFiles/libc.test.src.time.ctime_s_test.__build__.dir/ctime_s_test.cpp.o -MF libc/test/src/time/CMakeFiles/libc.test.src.time.ctime_s_test.__build__.dir/ctime_s_test.cpp.o.d -o libc/test/src/time/CMakeFiles/libc.test.src.time.ctime_s_test.__build__.dir/ctime_s_test.cpp.o -c /cross-projects/llvm-project/llvm-project/libc/test/src/time/ctime_s_test.cpp
/cross-projects/llvm-project/llvm-project/libc/test/src/time/ctime_s_test.cpp:39:44: error: use of undeclared identifier 'RSIZE_MAX'
   39 |   result = LIBC_NAMESPACE::ctime_s(buffer, RSIZE_MAX + 1, &t);
      |                                            ^
1 error generated.
ninja: build stopped: subcommand failed.
```

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


More information about the libc-commits mailing list