[libc-commits] [libc] [libc] Template the printf / scanf parser class (PR #66277)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Thu Sep 14 10:28:16 PDT 2023
================
@@ -142,6 +148,439 @@ class Parser {
#endif // LIBC_COPT_PRINTF_DISABLE_INDEX_MODE
};
+#ifndef LIBC_COPT_PRINTF_DISABLE_INDEX_MODE
+#define WRITE_ARG_VAL_SIMPLEST(dst, arg_type, index) \
+ { \
+ auto temp = get_arg_value<arg_type>(index); \
+ if (!temp.has_value()) { \
+ section.has_conv = false; \
+ } else { \
+ dst = cpp::bit_cast<int_type_of_v<arg_type>>(temp.value()); \
+ } \
+ }
+#else
+#define WRITE_ARG_VAL_SIMPLEST(dst, arg_type, _) \
+ dst = cpp::bit_cast<int_type_of_v<arg_type>>(get_next_arg_value<arg_type>())
+#endif // LIBC_COPT_PRINTF_DISABLE_INDEX_MODE
+
+template <typename ArgProvider>
----------------
jhuber6 wrote:
I forgot to delete that, thanks for catching it.
https://github.com/llvm/llvm-project/pull/66277
More information about the libc-commits
mailing list