Skip to content

Commit 777a1c8

Browse files
committed
examples: fixed clang-tidy warnings
1 parent c35db14 commit 777a1c8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

examples/example_utils.hpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ inline void finalize() {
7979
#endif
8080
}
8181

82-
dnnl::engine::kind validate_engine_kind(dnnl::engine::kind akind) {
82+
inline dnnl::engine::kind validate_engine_kind(dnnl::engine::kind akind) {
8383
// Checking if a GPU exists on the machine
8484
if (akind == dnnl::engine::kind::gpu) {
8585
if (dnnl::engine::get_count(dnnl::engine::kind::gpu) == 0) {
@@ -94,6 +94,7 @@ dnnl::engine::kind validate_engine_kind(dnnl::engine::kind akind) {
9494
// Exception class to indicate that the example uses a feature that is not
9595
// available on the current systems. It is not treated as an error then, but
9696
// just notifies a user.
97+
// NOLINTNEXTLINE(readability-identifier-naming)
9798
struct example_allows_unimplemented : public std::exception {
9899
example_allows_unimplemented(const char *message) noexcept
99100
: message(message) {}
@@ -107,7 +108,7 @@ inline const char *engine_kind2str_upper(dnnl::engine::kind kind);
107108
// Returns `0` on success, `1` or oneDNN error, and `2` on example error.
108109
inline int handle_example_errors(
109110
std::initializer_list<dnnl::engine::kind> engine_kinds,
110-
std::function<void()> example) {
111+
const std::function<void()> &example) {
111112
int exit_code = 0;
112113

113114
try {

examples/graph/graph_example_utils.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ class simple_memory_pool_t {
535535
#endif
536536
ptr = sh_ptr.get();
537537
// record the map of mm size and its ptr for reuse
538-
map_size_ptr_.emplace(std::make_pair(size, sh_ptr));
538+
map_size_ptr_.emplace(size, sh_ptr);
539539
is_free_ptr_[ptr] = false;
540540
}
541541
return ptr;
@@ -566,7 +566,7 @@ class simple_memory_pool_t {
566566
= std::shared_ptr<void> {malloc(size), cpu_deletor_t {}};
567567
ptr = sh_ptr.get();
568568
// record the map of mm size and its ptr for reuse
569-
map_size_ptr_.emplace(std::make_pair(size, sh_ptr));
569+
map_size_ptr_.emplace(size, sh_ptr);
570570
is_free_ptr_[ptr] = false;
571571
}
572572
return ptr;

0 commit comments

Comments
 (0)