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

View File

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

View File

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