*: add lots of "noexcept" specifications

This commit is contained in:
Max Kellermann 2017-06-04 13:09:11 +02:00
parent 979f1b6c39
commit ae713cb099
9 changed files with 20 additions and 20 deletions

View File

@ -24,7 +24,7 @@
#include "util/AllocatedString.hxx" #include "util/AllocatedString.hxx"
TagMask TagMask
Response::GetTagMask() const Response::GetTagMask() const noexcept
{ {
return GetClient().tag_mask; return GetClient().tag_mask;
} }

View File

@ -66,7 +66,7 @@ public:
* to avoid including Client.hxx. * to avoid including Client.hxx.
*/ */
gcc_pure gcc_pure
TagMask GetTagMask() const; TagMask GetTagMask() const noexcept;
void SetCommand(const char *_command) { void SetCommand(const char *_command) {
command = _command; command = _command;

View File

@ -61,7 +61,7 @@ IsValidPartitionChar(char ch)
gcc_pure gcc_pure
static bool static bool
IsValidPartitionName(const char *name) IsValidPartitionName(const char *name) noexcept
{ {
do { do {
if (!IsValidPartitionChar(*name)) if (!IsValidPartitionChar(*name))
@ -73,7 +73,7 @@ IsValidPartitionName(const char *name)
gcc_pure gcc_pure
static bool static bool
HasPartitionNamed(Instance &instance, const char *name) HasPartitionNamed(Instance &instance, const char *name) noexcept
{ {
return instance.FindPartition(name) != nullptr; return instance.FindPartition(name) != nullptr;
} }

View File

@ -53,7 +53,7 @@ StaticSocketAddress::operator=(SocketAddress other) noexcept
#ifdef HAVE_TCP #ifdef HAVE_TCP
bool bool
StaticSocketAddress::SetPort(unsigned port) StaticSocketAddress::SetPort(unsigned port) noexcept
{ {
switch (GetFamily()) { switch (GetFamily()) {
case AF_INET: case AF_INET:

View File

@ -96,7 +96,7 @@ public:
* Extract the port number. Returns 0 if not applicable. * Extract the port number. Returns 0 if not applicable.
*/ */
gcc_pure gcc_pure
unsigned GetPort() const { unsigned GetPort() const noexcept {
return ((SocketAddress)*this).GetPort(); return ((SocketAddress)*this).GetPort();
} }
@ -104,7 +104,7 @@ public:
* @return true on success, false if this address cannot have * @return true on success, false if this address cannot have
* a port number * a port number
*/ */
bool SetPort(unsigned port); bool SetPort(unsigned port) noexcept;
#endif #endif
gcc_pure gcc_pure

View File

@ -61,7 +61,7 @@ ConstructS24(uint8_t low, uint8_t mid, uint8_t high)
*/ */
gcc_pure gcc_pure
static int32_t static int32_t
ReadS24LE(const uint8_t *src) ReadS24LE(const uint8_t *src) noexcept
{ {
return ConstructS24(src[0], src[1], src[2]); return ConstructS24(src[0], src[1], src[2]);
} }
@ -71,7 +71,7 @@ ReadS24LE(const uint8_t *src)
*/ */
gcc_pure gcc_pure
static int32_t static int32_t
ReadS24BE(const uint8_t *src) ReadS24BE(const uint8_t *src) noexcept
{ {
return ConstructS24(src[2], src[1], src[0]); return ConstructS24(src[2], src[1], src[0]);
} }
@ -81,7 +81,7 @@ ReadS24BE(const uint8_t *src)
*/ */
gcc_pure gcc_pure
static int32_t static int32_t
ReadS24(const uint8_t *src) ReadS24(const uint8_t *src) noexcept
{ {
return IsBigEndian() ? ReadS24BE(src) : ReadS24LE(src); return IsBigEndian() ? ReadS24BE(src) : ReadS24LE(src);
} }

View File

@ -25,7 +25,7 @@
#include <assert.h> #include <assert.h>
void void
Tag::Clear() Tag::Clear() noexcept
{ {
duration = SignedSongTime::Negative(); duration = SignedSongTime::Negative();
has_playlist = false; has_playlist = false;
@ -98,7 +98,7 @@ Tag::HasType(TagType type) const noexcept
} }
static TagType static TagType
DecaySort(TagType type) DecaySort(TagType type) noexcept
{ {
switch (type) { switch (type) {
case TAG_ARTIST_SORT: case TAG_ARTIST_SORT:
@ -116,7 +116,7 @@ DecaySort(TagType type)
} }
static TagType static TagType
Fallback(TagType type) Fallback(TagType type) noexcept
{ {
switch (type) { switch (type) {
case TAG_ALBUM_ARTIST: case TAG_ALBUM_ARTIST:
@ -131,7 +131,7 @@ Fallback(TagType type)
} }
const char * const char *
Tag::GetSortValue(TagType type) const Tag::GetSortValue(TagType type) const noexcept
{ {
const char *value = GetValue(type); const char *value = GetValue(type);
if (value != nullptr) if (value != nullptr)

View File

@ -85,7 +85,7 @@ struct Tag {
* Similar to the move operator, but move only the #TagItem * Similar to the move operator, but move only the #TagItem
* array. * array.
*/ */
void MoveItemsFrom(Tag &&other) { void MoveItemsFrom(Tag &&other) noexcept {
std::swap(items, other.items); std::swap(items, other.items);
std::swap(num_items, other.num_items); std::swap(num_items, other.num_items);
} }
@ -94,21 +94,21 @@ struct Tag {
* Returns true if the tag contains no items. This ignores * Returns true if the tag contains no items. This ignores
* the "duration" attribute. * the "duration" attribute.
*/ */
bool IsEmpty() const { bool IsEmpty() const noexcept {
return num_items == 0; return num_items == 0;
} }
/** /**
* Returns true if the tag contains any information. * Returns true if the tag contains any information.
*/ */
bool IsDefined() const { bool IsDefined() const noexcept {
return !IsEmpty() || !duration.IsNegative(); return !IsEmpty() || !duration.IsNegative();
} }
/** /**
* Clear everything, as if this was a new Tag object. * Clear everything, as if this was a new Tag object.
*/ */
void Clear(); void Clear() noexcept;
/** /**
* Merges the data from two tags. If both tags share data for the * Merges the data from two tags. If both tags share data for the
@ -149,7 +149,7 @@ struct Tag {
* there is no such value, returns an empty string. * there is no such value, returns an empty string.
*/ */
gcc_pure gcc_pure
const char *GetSortValue(TagType type) const; const char *GetSortValue(TagType type) const noexcept;
class const_iterator { class const_iterator {
friend struct Tag; friend struct Tag;

View File

@ -9,7 +9,7 @@
#include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/HelperMacros.h>
Tag::Tag(const Tag &) {} Tag::Tag(const Tag &) {}
void Tag::Clear() {} void Tag::Clear() noexcept {}
static void static void
check_descending_priority(const Queue *queue, check_descending_priority(const Queue *queue,