summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
author Stefano Cianciulli <scianciulli@google.com> 2023-05-16 10:32:54 +0000
committer Stefano Cianciulli <scianciulli@google.com> 2023-05-22 10:36:39 +0000
commit78f3c72e8948087352788997a70854dee613352c (patch)
tree306db3c15bc4b7af149bcf3e07be533e50679b88 /cmdline
parentdc771261232c2ff702373f396a5a7fe586e2f0a6 (diff)
Use C++17's [[maybe_unused]] attribute in ART
Bug: 169680875 Test: mmm art Change-Id: Ic0cc320891c42b07a2b5520a584d2b62052e7235
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/cmdline.h10
-rw-r--r--cmdline/cmdline_parser_test.cc13
-rw-r--r--cmdline/cmdline_type_parser.h6
-rw-r--r--cmdline/token_range.h2
4 files changed, 15 insertions, 16 deletions
diff --git a/cmdline/cmdline.h b/cmdline/cmdline.h
index b8ca7d0efc..2108a7a172 100644
--- a/cmdline/cmdline.h
+++ b/cmdline/cmdline.h
@@ -321,15 +321,13 @@ struct CmdlineArgs {
}
protected:
- virtual ParseStatus ParseCustom(const char* raw_option ATTRIBUTE_UNUSED,
- size_t raw_option_length ATTRIBUTE_UNUSED,
- std::string* error_msg ATTRIBUTE_UNUSED) {
+ virtual ParseStatus ParseCustom([[maybe_unused]] const char* raw_option,
+ [[maybe_unused]] size_t raw_option_length,
+ [[maybe_unused]] std::string* error_msg) {
return kParseUnknownArgument;
}
- virtual ParseStatus ParseChecks(std::string* error_msg ATTRIBUTE_UNUSED) {
- return kParseOk;
- }
+ virtual ParseStatus ParseChecks([[maybe_unused]] std::string* error_msg) { return kParseOk; }
};
template <typename Args = CmdlineArgs>
diff --git a/cmdline/cmdline_parser_test.cc b/cmdline/cmdline_parser_test.cc
index effbee93c7..4d53857a09 100644
--- a/cmdline/cmdline_parser_test.cc
+++ b/cmdline/cmdline_parser_test.cc
@@ -75,12 +75,13 @@ namespace art {
// that are nevertheless equal.
// If a test is failing because the structs aren't "equal" when they really are
// then it's recommended to implement operator== for it instead.
- template <typename T, typename ... Ignore>
- bool UsuallyEquals(const T& expected, const T& actual,
- const Ignore& ... more ATTRIBUTE_UNUSED,
- typename std::enable_if<std::is_pod<T>::value>::type* = nullptr,
- typename std::enable_if<!detail::SupportsEqualityOperator<T>::value>::type* = nullptr
- ) {
+ template <typename T, typename... Ignore>
+ bool UsuallyEquals(
+ const T& expected,
+ const T& actual,
+ [[maybe_unused]] const Ignore&... more,
+ typename std::enable_if<std::is_pod<T>::value>::type* = nullptr,
+ typename std::enable_if<!detail::SupportsEqualityOperator<T>::value>::type* = nullptr) {
return memcmp(std::addressof(expected), std::addressof(actual), sizeof(T)) == 0;
}
diff --git a/cmdline/cmdline_type_parser.h b/cmdline/cmdline_type_parser.h
index 82a76f4ad9..10e28f3f59 100644
--- a/cmdline/cmdline_type_parser.h
+++ b/cmdline/cmdline_type_parser.h
@@ -34,7 +34,7 @@ struct CmdlineTypeParser {
//
// e.g. if the argument definition was "foo:_", and the user-provided input was "foo:bar",
// then args is "bar".
- Result Parse(const std::string& args ATTRIBUTE_UNUSED) {
+ Result Parse([[maybe_unused]] const std::string& args) {
assert(false);
return Result::Failure("Missing type specialization and/or value map");
}
@@ -46,8 +46,8 @@ struct CmdlineTypeParser {
//
// If the initial value does not exist yet, a default value is created by
// value-initializing with 'T()'.
- Result ParseAndAppend(const std::string& args ATTRIBUTE_UNUSED,
- T& existing_value ATTRIBUTE_UNUSED) {
+ Result ParseAndAppend([[maybe_unused]] const std::string& args,
+ [[maybe_unused]] T& existing_value) {
assert(false);
return Result::Failure("Missing type specialization and/or value map");
}
diff --git a/cmdline/token_range.h b/cmdline/token_range.h
index e917e1d6d0..f662ca6df9 100644
--- a/cmdline/token_range.h
+++ b/cmdline/token_range.h
@@ -55,7 +55,7 @@ struct TokenRange {
#if 0
// Copying-from-vector constructor.
- TokenRange(const TokenList& token_list ATTRIBUTE_UNUSED,
+ TokenRange([[maybe_unused]] const TokenList& token_list,
TokenList::const_iterator it_begin,
TokenList::const_iterator it_end)
: token_list_(new TokenList(it_begin, it_end)),