Various fixes, reducing compiler warnings.

My compiler gave various warnings, which are easily fixed.
- redundant ";"
- missing NORETURN attributes
- inline @param documentation not in line with functions
- include guard prefix "_" is reserved
This commit is contained in:
Maarten van der Schrieck 2024-01-06 22:24:14 +01:00
parent 478f9a4671
commit a40ec5ea96
4 changed files with 71 additions and 90 deletions

View File

@ -7,8 +7,8 @@
// The idea and interface is based on Boost.Optional library
// authored by Fernando Luis Cacciola Carballal
# ifndef ___OPTIONAL_HPP___
# define ___OPTIONAL_HPP___
# ifndef OPTIONAL_HPP
# define OPTIONAL_HPP
# include <utility>
# include <type_traits>
@ -270,7 +270,7 @@ namespace std{
unsigned char dummy_;
T value_;
constexpr storage_t( trivial_init_t ) noexcept : dummy_() {};
constexpr storage_t( trivial_init_t ) noexcept : dummy_() {}
template <class... Args>
constexpr storage_t( Args&&... args ) : value_(constexpr_forward<Args>(args)...) {}
@ -285,7 +285,7 @@ namespace std{
unsigned char dummy_;
T value_;
constexpr constexpr_storage_t( trivial_init_t ) noexcept : dummy_() {};
constexpr constexpr_storage_t( trivial_init_t ) noexcept : dummy_() {}
template <class... Args>
constexpr constexpr_storage_t( Args&&... args ) : value_(constexpr_forward<Args>(args)...) {}
@ -300,7 +300,7 @@ namespace std{
bool init_;
storage_t<T> storage_;
constexpr optional_base() noexcept : init_(false), storage_(trivial_init) {};
constexpr optional_base() noexcept : init_(false), storage_(trivial_init) {}
explicit constexpr optional_base(const T& v) : init_(true), storage_(v) {}
@ -323,7 +323,7 @@ namespace std{
bool init_;
constexpr_storage_t<T> storage_;
constexpr constexpr_optional_base() noexcept : init_(false), storage_(trivial_init) {};
constexpr constexpr_optional_base() noexcept : init_(false), storage_(trivial_init) {}
explicit constexpr constexpr_optional_base(const T& v) : init_(true), storage_(v) {}
@ -398,8 +398,8 @@ namespace std{
typedef T value_type;
// 20.5.5.1, constructors
constexpr optional() noexcept : OptionalBase<T>() {};
constexpr optional(nullopt_t) noexcept : OptionalBase<T>() {};
constexpr optional() noexcept : OptionalBase<T>() {}
constexpr optional(nullopt_t) noexcept : OptionalBase<T>() {}
optional(const optional& rhs)
: OptionalBase<T>()
@ -1040,4 +1040,4 @@ namespace std
# undef TR2_OPTIONAL_REQUIRES
# undef TR2_OPTIONAL_ASSERTED_EXPRESSION
# endif //___OPTIONAL_HPP___
# endif //OPTIONAL_HPP

View File

@ -145,7 +145,7 @@ public:
{
result = 0;
return true;
};
}
StdStringObject asObject() const
{
@ -181,67 +181,67 @@ public:
return new StdStringFrozenValue(m_value);
}
static StdStringArray getArray()
VALIJSON_NORETURN static StdStringArray getArray()
{
throwNotSupported();
}
size_t getArraySize() const override
VALIJSON_NORETURN size_t getArraySize() const override
{
throwNotSupported();
}
bool getArraySize(size_t &) const override
VALIJSON_NORETURN bool getArraySize(size_t &) const override
{
throwNotSupported();
}
bool getBool() const override
VALIJSON_NORETURN bool getBool() const override
{
throwNotSupported();
}
bool getBool(bool &) const override
VALIJSON_NORETURN bool getBool(bool &) const override
{
throwNotSupported();
}
double getDouble() const override
VALIJSON_NORETURN double getDouble() const override
{
throwNotSupported();
}
bool getDouble(double &) const override
VALIJSON_NORETURN bool getDouble(double &) const override
{
throwNotSupported();
}
int64_t getInteger() const override
VALIJSON_NORETURN int64_t getInteger() const override
{
throwNotSupported();
}
bool getInteger(int64_t &) const override
VALIJSON_NORETURN bool getInteger(int64_t &) const override
{
throwNotSupported();
}
double getNumber() const override
VALIJSON_NORETURN double getNumber() const override
{
throwNotSupported();
}
bool getNumber(double &) const override
VALIJSON_NORETURN bool getNumber(double &) const override
{
throwNotSupported();
}
size_t getObjectSize() const override
VALIJSON_NORETURN size_t getObjectSize() const override
{
throwNotSupported();
}
bool getObjectSize(size_t &) const override
VALIJSON_NORETURN bool getObjectSize(size_t &) const override
{
throwNotSupported();
}
@ -360,12 +360,12 @@ public:
using pointer = StdStringAdapter*;
using reference = StdStringAdapter&;
StdStringAdapter operator*() const
VALIJSON_NORETURN StdStringAdapter operator*() const
{
throwNotSupported();
}
DerefProxy<StdStringAdapter> operator->() const
VALIJSON_NORETURN DerefProxy<StdStringAdapter> operator->() const
{
throwNotSupported();
}
@ -380,22 +380,22 @@ public:
return false;
}
const StdStringArrayValueIterator& operator++()
VALIJSON_NORETURN const StdStringArrayValueIterator& operator++()
{
throwNotSupported();
}
StdStringArrayValueIterator operator++(int)
VALIJSON_NORETURN StdStringArrayValueIterator operator++(int)
{
throwNotSupported();
}
const StdStringArrayValueIterator& operator--()
VALIJSON_NORETURN const StdStringArrayValueIterator& operator--()
{
throwNotSupported();
}
void advance(std::ptrdiff_t)
VALIJSON_NORETURN void advance(std::ptrdiff_t)
{
throwNotSupported();
}
@ -420,12 +420,12 @@ public:
using pointer = StdStringObjectMember*;
using reference = StdStringObjectMember&;
StdStringObjectMember operator*() const
VALIJSON_NORETURN StdStringObjectMember operator*() const
{
throwNotSupported();
}
DerefProxy<StdStringObjectMember> operator->() const
VALIJSON_NORETURN DerefProxy<StdStringObjectMember> operator->() const
{
throwNotSupported();
}
@ -440,17 +440,17 @@ public:
return false;
}
const StdStringObjectMemberIterator& operator++()
VALIJSON_NORETURN const StdStringObjectMemberIterator& operator++()
{
throwNotSupported();
}
StdStringObjectMemberIterator operator++(int)
VALIJSON_NORETURN StdStringObjectMemberIterator operator++(int)
{
throwNotSupported();
}
const StdStringObjectMemberIterator& operator--()
VALIJSON_NORETURN const StdStringObjectMemberIterator& operator--()
{
throwNotSupported();
}

View File

@ -13,7 +13,6 @@ namespace json_reference {
* @brief Extract URI from JSON Reference relative to the current schema
*
* @param jsonRef JSON Reference to extract from
* @param schema Schema that JSON Reference URI is relative to
*
* @return Optional string containing URI
*/

View File

@ -338,24 +338,24 @@ private:
* those $ref nodes in the schema cache. An entry will be added to the
* schema cache for each node visited on the path to the concrete node.
*
* @param rootSchema The Schema instance, and root subschema, through
* which other subschemas can be created and
* modified
* @param rootNode Reference to the node from which JSON References
* will be resolved when they refer to the current
* document
* @param node Reference to the node to parse
* @param currentScope URI for current resolution scope
* @param nodePath JSON Pointer representing path to current node
* @param fetchDoc Function to fetch remote JSON documents (optional)
* @param parentSchema Optional pointer to the parent schema, used to
* support required keyword in Draft 3
* @param ownName Optional pointer to a node name, used to support
* the 'required' keyword in Draft 3
* @param docCache Cache of resolved and fetched remote documents
* @param schemaCache Cache of populated schemas
* @param newCacheKeys A list of keys that should be added to the cache
* when recursion terminates
* @param rootSchema The Schema instance, and root subschema, through
* which other subschemas can be created and
* modified
* @param rootNode Reference to the node from which JSON References
* will be resolved when they refer to the current
* document
* @param node Reference to the node to parse
* @param currentScope URI for current resolution scope
* @param nodePath JSON Pointer representing path to current node
* @param fetchDoc Function to fetch remote JSON documents (optional)
* @param parentSubschema Optional pointer to the parent schema, used to
* support required keyword in Draft 3
* @param ownName Optional pointer to a node name, used to support
* the 'required' keyword in Draft 3
* @param docCache Cache of resolved and fetched remote documents
* @param schemaCache Cache of populated schemas
* @param newCacheKeys A list of keys that should be added to the cache
* when recursion terminates
*/
template<typename AdapterType>
const Subschema * makeOrReuseSchema(
@ -504,22 +504,22 @@ private:
* a concrete node, an entry will be added to the schema cache for each of
* the nodes in that path.
*
* @param rootSchema The Schema instance, and root subschema, through
* which other subschemas can be created and
* modified
* @param rootNode Reference to the node from which JSON References
* will be resolved when they refer to the current
* document
* @param node Reference to the node to parse
* @param currentScope URI for current resolution scope
* @param nodePath JSON Pointer representing path to current node
* @param fetchDoc Function to fetch remote JSON documents (optional)
* @param parentSchema Optional pointer to the parent schema, used to
* support required keyword in Draft 3
* @param ownName Optional pointer to a node name, used to support
* the 'required' keyword in Draft 3
* @param docCache Cache of resolved and fetched remote documents
* @param schemaCache Cache of populated schemas
* @param rootSchema The Schema instance, and root subschema, through
* which other subschemas can be created and
* modified
* @param rootNode Reference to the node from which JSON References
* will be resolved when they refer to the current
* document
* @param node Reference to the node to parse
* @param currentScope URI for current resolution scope
* @param nodePath JSON Pointer representing path to current node
* @param fetchDoc Function to fetch remote JSON documents (optional)
* @param parentSubschema Optional pointer to the parent schema, used to
* support required keyword in Draft 3
* @param ownName Optional pointer to a node name, used to support
* the 'required' keyword in Draft 3
* @param docCache Cache of resolved and fetched remote documents
* @param schemaCache Cache of populated schemas
*/
template<typename AdapterType>
const Subschema * makeOrReuseSchema(
@ -556,7 +556,7 @@ private:
* will be resolved when they refer to the current
* document
* @param node Reference to node to parse
* @param schema Reference to Schema to populate
* @param subschema Reference to Schema to populate
* @param currentScope URI for current resolution scope
* @param nodePath JSON Pointer representing path to current node
* @param fetchDoc Optional function to fetch remote JSON documents
@ -1173,7 +1173,7 @@ private:
* a schema that will be used when the conditional
* evaluates to false.
* @param currentScope URI for current resolution scope
* @param containsPath JSON Pointer representing the path to
* @param nodePath JSON Pointer representing the path to
* the 'contains' node
* @param fetchDoc Function to fetch remote JSON documents
* (optional)
@ -1564,14 +1564,9 @@ private:
* @param items Optional pointer to a JSON node containing
* an object mapping property names to
* schemas.
* @param additionalItems Optional pointer to a JSON node containing
* an additional properties schema or a
* boolean value.
* @param currentScope URI for current resolution scope
* @param itemsPath JSON Pointer representing the path to
* the 'items' node
* @param additionalItemsPath JSON Pointer representing the path to
* the 'additionalItems' node
* @param fetchDoc Function to fetch remote JSON documents
* (optional)
* @param docCache Cache of resolved and fetched remote
@ -1623,13 +1618,6 @@ private:
/**
* @brief Make a new MaximumConstraint object (draft 3 and 4).
*
* @param rootSchema The Schema instance, and root subschema,
* through which other subschemas can be
* created and modified
* @param rootNode Reference to the node from which JSON
* References will be resolved when they refer
* to the current document; used for recursive
* parsing of schemas
* @param node JSON node containing the maximum value.
* @param exclusiveMaximum Optional pointer to a JSON boolean value that
* indicates whether maximum value is excluded
@ -1665,9 +1653,6 @@ private:
*
* @param node JSON node containing an integer, representing the maximum value.
*
* @param exclusive Optional pointer to a JSON boolean value that indicates whether the
* maximum value is excluded from the range of permitted values.
*
* @return pointer to a new Maximum that belongs to the caller
*/
template<typename AdapterType>
@ -1763,7 +1748,7 @@ private:
* @param node JSON node containing an integer, representing
* the minimum value.
*
* @param exclusiveMaximum Optional pointer to a JSON boolean value that
* @param exclusiveMinimum Optional pointer to a JSON boolean value that
* indicates whether the minimum value is
* excluded from the range of permitted values.
*
@ -1797,9 +1782,6 @@ private:
*
* @param node JSON node containing an integer, representing the minimum value.
*
* @param exclusive Optional pointer to a JSON boolean value that indicates whether the
* minimum value is excluded from the range of permitted values.
*
* @return pointer to a new MinimumConstraint that belongs to the caller
*/
template<typename AdapterType>