Skip to content

Commit 83ca0d1

Browse files
committed
Fix some clang compiler warnings.
1 parent 2d4655f commit 83ca0d1

15 files changed

+78
-59
lines changed

src/CMake/GlobalSettingsInclude.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,10 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
7878
add_compile_options(-Wno-c++98-compat-pedantic)
7979
add_compile_options(-Wno-cast-align)
8080
add_compile_options(-Wno-cast-qual)
81-
add_compile_options(-Wno-char-subscripts)
8281
add_compile_options(-Wno-covered-switch-default)
83-
add_compile_options(-Wno-deprecated-copy-with-dtor)
84-
add_compile_options(-Wno-documentation)
8582
add_compile_options(-Wno-exit-time-destructors)
8683
add_compile_options(-Wno-global-constructors)
8784
add_compile_options(-Wno-header-hygiene)
88-
add_compile_options(-Wno-implicit-fallthrough)
8985
add_compile_options(-Wno-implicit-int-conversion)
9086
add_compile_options(-Wno-implicit-int-float-conversion)
9187
add_compile_options(-Wno-inconsistent-missing-destructor-override)
@@ -101,7 +97,6 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
10197
add_compile_options(-Wno-switch-enum)
10298
add_compile_options(-Wno-tautological-type-limit-compare)
10399
add_compile_options(-Wno-tautological-undefined-compare)
104-
add_compile_options(-Wno-trigraphs)
105100
add_compile_options(-Wno-unused-parameter)
106101
add_compile_options(-Wno-unreachable-code-break)
107102
add_compile_options(-Wno-unreachable-code-return)

src/ct/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ if(MSVC)
180180
)
181181
endif()
182182

183-
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
183+
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
184184
source_file_compile_options(Cxx.cpp -Wno-char-subscripts)
185185
source_file_compile_options(CxxArea.cpp -Wno-char-subscripts)
186186
source_file_compile_options(CxxString.cpp -Wno-char-subscripts)

src/ct/CodeTypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ enum TypeSpecUser : unsigned int
341341
{
342342
TS_Unspecified, // default value
343343
TS_Definition, // data or function definition, distinct from declaration
344-
TS_Function, // function declaration
344+
TS_Function // function declaration
345345
};
346346

347347
//------------------------------------------------------------------------------

src/dip/MapAndUnits.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,14 @@ class MapAndUnits
343343
//
344344
~MapAndUnits() = default;
345345

346+
// Copy constructor.
347+
//
348+
MapAndUnits(const MapAndUnits& that) = default;
349+
350+
// Copy operator.
351+
//
352+
MapAndUnits& operator=(const MapAndUnits& that) = default;
353+
346354
// Used to implement process_mdf.
347355
//
348356
size_t process_powers(const TokenMessage& powers);

src/nb/AllocationException.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ class AllocationException : public Exception
4545
//
4646
~AllocationException();
4747

48+
// Copy constructor.
49+
//
50+
AllocationException(const AllocationException& that) = default;
51+
4852
// Overridden to display member variables.
4953
//
5054
void Display(std::ostream& stream, const std::string& prefix) const override;

src/nb/Allocators.h

Lines changed: 24 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,16 @@ template<typename T> struct DynamicAllocator
7676

7777
~DynamicAllocator() = default;
7878

79+
DynamicAllocator(const DynamicAllocator<T>& that) noexcept = default;
80+
7981
template<typename U> DynamicAllocator
8082
(const DynamicAllocator<U>& that) noexcept { }
8183

8284
template<typename U> bool operator==
83-
(const DynamicAllocator<U>& that) const noexcept
84-
{
85-
return true;
86-
}
85+
(const DynamicAllocator<U>& that) const noexcept { return true; }
8786

8887
template<typename U> bool operator!=
89-
(const DynamicAllocator<U>& that) const noexcept
90-
{
91-
return false;
92-
}
88+
(const DynamicAllocator<U>& that) const noexcept { return false; }
9389

9490
T* allocate(size_t n) const
9591
{
@@ -115,20 +111,16 @@ template<typename T> struct ImmutableAllocator
115111

116112
~ImmutableAllocator() = default;
117113

114+
ImmutableAllocator(const ImmutableAllocator<T>& that) noexcept = default;
115+
118116
template<typename U> ImmutableAllocator
119117
(const ImmutableAllocator<U>& that) noexcept { }
120118

121119
template<typename U> bool operator==
122-
(const ImmutableAllocator<U>& that) const noexcept
123-
{
124-
return true;
125-
}
120+
(const ImmutableAllocator<U>& that) const noexcept { return true; }
126121

127122
template<typename U> bool operator!=
128-
(const ImmutableAllocator<U>& that) const noexcept
129-
{
130-
return false;
131-
}
123+
(const ImmutableAllocator<U>& that) const noexcept { return false; }
132124

133125
T* allocate(size_t n) const
134126
{
@@ -154,20 +146,16 @@ template<typename T> struct PermanentAllocator
154146

155147
~PermanentAllocator() = default;
156148

149+
PermanentAllocator(const PermanentAllocator<T>& that) noexcept = default;
150+
157151
template<typename U> PermanentAllocator
158152
(const PermanentAllocator<U>& that) noexcept { }
159153

160154
template<typename U> bool operator==
161-
(const PermanentAllocator<U>& that) const noexcept
162-
{
163-
return true;
164-
}
155+
(const PermanentAllocator<U>& that) const noexcept { return true; }
165156

166157
template<typename U> bool operator!=
167-
(const PermanentAllocator<U>& that) const noexcept
168-
{
169-
return false;
170-
}
158+
(const PermanentAllocator<U>& that) const noexcept { return false; }
171159

172160
T* allocate(size_t n) const
173161
{
@@ -193,20 +181,16 @@ template<typename T> struct PersistentAllocator
193181

194182
~PersistentAllocator() = default;
195183

184+
PersistentAllocator(const PermanentAllocator<T>& that) noexcept = default;
185+
196186
template<typename U> PersistentAllocator
197187
(const PersistentAllocator<U>& that) noexcept { }
198188

199189
template<typename U> bool operator==
200-
(const PersistentAllocator<U>& that) const noexcept
201-
{
202-
return true;
203-
}
190+
(const PersistentAllocator<U>& that) const noexcept { return true; }
204191

205192
template<typename U> bool operator!=
206-
(const PersistentAllocator<U>& that) const noexcept
207-
{
208-
return false;
209-
}
193+
(const PersistentAllocator<U>& that) const noexcept { return false; }
210194

211195
T* allocate(size_t n) const
212196
{
@@ -232,20 +216,16 @@ template<typename T> struct ProtectedAllocator
232216

233217
~ProtectedAllocator() = default;
234218

219+
ProtectedAllocator(const ProtectedAllocator<T>& that) noexcept = default;
220+
235221
template<typename U> ProtectedAllocator
236222
(const ProtectedAllocator<U>& that) noexcept { }
237223

238224
template<typename U> bool operator==
239-
(const ProtectedAllocator<U>& that) const noexcept
240-
{
241-
return true;
242-
}
225+
(const ProtectedAllocator<U>& that) const noexcept { return true; }
243226

244227
template<typename U> bool operator!=
245-
(const ProtectedAllocator<U>& that) const noexcept
246-
{
247-
return false;
248-
}
228+
(const ProtectedAllocator<U>& that) const noexcept { return false; }
249229

250230
T* allocate(size_t n) const
251231
{
@@ -271,20 +251,16 @@ template<typename T> struct TemporaryAllocator
271251

272252
~TemporaryAllocator() = default;
273253

254+
TemporaryAllocator(const TemporaryAllocator<T>& that) noexcept = default;
255+
274256
template<typename U> TemporaryAllocator
275257
(const TemporaryAllocator<U>& that) noexcept { }
276258

277259
template<typename U> bool operator==
278-
(const TemporaryAllocator<U>& that) const noexcept
279-
{
280-
return true;
281-
}
260+
(const TemporaryAllocator<U>& that) const noexcept { return true; }
282261

283262
template<typename U> bool operator!=
284-
(const TemporaryAllocator<U>& that) const noexcept
285-
{
286-
return false;
287-
}
263+
(const TemporaryAllocator<U>& that) const noexcept { return false; }
288264

289265
T* allocate(size_t n) const
290266
{

src/nb/AssertionException.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ class AssertionException : public Exception
4343
//
4444
~AssertionException();
4545

46+
// Copy constructor.
47+
//
48+
AssertionException(const AssertionException& that) = default;
49+
4650
// Overridden to display member variables.
4751
//
4852
void Display(std::ostream& stream, const std::string& prefix) const override;

src/nb/Base.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ class Base
6060
//
6161
virtual ~Base() = default;
6262

63+
// Copy constructor.
64+
//
65+
Base(const Base& that) = default;
66+
67+
// Copy operator.
68+
//
69+
Base& operator=(const Base& that) = default;
70+
6371
// Displays the object in STREAM. The default version displays the
6472
// object's class name and its "this" pointer, using the typical form
6573
// for each member:

src/nb/ElementException.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ class ElementException : public Exception
4444
//
4545
~ElementException();
4646

47+
// Copy constructor.
48+
//
49+
ElementException(const ElementException& that) = default;
50+
4751
// Returns the severity of the restart.
4852
//
4953
RestartLevel Level() const { return level_; }

src/nb/NbAppIds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ enum ObjectPoolIds
5151
EventObjPoolId = 15,
5252
ServiceSMObjPoolId = 16,
5353
MediaEndptObjPoolId = 17,
54-
DipIpBufferObjPoolId = 18,
54+
DipIpBufferObjPoolId = 18
5555
};
5656

5757
//------------------------------------------------------------------------------

src/nb/Object.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ class Object : public Base
4545
//
4646
virtual ~Object() = default;
4747

48+
// Copy constructor.
49+
//
50+
Object(const Object& that) = default;
51+
52+
// Copy operator.
53+
//
54+
Object& operator=(const Object& that) = default;
55+
4856
// Selector for the Patch function.
4957
//
5058
typedef uint8_t sel_t;

src/nb/SignalException.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class SignalException : public Exception
4242
//
4343
~SignalException();
4444

45+
// Copy constructor.
46+
//
47+
SignalException(const SignalException& that) = default;
48+
4549
// Returns the signal that occurred.
4650
//
4751
signal_t GetSignal() const { return signal_; }

src/nb/SoftwareException.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ class SoftwareException : public Exception
4545
//
4646
virtual ~SoftwareException();
4747

48+
// Copy constructor.
49+
//
50+
SoftwareException(const SoftwareException& that) = default;
51+
4852
// Overridden to display member variables.
4953
//
5054
void Display(std::ostream& stream, const std::string& prefix) const override;

src/nb/StatisticsGroup.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ constexpr size_t MaxExplSize = 44;
4343
//
4444
static fixed_string ReportHeader = " Curr Prev All";
4545

46-
//<----------------group name----------------> Curr Prev All
47-
// <-------------member name---------------->
48-
// <---individual statistic explanation---> nnnnnnnnn nnnnnnnnn nnnnnnnnnnn
46+
//-----------------group name----------------- Curr Prev All
47+
// --------------member name-----------------
48+
// ----individual statistic explanation---- nnnnnnnnn nnnnnnnnn nnnnnnnnnnn
4949
// 1 2 3 4 5 6 7
5050
// 2 2 40. 9. 9. 11
5151

src/sb/Context.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ class SbException : public SoftwareException
8282
//
8383
~SbException();
8484

85+
// Copy constructor.
86+
//
87+
SbException(const SbException& that) = default;
88+
8589
// Overridden to display member variables.
8690
//
8791
void Display(ostream& stream, const string& prefix) const override;

0 commit comments

Comments
 (0)