*: remove "pure" and "const" attributes from throwing functions

The "pure" and "const" attributes are not so well-defined, and a
recent clang version implements an optimization which pushes the
definition's boundary beyond what I believed it was.  clang now
assumes that functions declared "pure" cannot throw exceptions, even
if they lack the "noexcept" specification.

When compiled with this new clang version, MPD will crash randomly if
an exception happens to get thrown by such as "pure" function
(https://github.com/MusicPlayerDaemon/MPD/issues/41).

This commit removes all such misplaced "pure" and "const" attributes,
closing #41.
This commit is contained in:
Max Kellermann
2017-05-08 14:48:58 +02:00
parent 71f0ed8b74
commit 788e3b31e1
27 changed files with 8 additions and 61 deletions

View File

@@ -21,7 +21,6 @@
#define MPD_PROTOCOL_ARGPARSER_HXX
#include "check.h"
#include "Compiler.h"
#include <limits>
@@ -30,15 +29,12 @@
class SongTime;
class SignedSongTime;
gcc_pure
uint32_t
ParseCommandArgU32(const char *s);
gcc_pure
int
ParseCommandArgInt(const char *s, int min_value, int max_value);
gcc_pure
int
ParseCommandArgInt(const char *s);
@@ -55,31 +51,24 @@ struct RangeArg {
}
};
gcc_pure
RangeArg
ParseCommandArgRange(const char *s);
gcc_pure
unsigned
ParseCommandArgUnsigned(const char *s, unsigned max_value);
gcc_pure
unsigned
ParseCommandArgUnsigned(const char *s);
gcc_pure
bool
ParseCommandArgBool(const char *s);
gcc_pure
float
ParseCommandArgFloat(const char *s);
gcc_pure
SongTime
ParseCommandArgSongTime(const char *s);
gcc_pure
SignedSongTime
ParseCommandArgSignedSongTime(const char *s);