*: add lost of "noexcept" specifications

This commit is contained in:
Max Kellermann
2017-06-03 21:33:44 +02:00
parent 62b03cfddf
commit a057b4f6d8
65 changed files with 246 additions and 241 deletions
+21 -18
View File
@@ -77,12 +77,12 @@ public:
* @see IsNull()
*/
gcc_const
static AllocatedPath Null() {
static AllocatedPath Null() noexcept {
return AllocatedPath(nullptr);
}
gcc_pure
operator Path() const {
operator Path() const noexcept {
return Path::FromFS(c_str());
}
@@ -90,36 +90,39 @@ public:
* Join two path components with the path separator.
*/
gcc_pure gcc_nonnull_all
static AllocatedPath Build(const_pointer_type a, const_pointer_type b) {
static AllocatedPath Build(const_pointer_type a,
const_pointer_type b) noexcept {
return Build(a, PathTraitsFS::GetLength(a),
b, PathTraitsFS::GetLength(b));
}
gcc_pure gcc_nonnull_all
static AllocatedPath Build(Path a, const_pointer_type b) {
static AllocatedPath Build(Path a, const_pointer_type b) noexcept {
return Build(a.c_str(), b);
}
gcc_pure gcc_nonnull_all
static AllocatedPath Build(Path a, Path b) {
static AllocatedPath Build(Path a, Path b) noexcept {
return Build(a, b.c_str());
}
gcc_pure gcc_nonnull_all
static AllocatedPath Build(const_pointer_type a, const AllocatedPath &b) {
static AllocatedPath Build(const_pointer_type a,
const AllocatedPath &b) noexcept {
return Build(a, PathTraitsFS::GetLength(a),
b.value.c_str(), b.value.size());
}
gcc_pure gcc_nonnull_all
static AllocatedPath Build(const AllocatedPath &a, const_pointer_type b) {
static AllocatedPath Build(const AllocatedPath &a,
const_pointer_type b) noexcept {
return Build(a.value.c_str(), a.value.size(),
b, PathTraitsFS::GetLength(b));
}
gcc_pure
static AllocatedPath Build(const AllocatedPath &a,
const AllocatedPath &b) {
const AllocatedPath &b) noexcept {
return Build(a.value.c_str(), a.value.size(),
b.value.c_str(), b.value.size());
}
@@ -129,13 +132,13 @@ public:
* character set to a #Path instance.
*/
gcc_pure
static AllocatedPath FromFS(const_pointer_type fs) {
static AllocatedPath FromFS(const_pointer_type fs) noexcept {
return AllocatedPath(fs);
}
gcc_pure
static AllocatedPath FromFS(const_pointer_type _begin,
const_pointer_type _end) {
const_pointer_type _end) noexcept {
return AllocatedPath(_begin, _end);
}
@@ -144,7 +147,7 @@ public:
* character set to a #Path instance.
*/
gcc_pure
static AllocatedPath FromFS(string &&fs) {
static AllocatedPath FromFS(string &&fs) noexcept {
return AllocatedPath(std::move(fs));
}
@@ -176,12 +179,12 @@ public:
}
gcc_pure
bool operator==(const AllocatedPath &other) const {
bool operator==(const AllocatedPath &other) const noexcept {
return value == other.value;
}
gcc_pure
bool operator!=(const AllocatedPath &other) const {
bool operator!=(const AllocatedPath &other) const noexcept {
return value != other.value;
}
@@ -197,7 +200,7 @@ public:
* Check if this is a "nulled" instance. A "nulled" instance
* must not be used.
*/
bool IsNull() const {
bool IsNull() const noexcept {
return value.empty();
}
@@ -206,7 +209,7 @@ public:
*
* @see IsNull()
*/
void SetNull() {
void SetNull() noexcept {
value.clear();
}
@@ -215,7 +218,7 @@ public:
* elements (which may not be the number of characters).
*/
gcc_pure
size_t length() const {
size_t length() const noexcept {
return value.length();
}
@@ -225,7 +228,7 @@ public:
* instance ends.
*/
gcc_pure
const_pointer_type c_str() const {
const_pointer_type c_str() const noexcept {
return value.c_str();
}
@@ -234,7 +237,7 @@ public:
* null-terminated.
*/
gcc_pure
const_pointer_type data() const {
const_pointer_type data() const noexcept {
return value.data();
}
+1 -1
View File
@@ -54,7 +54,7 @@ public:
#endif
gcc_pure
bool Check(const char *name_fs) const {
bool Check(const char *name_fs) const noexcept {
#ifdef HAVE_FNMATCH
return fnmatch(pattern.c_str(), name_fs, 0) == 0;
#elif defined(WIN32)
+3 -3
View File
@@ -92,7 +92,7 @@ public:
* elements (which may not be the number of characters).
*/
gcc_pure
size_t length() const {
size_t length() const noexcept {
assert(!IsNull());
return PathTraitsFS::GetLength(c_str());
@@ -104,7 +104,7 @@ public:
* instance ends.
*/
gcc_pure
const_pointer_type c_str() const {
const_pointer_type c_str() const noexcept {
return Base::c_str();
}
@@ -113,7 +113,7 @@ public:
* null-terminated.
*/
gcc_pure
const_pointer_type data() const {
const_pointer_type data() const noexcept {
return c_str();
}
+12 -12
View File
@@ -63,7 +63,7 @@ struct PathTraitsFS {
static constexpr const_pointer_type CURRENT_DIRECTORY = PATH_LITERAL(".");
static constexpr bool IsSeparator(value_type ch) {
static constexpr bool IsSeparator(value_type ch) noexcept {
return
#ifdef WIN32
ch == '/' ||
@@ -72,7 +72,7 @@ struct PathTraitsFS {
}
gcc_pure gcc_nonnull_all
static const_pointer_type FindLastSeparator(const_pointer_type p) {
static const_pointer_type FindLastSeparator(const_pointer_type p) noexcept {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(p != nullptr);
@@ -90,13 +90,13 @@ struct PathTraitsFS {
#ifdef WIN32
gcc_pure gcc_nonnull_all
static constexpr bool IsDrive(const_pointer_type p) {
static constexpr bool IsDrive(const_pointer_type p) noexcept {
return IsAlphaASCII(p[0]) && p[1] == ':';
}
#endif
gcc_pure gcc_nonnull_all
static bool IsAbsolute(const_pointer_type p) {
static bool IsAbsolute(const_pointer_type p) noexcept {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(p != nullptr);
@@ -110,12 +110,12 @@ struct PathTraitsFS {
}
gcc_pure gcc_nonnull_all
static size_t GetLength(const_pointer_type p) {
static size_t GetLength(const_pointer_type p) noexcept {
return StringLength(p);
}
gcc_pure gcc_nonnull_all
static const_pointer_type Find(const_pointer_type p, value_type ch) {
static const_pointer_type Find(const_pointer_type p, value_type ch) noexcept {
return StringFind(p, ch);
}
@@ -179,7 +179,7 @@ struct PathTraitsUTF8 {
}
gcc_pure gcc_nonnull_all
static const_pointer_type FindLastSeparator(const_pointer_type p) {
static const_pointer_type FindLastSeparator(const_pointer_type p) noexcept {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(p != nullptr);
@@ -190,13 +190,13 @@ struct PathTraitsUTF8 {
#ifdef WIN32
gcc_pure gcc_nonnull_all
static constexpr bool IsDrive(const_pointer_type p) {
static constexpr bool IsDrive(const_pointer_type p) noexcept {
return IsAlphaASCII(p[0]) && p[1] == ':';
}
#endif
gcc_pure gcc_nonnull_all
static bool IsAbsolute(const_pointer_type p) {
static bool IsAbsolute(const_pointer_type p) noexcept {
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(p != nullptr);
@@ -210,12 +210,12 @@ struct PathTraitsUTF8 {
}
gcc_pure gcc_nonnull_all
static size_t GetLength(const_pointer_type p) {
static size_t GetLength(const_pointer_type p) noexcept {
return StringLength(p);
}
gcc_pure gcc_nonnull_all
static const_pointer_type Find(const_pointer_type p, value_type ch) {
static const_pointer_type Find(const_pointer_type p, value_type ch) noexcept {
return StringFind(p, ch);
}
@@ -255,7 +255,7 @@ struct PathTraitsUTF8 {
const_pointer_type b, size_t b_size) noexcept;
gcc_pure gcc_nonnull_all
static string Build(const_pointer_type a, const_pointer_type b) {
static string Build(const_pointer_type a, const_pointer_type b) noexcept {
return Build(a, GetLength(a), b, GetLength(b));
}
};
+1 -1
View File
@@ -67,7 +67,7 @@ BufferedReader::ReadFull(size_t size)
}
size_t
BufferedReader::ReadFromBuffer(WritableBuffer<void> dest)
BufferedReader::ReadFromBuffer(WritableBuffer<void> dest) noexcept
{
auto src = Read();
size_t nbytes = std::min(src.size, dest.size);
+5 -5
View File
@@ -47,7 +47,7 @@ public:
* Reset the internal state. Should be called after rewinding
* the underlying #Reader.
*/
void Reset() {
void Reset() noexcept {
buffer.Clear();
eof = false;
line_number = 0;
@@ -56,7 +56,7 @@ public:
bool Fill(bool need_more);
gcc_pure
WritableBuffer<void> Read() const {
WritableBuffer<void> Read() const noexcept {
return buffer.Read().ToVoid();
}
@@ -67,7 +67,7 @@ public:
*/
void *ReadFull(size_t size);
void Consume(size_t n) {
void Consume(size_t n) noexcept {
buffer.Consume(n);
}
@@ -75,7 +75,7 @@ public:
* Read (and consume) data from the input buffer into the
* given buffer. Does not attempt to refill the buffer.
*/
size_t ReadFromBuffer(WritableBuffer<void> dest);
size_t ReadFromBuffer(WritableBuffer<void> dest) noexcept;
/**
* Read data into the given buffer and consume it from our
@@ -86,7 +86,7 @@ public:
char *ReadLine();
unsigned GetLineNumber() const {
unsigned GetLineNumber() const noexcept {
return line_number;
}
};