[libc-commits] [libc] [libc] Implement strftime (PR #111305)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Oct 23 11:30:59 PDT 2024


================
@@ -0,0 +1,39 @@
+//===-- Core Structures for printf ------------------------------*- 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_STDIO_STRFTIME_CORE_CORE_STRUCTS_H
+#define LLVM_LIBC_SRC_STDIO_STRFTIME_CORE_CORE_STRUCTS_H
+
+#include "src/__support/CPP/string_view.h"
+#include <time.h>
+
+namespace LIBC_NAMESPACE_DECL {
+namespace strftime_core {
+
+struct FormatSection {
+  bool has_conv{false};
+  bool isE{false};
+  bool isO{false};
+  cpp::string_view raw_string{};
+  char conv_name;
+  const struct tm *time;
+  int min_width{0};
+  char padding;
+};
+
+#define RET_IF_RESULT_NEGATIVE(func)                                           \
----------------
jhuber6 wrote:

Not a fan of macros like this, I don't think we have any others, but I get it being kind of annoying.

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


More information about the libc-commits mailing list