Skip to content

Commit b30baaf

Browse files
vpirogovatkassen
andcommitted
src: common: addressed clang-tidy warnings
Co-authored-by: Andy Kassen <andrew.kassen@intel.com>
1 parent 0eafb1b commit b30baaf

16 files changed

+163
-165
lines changed

src/common/concat_pd.hpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ struct concat_pd_t : public primitive_desc_t {
112112
init_desc();
113113
}
114114

115-
concat_pd_t(const concat_pd_t &other) : primitive_desc_t(other) {
116-
n_ = other.n_;
117-
concat_dim_ = other.concat_dim_;
118-
dst_md_ = other.dst_md_;
119-
original_dst_ = other.original_dst_;
120-
src_mds_ = other.src_mds_;
121-
src_image_mds_ = other.src_image_mds_;
122-
115+
concat_pd_t(const concat_pd_t &other)
116+
: primitive_desc_t(other)
117+
, n_(other.n_)
118+
, concat_dim_(other.concat_dim_)
119+
, dst_md_(other.dst_md_)
120+
, original_dst_(other.original_dst_)
121+
, src_mds_(other.src_mds_)
122+
, src_image_mds_(other.src_image_mds_) {
123123
init_desc();
124124
}
125125

src/common/float16.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright 2019-2024 Intel Corporation
2+
* Copyright 2019-2025 Intel Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ struct float16_t {
3939
float16_t &operator=(float f);
4040

4141
operator float() const;
42-
float f() { return (float)(*this); }
42+
float f() const { return (float)(*this); }
4343

4444
float16_t &operator+=(float16_t a) {
4545
(*this) = float(f() + a.f());

src/common/gemm_types.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright 2019-2024 Intel Corporation
2+
* Copyright 2019-2025 Intel Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -57,10 +57,10 @@ struct gemm_desc_t : public op_desc_t {
5757
return utils::make_unique<gemm_desc_t>(*this);
5858
}
5959

60-
memory_desc_t a_desc {};
61-
memory_desc_t b_desc {};
62-
memory_desc_t c_desc {};
63-
memory_desc_t bias_desc {};
60+
memory_desc_t a_desc;
61+
memory_desc_t b_desc;
62+
memory_desc_t c_desc;
63+
memory_desc_t bias_desc;
6464
// Type for accumulating A*B.
6565
dnnl_data_type_t acc_type {};
6666
// Sum across k dimension in either A or B tensor

src/common/ittnotify.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ namespace dnnl {
2424
namespace impl {
2525
namespace itt {
2626

27-
typedef enum {
27+
// GCC treats using and typedef differently for enums and structs
28+
// https://stackoverflow.com/questions/48613758
29+
typedef enum { // NOLINT(modernize-use-using)
2830
__itt_task_level_none = 0,
2931
__itt_task_level_low,
3032
__itt_task_level_high

src/common/memory_desc_wrapper.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ namespace impl {
3434

3535
/** thin wrapper class over \struct memory_desc_t which allows easy
3636
* manipulations with underlying C structure, which is taken by reference */
37+
// NOLINTNEXTLINE(readability-identifier-naming)
3738
struct memory_desc_wrapper : public c_compatible {
3839
const memory_desc_t *md_;
3940

src/common/memory_tracking.hpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,9 @@ struct registry_t {
428428
public:
429429
common_iterator_t(const void *base_ptr_,
430430
const std::unordered_map<key_t, entry_t> &map,
431-
bool is_begin = true) {
432-
base_ptr = base_ptr_;
433-
if (is_begin) {
434-
iter = map.cbegin();
435-
} else {
431+
bool is_begin = true)
432+
: base_ptr(base_ptr_)
433+
, iter(is_begin ? map.cbegin() : map.cend()) {}
436434
iter = map.cend();
437435
}
438436
}

src/common/nstl.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void *malloc(size_t size, int alignment);
5555
#endif
5656
void free(void *p);
5757

58-
struct c_compatible {
58+
struct c_compatible { // NOLINT(readability-identifier-naming)
5959
enum { default_alignment = 64 };
6060
static void *operator new(size_t sz) {
6161
return MALLOC(sz, default_alignment);

0 commit comments

Comments
 (0)