[libcxx-commits] [PATCH] D153301: [libc++] Add missing [[maybe_unused]] attribute in format tests
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jun 19 11:40:52 PDT 2023
ldionne created this revision.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Otherwise, Clang complains about format_ctx being unused in the tests
when exceptions are disabled in Freestanding mode. I don't know why it
doesn't complain not in freestanding mode.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D153301
Files:
libcxx/test/std/utilities/format/format.range/format.range.fmtdef/format.pass.cpp
libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.pass.cpp
libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.pass.cpp
libcxx/test/std/utilities/format/format.range/format.range.formatter/format.pass.cpp
libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
Index: libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
===================================================================
--- libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
+++ libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
@@ -78,8 +78,9 @@
std::pair<parse_call_validator, parse_call_validator> arg;
String result;
- OutIt out = std::back_inserter(result);
- FormatCtxT format_ctx = test_format_context_create<OutIt, CharT>(out, std::make_format_args<FormatCtxT>(arg));
+ OutIt out = std::back_inserter(result);
+ [[maybe_unused]] FormatCtxT format_ctx =
+ test_format_context_create<OutIt, CharT>(out, std::make_format_args<FormatCtxT>(arg));
{ // parse not called
[[maybe_unused]] const std::formatter<decltype(arg), CharT> formatter;
Index: libcxx/test/std/utilities/format/format.range/format.range.formatter/format.pass.cpp
===================================================================
--- libcxx/test/std/utilities/format/format.range/format.range.formatter/format.pass.cpp
+++ libcxx/test/std/utilities/format/format.range/format.range.formatter/format.pass.cpp
@@ -78,8 +78,9 @@
std::vector<parse_call_validator> arg{1};
String result;
- OutIt out = std::back_inserter(result);
- FormatCtxT format_ctx = test_format_context_create<OutIt, CharT>(out, std::make_format_args<FormatCtxT>(arg));
+ OutIt out = std::back_inserter(result);
+ [[maybe_unused]] FormatCtxT format_ctx =
+ test_format_context_create<OutIt, CharT>(out, std::make_format_args<FormatCtxT>(arg));
{ // parse not called
[[maybe_unused]] const std::range_formatter<parse_call_validator, CharT> formatter;
Index: libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.pass.cpp
===================================================================
--- libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.pass.cpp
+++ libcxx/test/std/utilities/format/format.range/format.range.fmtset/format.pass.cpp
@@ -77,8 +77,9 @@
std::set<parse_call_validator> arg{parse_call_validator{}};
String result;
- OutIt out = std::back_inserter(result);
- FormatCtxT format_ctx = test_format_context_create<OutIt, CharT>(out, std::make_format_args<FormatCtxT>(arg));
+ OutIt out = std::back_inserter(result);
+ [[maybe_unused]] FormatCtxT format_ctx =
+ test_format_context_create<OutIt, CharT>(out, std::make_format_args<FormatCtxT>(arg));
{ // parse not called
[[maybe_unused]] const std::formatter<decltype(arg), CharT> formatter;
Index: libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.pass.cpp
===================================================================
--- libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.pass.cpp
+++ libcxx/test/std/utilities/format/format.range/format.range.fmtmap/format.pass.cpp
@@ -77,8 +77,9 @@
std::map<parse_call_validator, parse_call_validator> arg{{parse_call_validator{}, parse_call_validator{}}};
String result;
- OutIt out = std::back_inserter(result);
- FormatCtxT format_ctx = test_format_context_create<OutIt, CharT>(out, std::make_format_args<FormatCtxT>(arg));
+ OutIt out = std::back_inserter(result);
+ [[maybe_unused]] FormatCtxT format_ctx =
+ test_format_context_create<OutIt, CharT>(out, std::make_format_args<FormatCtxT>(arg));
{ // parse not called
[[maybe_unused]] const std::formatter<decltype(arg), CharT> formatter;
Index: libcxx/test/std/utilities/format/format.range/format.range.fmtdef/format.pass.cpp
===================================================================
--- libcxx/test/std/utilities/format/format.range/format.range.fmtdef/format.pass.cpp
+++ libcxx/test/std/utilities/format/format.range/format.range.fmtdef/format.pass.cpp
@@ -74,8 +74,9 @@
std::array<parse_call_validator, 2> arg;
String result;
- OutIt out = std::back_inserter(result);
- FormatCtxT format_ctx = test_format_context_create<OutIt, CharT>(out, std::make_format_args<FormatCtxT>(arg));
+ OutIt out = std::back_inserter(result);
+ [[maybe_unused]] FormatCtxT format_ctx =
+ test_format_context_create<OutIt, CharT>(out, std::make_format_args<FormatCtxT>(arg));
{ // parse not called
[[maybe_unused]] const std::formatter<decltype(arg), CharT> formatter;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153301.532724.patch
Type: text/x-patch
Size: 4387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230619/1f16dd72/attachment.bin>
More information about the libcxx-commits
mailing list