diff --git a/build/test/test b/build/test/test new file mode 100644 index 00000000..50a6f636 --- /dev/null +++ b/build/test/test @@ -0,0 +1 @@ +there must be something here \ No newline at end of file diff --git a/build/test/test-file b/build/test/test-file new file mode 100644 index 00000000..2810a093 --- /dev/null +++ b/build/test/test-file @@ -0,0 +1 @@ +Don't panic! \ No newline at end of file diff --git a/fmt/format.h b/fmt/format.h index b2645b63..27155241 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -1405,14 +1405,16 @@ constexpr uint64_t make_type() { return 0; } // Maximum number of arguments with packed types. enum { MAX_PACKED_ARGS = 16 }; +} // namespace internal template class format_arg_store { private: static const size_t NUM_ARGS = sizeof...(Args); - static const bool PACKED = NUM_ARGS <= MAX_PACKED_ARGS; + static const bool PACKED = NUM_ARGS <= internal::MAX_PACKED_ARGS; - typedef typename std::conditional::type value_type; + typedef typename std::conditional< + PACKED, internal::Value, internal::Arg>::type value_type; // If the arguments are not packed, add one more element to mark the end. std::array data_; @@ -1421,11 +1423,11 @@ class format_arg_store { friend format_arg_store make_format_args(const A & ... args); public: - static const uint64_t TYPES = make_type(); + static const uint64_t TYPES = internal::make_type(); template format_arg_store(const Args &... args, Formatter *) - : data_{{MakeValue(args)...}} {} + : data_{{internal::MakeValue(args)...}} {} const value_type *data() const { return data_.data(); } }; @@ -1435,7 +1437,6 @@ inline format_arg_store make_format_args(const Args & ... args) { Formatter *f = nullptr; return format_arg_store(args..., f); } -} // namespace internal /** Formatting arguments. */ class format_args { @@ -1470,7 +1471,7 @@ class format_args { format_args() : types_(0) {} template - format_args(const internal::format_arg_store &store) + format_args(const format_arg_store &store) : types_(store.TYPES) { set_data(store.data()); } @@ -2184,7 +2185,7 @@ class BasicFormatter : private internal::FormatterBase { # define FMT_VARIADIC_VOID(func, arg_type) \ template \ void func(arg_type arg0, const Args & ... args) { \ - auto store = fmt::internal::make_format_args< fmt::BasicFormatter >(args...); \ + auto store = fmt::make_format_args< fmt::BasicFormatter >(args...); \ func(arg0, fmt::format_args(store)); \ } @@ -2192,7 +2193,7 @@ class BasicFormatter : private internal::FormatterBase { # define FMT_VARIADIC_CTOR(ctor, func, arg0_type, arg1_type) \ template \ ctor(arg0_type arg0, arg1_type arg1, const Args & ... args) { \ - auto store = internal::make_format_args< fmt::BasicFormatter >(args...); \ + auto store = fmt::make_format_args< fmt::BasicFormatter >(args...); \ func(arg0, arg1, fmt::format_args(store)); \ } @@ -3128,7 +3129,7 @@ template inline void print_colored(Color c, CStringRef format_str, const Args & ... args) { vprint_colored(c, format_str, - internal::make_format_args>(args...)); + make_format_args>(args...)); } inline std::string vformat(CStringRef format_str, format_args args) { @@ -3148,8 +3149,7 @@ inline std::string vformat(CStringRef format_str, format_args args) { */ template inline std::string format(CStringRef format_str, const Args & ... args) { - auto vargs = internal::make_format_args>(args...); - return vformat(format_str, vargs); + return vformat(format_str, make_format_args>(args...)); } inline std::wstring vformat(WCStringRef format_str, format_args args) { @@ -3160,7 +3160,7 @@ inline std::wstring vformat(WCStringRef format_str, format_args args) { template inline std::wstring format(WCStringRef format_str, const Args & ... args) { - auto vargs = internal::make_format_args>(args...); + auto vargs = make_format_args>(args...); return vformat(format_str, vargs); } @@ -3177,8 +3177,7 @@ FMT_API void vprint(std::FILE *f, CStringRef format_str, format_args args); */ template inline void print(std::FILE *f, CStringRef format_str, const Args & ... args) { - vprint(f, format_str, - internal::make_format_args>(args...)); + vprint(f, format_str, make_format_args>(args...)); } FMT_API void vprint(CStringRef format_str, format_args args); @@ -3194,7 +3193,7 @@ FMT_API void vprint(CStringRef format_str, format_args args); */ template inline void print(CStringRef format_str, const Args & ... args) { - vprint(format_str, internal::make_format_args>(args...)); + vprint(format_str, make_format_args>(args...)); } /** diff --git a/fmt/ostream.h b/fmt/ostream.h index 89b4b872..259bc3e1 100644 --- a/fmt/ostream.h +++ b/fmt/ostream.h @@ -100,8 +100,7 @@ FMT_API void vprint(std::ostream &os, CStringRef format_str, format_args args); template inline void print(std::ostream &os, CStringRef format_str, const Args & ... args) { - vprint(os, format_str, - internal::make_format_args>(args...)); + vprint(os, format_str, make_format_args>(args...)); } } // namespace fmt diff --git a/fmt/posix.h b/fmt/posix.h index 78e72050..18d14de2 100644 --- a/fmt/posix.h +++ b/fmt/posix.h @@ -172,8 +172,7 @@ public: template inline void print(CStringRef format_str, const Args & ... args) { - vprint(format_str, - internal::make_format_args>(args...)); + vprint(format_str, make_format_args>(args...)); } }; diff --git a/fmt/printf.h b/fmt/printf.h index 3d5507cd..47f71c9b 100644 --- a/fmt/printf.h +++ b/fmt/printf.h @@ -506,8 +506,7 @@ inline std::string vsprintf(CStringRef format, format_args args) { */ template inline std::string sprintf(CStringRef format_str, const Args & ... args) { - auto vargs = internal::make_format_args>(args...); - return vsprintf(format_str, vargs); + return vsprintf(format_str, make_format_args>(args...)); } inline std::wstring vsprintf(WCStringRef format, format_args args) { @@ -518,7 +517,7 @@ inline std::wstring vsprintf(WCStringRef format, format_args args) { template inline std::wstring sprintf(WCStringRef format_str, const Args & ... args) { - auto vargs = internal::make_format_args>(args...); + auto vargs = make_format_args>(args...); return vsprintf(format_str, vargs); } @@ -535,7 +534,7 @@ FMT_API int vfprintf(std::FILE *f, CStringRef format, format_args args); */ template inline int fprintf(std::FILE *f, CStringRef format_str, const Args & ... args) { - auto vargs = internal::make_format_args>(args...); + auto vargs = make_format_args>(args...); return vfprintf(f, format_str, vargs); } @@ -554,8 +553,7 @@ inline int vprintf(CStringRef format, format_args args) { */ template inline int printf(CStringRef format_str, const Args & ... args) { - auto vargs = internal::make_format_args>(args...); - return vprintf(format_str, vargs); + return vprintf(format_str, make_format_args>(args...)); } inline int vfprintf(std::ostream &os, CStringRef format_str, format_args args) { @@ -577,7 +575,7 @@ inline int vfprintf(std::ostream &os, CStringRef format_str, format_args args) { template inline int fprintf(std::ostream &os, CStringRef format_str, const Args & ... args) { - auto vargs = internal::make_format_args>(args...); + auto vargs = make_format_args>(args...); return vfprintf(os, format_str, vargs); } } // namespace fmt diff --git a/test/custom-formatter-test.cc b/test/custom-formatter-test.cc index 2bcc1d65..32ea166e 100644 --- a/test/custom-formatter-test.cc +++ b/test/custom-formatter-test.cc @@ -45,7 +45,7 @@ class CustomPrintfArgFormatter : } }; -std::string vcustom_format(const char *format_str, fmt::format_args args) { +std::string custom_vformat(const char *format_str, fmt::format_args args) { fmt::MemoryWriter writer; // Pass custom argument formatter as a template arg to BasicFormatter. fmt::BasicFormatter formatter(args, writer); @@ -55,11 +55,11 @@ std::string vcustom_format(const char *format_str, fmt::format_args args) { template std::string custom_format(const char *format_str, const Args & ... args) { - auto va = fmt::internal::make_format_args>(args...); - return vcustom_format(format_str, va); + auto va = fmt::make_format_args>(args...); + return custom_vformat(format_str, va); } -std::string vcustom_sprintf(const char* format_str, fmt::format_args args) { +std::string custom_vsprintf(const char* format_str, fmt::format_args args) { fmt::MemoryWriter writer; fmt::PrintfFormatter formatter(args, writer); formatter.format(format_str); @@ -68,8 +68,8 @@ std::string vcustom_sprintf(const char* format_str, fmt::format_args args) { template std::string custom_sprintf(const char *format_str, const Args & ... args) { - auto va = fmt::internal::make_format_args>(args...); - return vcustom_sprintf(format_str, va); + auto va = fmt::make_format_args>(args...); + return custom_vsprintf(format_str, va); } TEST(CustomFormatterTest, Format) { diff --git a/test/format-test.cc b/test/format-test.cc index fef96b1f..e5dcede5 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1572,7 +1572,7 @@ std::string vformat_message(int id, const char *format, fmt::format_args args) { template std::string format_message(int id, const char *format, const Args & ... args) { - auto va = fmt::internal::make_format_args>(args...); + auto va = fmt::make_format_args>(args...); return vformat_message(id, format, va); } @@ -1654,7 +1654,7 @@ void vcustom_format(const char *format_str, fmt::format_args args) { template void custom_format(const char *format_str, const Args & ... args) { - auto va = fmt::internal::make_format_args>(args...); + auto va = fmt::make_format_args>(args...); return vcustom_format(format_str, va); }