From e7cd10e528b94f0248b49af50c22020c6c7ed859 Mon Sep 17 00:00:00 2001 From: Bill Avery Date: Sun, 11 Jun 2023 19:42:04 -0700 Subject: [PATCH 1/8] Reorder export/nodiscard attributes for winclang --- doc/subscriptions.md | 6 +- include/Validation.h | 39 ++- include/graphqlservice/GraphQLClient.h | 11 +- include/graphqlservice/GraphQLParse.h | 10 +- include/graphqlservice/GraphQLResponse.h | 127 ++++---- include/graphqlservice/GraphQLService.h | 105 +++---- include/graphqlservice/internal/Base64.h | 8 +- .../graphqlservice/internal/Introspection.h | 102 +++---- include/graphqlservice/internal/Schema.h | 285 ++++++++---------- 9 files changed, 318 insertions(+), 375 deletions(-) diff --git a/doc/subscriptions.md b/doc/subscriptions.md index 0ae51e21..fb67bfc2 100644 --- a/doc/subscriptions.md +++ b/doc/subscriptions.md @@ -13,7 +13,7 @@ the subscriptions to those listeners. Subscriptions are created by calling the `Request::subscribe` method in [GraphQLService.h](../include/graphqlservice/GraphQLService.h): ```cpp -GRAPHQLSERVICE_EXPORT [[nodiscard("leaked subscription")]] AwaitableSubscribe subscribe(RequestSubscribeParams params); +[[nodiscard("leaked subscription")]] GRAPHQLSERVICE_EXPORT AwaitableSubscribe subscribe(RequestSubscribeParams params); ``` You need to fill in a `RequestSubscribeParams` struct with the subscription event @@ -64,7 +64,7 @@ The `internal::Awaitable` template is described in [awaitable.md](./awaitable Subscriptions are removed by calling the `Request::unsubscribe` method in [GraphQLService.h](../include/graphqlservice/GraphQLService.h): ```cpp -GRAPHQLSERVICE_EXPORT [[nodiscard("potentially leaked subscription")]] AwaitableUnsubscribe unsubscribe(RequestUnsubscribeParams params); +[[nodiscard("potentially leaked subscription")]] GRAPHQLSERVICE_EXPORT AwaitableUnsubscribe unsubscribe(RequestUnsubscribeParams params); ``` You need to fill in a `RequestUnsubscribeParams` struct with the `SubscriptionKey` @@ -186,6 +186,6 @@ that, there's a public `Request::findOperationDefinition` method which returns the operation type as a `std::string_view` along with a pointer to the AST node for the selected operation in the parsed query: ```cpp -GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::pair +[[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::pair findOperationDefinition(peg::ast& query, std::string_view operationName) const; ``` \ No newline at end of file diff --git a/include/Validation.h b/include/Validation.h index c30fdd63..5b11057c 100644 --- a/include/Validation.h +++ b/include/Validation.h @@ -85,14 +85,14 @@ using ValidateArgumentVariant = std::variant & errors); + ValidateArgumentValueVisitor(std::list& errors); void visit(const peg::ast_node& value); @@ -127,10 +127,8 @@ using ValidateFieldArguments = internal::string_view_map; class [[nodiscard("unnecessary construction")]] ValidateVariableTypeVisitor { public: - ValidateVariableTypeVisitor(const std::shared_ptr& schema, - const ValidateTypes& types); + ValidateVariableTypeVisitor( + const std::shared_ptr& schema, const ValidateTypes& types); void visit(const peg::ast_node& typeName); @@ -176,7 +174,7 @@ class [[nodiscard("unnecessary construction")]] ValidateExecutableVisitor GRAPHQLSERVICE_EXPORT void visit(const peg::ast_node& root); - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary construction")]] std::list + [[nodiscard("unnecessary construction")]] GRAPHQLSERVICE_EXPORT std::list getStructuredErrors(); private: @@ -201,12 +199,11 @@ class [[nodiscard("unnecessary construction")]] ValidateExecutableVisitor [[nodiscard("unnecessary call")]] static const ValidateType& getValidateFieldType( const InputFieldTypes::mapped_type& value); template - [[nodiscard("unnecessary call")]] static ValidateType getFieldType(const _FieldTypes& fields, - std::string_view name); + [[nodiscard("unnecessary call")]] static ValidateType getFieldType( + const _FieldTypes& fields, std::string_view name); template [[nodiscard("unnecessary call")]] static ValidateType getWrappedFieldType( - const _FieldTypes& fields, - std::string_view name); + const _FieldTypes& fields, std::string_view name); void visitFragmentDefinition(const peg::ast_node& fragmentDefinition); void visitOperationDefinition(const peg::ast_node& operationDefinition); @@ -217,15 +214,13 @@ class [[nodiscard("unnecessary construction")]] ValidateExecutableVisitor void visitFragmentSpread(const peg::ast_node& fragmentSpread); void visitInlineFragment(const peg::ast_node& inlineFragment); - void visitDirectives(introspection::DirectiveLocation location, - const peg::ast_node& directives); + void visitDirectives( + introspection::DirectiveLocation location, const peg::ast_node& directives); [[nodiscard("unnecessary call")]] bool validateInputValue(bool hasNonNullDefaultValue, - const ValidateArgumentValuePtr& argument, - const ValidateType& type); + const ValidateArgumentValuePtr& argument, const ValidateType& type); [[nodiscard("unnecessary call")]] bool validateVariableType(bool isNonNull, - const ValidateType& variableType, - const schema_location& position, + const ValidateType& variableType, const schema_location& position, const ValidateType& inputType); const std::shared_ptr _schema; diff --git a/include/graphqlservice/GraphQLClient.h b/include/graphqlservice/GraphQLClient.h index a93c3d7c..1321c1b4 100644 --- a/include/graphqlservice/GraphQLClient.h +++ b/include/graphqlservice/GraphQLClient.h @@ -59,7 +59,7 @@ struct [[nodiscard("unnecessary construction")]] ServiceResponse }; // Split a service response into separate ServiceResponse data and errors members. -GRAPHQLCLIENT_EXPORT [[nodiscard("unnecessary conversion")]] ServiceResponse parseServiceResponse( +[[nodiscard("unnecessary conversion")]] GRAPHQLCLIENT_EXPORT ServiceResponse parseServiceResponse( response::Value response); // GraphQL types are nullable by default, but they may be wrapped with non-null or list types. @@ -105,8 +105,7 @@ concept ScalarVariableClass = std::is_same_v // Any non-scalar class used in a variable is a generated INPUT_OBJECT type. template -concept InputVariableClass = std::is_class_v && ! -ScalarVariableClass; +concept InputVariableClass = std::is_class_v && !ScalarVariableClass; // Test if there are any non-None modifiers left. template @@ -114,13 +113,11 @@ concept OnlyNoneModifiers = (... && (Other == TypeModifier::None)); // Test if the next modifier is Nullable. template -concept NullableModifier = Modifier == -TypeModifier::Nullable; +concept NullableModifier = Modifier == TypeModifier::Nullable; // Test if the next modifier is List. template -concept ListModifier = Modifier == -TypeModifier::List; +concept ListModifier = Modifier == TypeModifier::List; // Special-case an innermost nullable INPUT_OBJECT type. template diff --git a/include/graphqlservice/GraphQLParse.h b/include/graphqlservice/GraphQLParse.h index b9c31e76..e983b224 100644 --- a/include/graphqlservice/GraphQLParse.h +++ b/include/graphqlservice/GraphQLParse.h @@ -38,19 +38,19 @@ struct [[nodiscard("unnecessary parse")]] ast // another value for the depthLimit parameter in these parse functions. constexpr size_t c_defaultDepthLimit = 25; -GRAPHQLPEG_EXPORT [[nodiscard("unnecessary parse")]] ast parseSchemaString( +[[nodiscard("unnecessary parse")]] GRAPHQLPEG_EXPORT ast parseSchemaString( std::string_view input, size_t depthLimit = c_defaultDepthLimit); -GRAPHQLPEG_EXPORT [[nodiscard("unnecessary parse")]] ast parseSchemaFile( +[[nodiscard("unnecessary parse")]] GRAPHQLPEG_EXPORT ast parseSchemaFile( std::string_view filename, size_t depthLimit = c_defaultDepthLimit); -GRAPHQLPEG_EXPORT [[nodiscard("unnecessary parse")]] ast parseString( +[[nodiscard("unnecessary parse")]] GRAPHQLPEG_EXPORT ast parseString( std::string_view input, size_t depthLimit = c_defaultDepthLimit); -GRAPHQLPEG_EXPORT [[nodiscard("unnecessary parse")]] ast parseFile( +[[nodiscard("unnecessary parse")]] GRAPHQLPEG_EXPORT ast parseFile( std::string_view filename, size_t depthLimit = c_defaultDepthLimit); } // namespace peg -GRAPHQLPEG_EXPORT [[nodiscard("unnecessary parse")]] peg::ast operator"" _graphql( +[[nodiscard("unnecessary parse")]] GRAPHQLPEG_EXPORT peg::ast operator"" _graphql( const char* text, size_t size); } // namespace graphql diff --git a/include/graphqlservice/GraphQLResponse.h b/include/graphqlservice/GraphQLResponse.h index a8b6e8c5..5ff8cb07 100644 --- a/include/graphqlservice/GraphQLResponse.h +++ b/include/graphqlservice/GraphQLResponse.h @@ -76,8 +76,8 @@ struct [[nodiscard("unnecessary conversion")]] IdType IdType& operator=(const IdType& rhs) = delete; // Conversion - GRAPHQLRESPONSE_EXPORT IdType(ByteData && data) noexcept; - GRAPHQLRESPONSE_EXPORT IdType(OpaqueString && opaque) noexcept; + GRAPHQLRESPONSE_EXPORT IdType(ByteData&& data) noexcept; + GRAPHQLRESPONSE_EXPORT IdType(OpaqueString&& opaque) noexcept; template [[nodiscard("unnecessary call")]] const ValueType& get() const; @@ -86,63 +86,63 @@ struct [[nodiscard("unnecessary conversion")]] IdType [[nodiscard("unnecessary call")]] ValueType release(); // Comparison - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] bool operator==(const IdType& rhs) - const noexcept; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] bool operator==(const ByteData& rhs) - const noexcept; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] bool operator==( + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT bool operator==( + const IdType& rhs) const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT bool operator==( + const ByteData& rhs) const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT bool operator==( const OpaqueString& rhs) const noexcept; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] bool operator<(const IdType& rhs) - const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT bool operator<( + const IdType& rhs) const noexcept; // Check the type - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] bool isBase64() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT bool isBase64() const noexcept; // Shared accessors - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] bool empty() const noexcept; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] size_t size() const noexcept; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] size_t max_size() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT bool empty() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT size_t size() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT size_t max_size() const noexcept; GRAPHQLRESPONSE_EXPORT void reserve(size_t new_cap); - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] size_t capacity() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT size_t capacity() const noexcept; GRAPHQLRESPONSE_EXPORT void shrink_to_fit(); GRAPHQLRESPONSE_EXPORT void clear() noexcept; // ByteData accessors - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] const std::uint8_t& at(size_t pos) - const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] std::uint8_t& at(size_t pos); - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] const std::uint8_t& operator[]( + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT const std::uint8_t& at( + size_t pos) const; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT std::uint8_t& at(size_t pos); + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT const std::uint8_t& operator[]( size_t pos) const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] std::uint8_t& operator[](size_t pos); - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] const std::uint8_t& front() const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] std::uint8_t& front(); - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] const std::uint8_t& back() const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] std::uint8_t& back(); - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] const std::uint8_t* data() const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] std::uint8_t* data(); + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT std::uint8_t& operator[](size_t pos); + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT const std::uint8_t& front() const; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT std::uint8_t& front(); + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT const std::uint8_t& back() const; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT std::uint8_t& back(); + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT const std::uint8_t* data() const; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT std::uint8_t* data(); // ByteData iterators - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] ByteData::const_iterator begin() const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] ByteData::iterator begin(); - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] ByteData::const_iterator cbegin() + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT ByteData::const_iterator begin() const; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT ByteData::iterator begin(); + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT ByteData::const_iterator cbegin() const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] ByteData::const_iterator end() const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] ByteData::iterator end(); - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] ByteData::const_iterator cend() const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] ByteData::const_reverse_iterator + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT ByteData::const_iterator end() const; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT ByteData::iterator end(); + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT ByteData::const_iterator cend() const; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT ByteData::const_reverse_iterator rbegin() const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] ByteData::reverse_iterator rbegin(); - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] ByteData::const_reverse_iterator + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT ByteData::reverse_iterator rbegin(); + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT ByteData::const_reverse_iterator crbegin() const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] ByteData::const_reverse_iterator rend() + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT ByteData::const_reverse_iterator rend() const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] ByteData::reverse_iterator rend(); - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] ByteData::const_reverse_iterator + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT ByteData::reverse_iterator rend(); + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT ByteData::const_reverse_iterator crend() const; // OpaqueString accessors - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] const char* c_str() const; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT const char* c_str() const; private: std::variant _data; @@ -227,13 +227,13 @@ struct [[nodiscard("unnecessary conversion")]] Value GRAPHQLRESPONSE_EXPORT ~Value(); GRAPHQLRESPONSE_EXPORT explicit Value(const char* value); - GRAPHQLRESPONSE_EXPORT explicit Value(StringType && value); + GRAPHQLRESPONSE_EXPORT explicit Value(StringType&& value); GRAPHQLRESPONSE_EXPORT explicit Value(BooleanType value); GRAPHQLRESPONSE_EXPORT explicit Value(IntType value); GRAPHQLRESPONSE_EXPORT explicit Value(FloatType value); - GRAPHQLRESPONSE_EXPORT explicit Value(IdType && value); + GRAPHQLRESPONSE_EXPORT explicit Value(IdType&& value); - GRAPHQLRESPONSE_EXPORT Value(Value && other) noexcept; + GRAPHQLRESPONSE_EXPORT Value(Value&& other) noexcept; GRAPHQLRESPONSE_EXPORT explicit Value(const Value& other); GRAPHQLRESPONSE_EXPORT Value(std::shared_ptr other) noexcept; @@ -242,41 +242,41 @@ struct [[nodiscard("unnecessary conversion")]] Value Value& operator=(const Value& rhs) = delete; // Comparison - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] bool operator==(const Value& rhs) - const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT bool operator==( + const Value& rhs) const noexcept; // Check the Type - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] Type type() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT Type type() const noexcept; // JSON doesn't distinguish between Type::String, Type::EnumValue, and Type::ID, so if this // value comes from JSON and it's a string we need to track the fact that it can be interpreted // as any of those types. - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] Value&& from_json() noexcept; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] bool maybe_enum() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT Value&& from_json() noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT bool maybe_enum() const noexcept; // Input values don't distinguish between Type::String and Type::ID, so if this value comes from // a string literal input value we need to track that fact that it can be interpreted as either // of those types. - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] Value&& from_input() noexcept; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] bool maybe_id() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT Value&& from_input() noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT bool maybe_id() const noexcept; // Valid for Type::Map or Type::List GRAPHQLRESPONSE_EXPORT void reserve(size_t count); - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] size_t size() const; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT size_t size() const; // Valid for Type::Map - GRAPHQLRESPONSE_EXPORT bool emplace_back(std::string && name, Value && value); - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] MapType::const_iterator find( + GRAPHQLRESPONSE_EXPORT bool emplace_back(std::string&& name, Value&& value); + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT MapType::const_iterator find( std::string_view name) const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] MapType::const_iterator begin() const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] MapType::const_iterator end() const; - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] const Value& operator[]( + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT MapType::const_iterator begin() const; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT MapType::const_iterator end() const; + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT const Value& operator[]( std::string_view name) const; // Valid for Type::List - GRAPHQLRESPONSE_EXPORT void emplace_back(Value && value); - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] const Value& operator[](size_t index) - const; + GRAPHQLRESPONSE_EXPORT void emplace_back(Value&& value); + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT const Value& operator[]( + size_t index) const; // Specialized for all single-value Types. template @@ -329,17 +329,8 @@ struct [[nodiscard("unnecessary conversion")]] Value using SharedData = std::shared_ptr; - using TypeData = std::variant; + using TypeData = std::variant; [[nodiscard("unnecessary call")]] const TypeData& data() const noexcept; diff --git a/include/graphqlservice/GraphQLService.h b/include/graphqlservice/GraphQLService.h index b1860be4..4f7d770f 100644 --- a/include/graphqlservice/GraphQLService.h +++ b/include/graphqlservice/GraphQLService.h @@ -73,7 +73,7 @@ struct [[nodiscard("unnecessary construction")]] field_path using error_path = std::vector; -GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary memory copy")]] error_path buildErrorPath( +[[nodiscard("unnecessary memory copy")]] GRAPHQLSERVICE_EXPORT error_path buildErrorPath( const std::optional& path); struct [[nodiscard("unnecessary construction")]] schema_error @@ -83,28 +83,28 @@ struct [[nodiscard("unnecessary construction")]] schema_error error_path path {}; }; -GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary memory copy")]] response::Value buildErrorValues( +[[nodiscard("unnecessary memory copy")]] GRAPHQLSERVICE_EXPORT response::Value buildErrorValues( std::list&& structuredErrors); // This exception bubbles up 1 or more error messages to the JSON results. class [[nodiscard("unnecessary construction")]] schema_exception : public std::exception { public: - GRAPHQLSERVICE_EXPORT explicit schema_exception(std::list && structuredErrors); - GRAPHQLSERVICE_EXPORT explicit schema_exception(std::vector && messages); + GRAPHQLSERVICE_EXPORT explicit schema_exception(std::list&& structuredErrors); + GRAPHQLSERVICE_EXPORT explicit schema_exception(std::vector&& messages); schema_exception() = delete; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary conversion")]] const char* what() + [[nodiscard("unnecessary conversion")]] GRAPHQLSERVICE_EXPORT const char* what() const noexcept override; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary construction")]] std::list + [[nodiscard("unnecessary construction")]] GRAPHQLSERVICE_EXPORT std::list getStructuredErrors() noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary conversion")]] response::Value getErrors(); + [[nodiscard("unnecessary conversion")]] GRAPHQLSERVICE_EXPORT response::Value getErrors(); private: [[nodiscard("unnecessary construction")]] static std::list convertMessages( - std::vector && messages) noexcept; + std::vector&& messages) noexcept; std::list _structuredErrors; }; @@ -183,7 +183,7 @@ struct [[nodiscard("unnecessary construction")]] await_worker_queue : coro::susp GRAPHQLSERVICE_EXPORT await_worker_queue(); GRAPHQLSERVICE_EXPORT ~await_worker_queue(); - GRAPHQLSERVICE_EXPORT [[nodiscard("unexpected call")]] bool await_ready() const; + [[nodiscard("unexpected call")]] GRAPHQLSERVICE_EXPORT bool await_ready() const; GRAPHQLSERVICE_EXPORT void await_suspend(coro::coroutine_handle<> h); private: @@ -253,7 +253,7 @@ class [[nodiscard("unnecessary construction")]] await_async final // Implicitly convert a std::launch parameter used with std::async to an awaitable. GRAPHQLSERVICE_EXPORT await_async(std::launch launch); - GRAPHQLSERVICE_EXPORT [[nodiscard("unexpected call")]] bool await_ready() const; + [[nodiscard("unexpected call")]] GRAPHQLSERVICE_EXPORT bool await_ready() const; GRAPHQLSERVICE_EXPORT void await_suspend(coro::coroutine_handle<> h) const; GRAPHQLSERVICE_EXPORT void await_resume() const; }; @@ -296,8 +296,8 @@ struct [[nodiscard("unnecessary construction")]] SelectionSetParams // Pass a common bundle of parameters to all of the generated Object::getField accessors. struct [[nodiscard("unnecessary construction")]] FieldParams : SelectionSetParams { - GRAPHQLSERVICE_EXPORT explicit FieldParams(SelectionSetParams && selectionSetParams, - Directives directives); + GRAPHQLSERVICE_EXPORT explicit FieldParams( + SelectionSetParams&& selectionSetParams, Directives directives); // Each field owns its own field-specific directives. Once the accessor returns it will be // destroyed, but you can move it into another instance of response::Value to keep it alive @@ -316,7 +316,7 @@ class [[nodiscard("unnecessary construction")]] AwaitableScalar { public: template - AwaitableScalar(U && value) + AwaitableScalar(U&& value) : _value { std::forward(value) } { } @@ -446,7 +446,7 @@ class [[nodiscard("unnecessary construction")]] AwaitableObject { public: template - AwaitableObject(U && value) + AwaitableObject(U&& value) : _value { std::forward(value) } { } @@ -569,15 +569,11 @@ using FragmentMap = internal::string_view_map; struct [[nodiscard("unnecessary construction")]] ResolverParams : SelectionSetParams { GRAPHQLSERVICE_EXPORT explicit ResolverParams(const SelectionSetParams& selectionSetParams, - const peg::ast_node& field, - std::string&& fieldName, - response::Value arguments, - Directives fieldDirectives, - const peg::ast_node* selection, - const FragmentMap& fragments, + const peg::ast_node& field, std::string&& fieldName, response::Value arguments, + Directives fieldDirectives, const peg::ast_node* selection, const FragmentMap& fragments, const response::Value& variables); - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] schema_location getLocation() const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT schema_location getLocation() const; // These values are different for each resolver. const peg::ast_node& field; @@ -619,13 +615,11 @@ concept OnlyNoneModifiers = (... && (Other == TypeModifier::None)); // Test if the next modifier is Nullable. template -concept NullableModifier = Modifier == -TypeModifier::Nullable; +concept NullableModifier = Modifier == TypeModifier::Nullable; // Test if the next modifier is List. template -concept ListModifier = Modifier == -TypeModifier::List; +concept ListModifier = Modifier == TypeModifier::List; // Convert arguments and input types with a non-templated static method. template @@ -662,8 +656,7 @@ concept ScalarArgumentClass = std::is_same_v // Any non-scalar class used in an argument is a generated INPUT_OBJECT type. template -concept InputArgumentClass = std::is_class_v && ! -ScalarArgumentClass; +concept InputArgumentClass = std::is_class_v && !ScalarArgumentClass; // Special-case an innermost nullable INPUT_OBJECT type. template @@ -883,17 +876,14 @@ using TypeNames = internal::string_view_set; class [[nodiscard("unnecessary construction")]] Object : public std::enable_shared_from_this { public: - GRAPHQLSERVICE_EXPORT explicit Object(TypeNames && typeNames, - ResolverMap && resolvers) noexcept; + GRAPHQLSERVICE_EXPORT explicit Object(TypeNames&& typeNames, ResolverMap&& resolvers) noexcept; GRAPHQLSERVICE_EXPORT virtual ~Object() = default; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] AwaitableResolver resolve( - const SelectionSetParams& selectionSetParams, - const peg::ast_node& selection, - const FragmentMap& fragments, - const response::Value& variables) const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT AwaitableResolver resolve( + const SelectionSetParams& selectionSetParams, const peg::ast_node& selection, + const FragmentMap& fragments, const response::Value& variables) const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] bool matchesType( + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT bool matchesType( std::string_view typeName) const; protected: @@ -979,8 +969,7 @@ concept ObjectType = std::is_same_v; // Test if this Type inherits from Object but is not Object itself. template -concept ObjectDerivedType = ObjectBaseType && ! -ObjectType; +concept ObjectDerivedType = ObjectBaseType && !ObjectType; // Test if a nullable type is std::shared_ptr or std::optional. template @@ -994,8 +983,7 @@ concept NoneObjectDerivedType = OnlyNoneModifiers && ObjectDerivedType // Test all other result types to see if they should call the specialized convert method without // template parameters. template -concept NoneScalarOrObjectType = OnlyNoneModifiers && ! -ObjectDerivedType; +concept NoneScalarOrObjectType = OnlyNoneModifiers && !ObjectDerivedType; // Test if this method should return a nullable std::shared_ptr template @@ -1452,10 +1440,8 @@ using TypeMap = internal::string_view_map>; struct [[nodiscard("unnecessary construction")]] OperationData : std::enable_shared_from_this { - explicit OperationData(std::shared_ptr state, - response::Value variables, - Directives directives, - FragmentMap fragments); + explicit OperationData(std::shared_ptr state, response::Value variables, + Directives directives, FragmentMap fragments); std::shared_ptr state; response::Value variables; @@ -1467,13 +1453,9 @@ struct [[nodiscard("unnecessary construction")]] OperationData struct [[nodiscard("unnecessary construction")]] SubscriptionData : std::enable_shared_from_this { - explicit SubscriptionData(std::shared_ptr data, - SubscriptionName && field, - response::Value arguments, - Directives fieldDirectives, - peg::ast && query, - std::string && operationName, - SubscriptionCallback && callback, + explicit SubscriptionData(std::shared_ptr data, SubscriptionName&& field, + response::Value arguments, Directives fieldDirectives, peg::ast&& query, + std::string&& operationName, SubscriptionCallback&& callback, const peg::ast_node& selection); std::shared_ptr data; @@ -1504,34 +1486,33 @@ class [[nodiscard("unnecessary construction")]] Request : public std::enable_shared_from_this { protected: - GRAPHQLSERVICE_EXPORT explicit Request(TypeMap operationTypes, - std::shared_ptr - schema); + GRAPHQLSERVICE_EXPORT explicit Request( + TypeMap operationTypes, std::shared_ptr schema); GRAPHQLSERVICE_EXPORT virtual ~Request(); public: - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::list validate( - peg::ast & query) const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::list validate( + peg::ast& query) const; GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::pair - findOperationDefinition(peg::ast & query, std::string_view operationName) const; + findOperationDefinition(peg::ast& query, std::string_view operationName) const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] response::AwaitableValue resolve( + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT response::AwaitableValue resolve( RequestResolveParams params) const; - GRAPHQLSERVICE_EXPORT [[nodiscard("leaked subscription")]] AwaitableSubscribe subscribe( + [[nodiscard("leaked subscription")]] GRAPHQLSERVICE_EXPORT AwaitableSubscribe subscribe( RequestSubscribeParams params); - GRAPHQLSERVICE_EXPORT [[nodiscard("potentially leaked subscription")]] AwaitableUnsubscribe + [[nodiscard("potentially leaked subscription")]] GRAPHQLSERVICE_EXPORT AwaitableUnsubscribe unsubscribe(RequestUnsubscribeParams params); - GRAPHQLSERVICE_EXPORT [[nodiscard("potentially leaked event")]] AwaitableDeliver deliver( + [[nodiscard("potentially leaked event")]] GRAPHQLSERVICE_EXPORT AwaitableDeliver deliver( RequestDeliverParams params) const; private: [[nodiscard("leaked subscription")]] SubscriptionKey addSubscription( - RequestSubscribeParams && params); + RequestSubscribeParams&& params); void removeSubscription(SubscriptionKey key); [[nodiscard("unnecessary call")]] std::vector> - collectRegistrations(std::string_view field, RequestDeliverFilter && filter) const noexcept; + collectRegistrations(std::string_view field, RequestDeliverFilter&& filter) const noexcept; const TypeMap _operations; mutable std::mutex _validationMutex {}; diff --git a/include/graphqlservice/internal/Base64.h b/include/graphqlservice/internal/Base64.h index 451965f5..163e1e84 100644 --- a/include/graphqlservice/internal/Base64.h +++ b/include/graphqlservice/internal/Base64.h @@ -42,7 +42,7 @@ class Base64 } // Convert a Base64-encoded string to a vector of bytes. - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary conversion")]] static std::vector + [[nodiscard("unnecessary conversion")]] GRAPHQLRESPONSE_EXPORT static std::vector fromBase64(std::string_view encoded); // Map a single 6-bit integer value to its Base64-encoded character. @@ -56,7 +56,7 @@ class Base64 } // Convert a set of bytes to Base64. - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary conversion")]] static std::string toBase64( + [[nodiscard("unnecessary conversion")]] GRAPHQLRESPONSE_EXPORT static std::string toBase64( const std::vector& bytes); enum class [[nodiscard("unnecessary call")]] Comparison { @@ -69,11 +69,11 @@ class Base64 }; // Compare a set of bytes to a possible Base64 string without performing any heap allocations. - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] static Comparison compareBase64( + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT static Comparison compareBase64( const std::vector& bytes, std::string_view maybeEncoded) noexcept; // Validate whether or not a string is valid Base64 without performing any heap allocations. - GRAPHQLRESPONSE_EXPORT [[nodiscard("unnecessary call")]] static bool validateBase64( + [[nodiscard("unnecessary call")]] GRAPHQLRESPONSE_EXPORT static bool validateBase64( std::string_view maybeEncoded) noexcept; private: diff --git a/include/graphqlservice/internal/Introspection.h b/include/graphqlservice/internal/Introspection.h index 404ededa..885af384 100644 --- a/include/graphqlservice/internal/Introspection.h +++ b/include/graphqlservice/internal/Introspection.h @@ -25,18 +25,19 @@ class [[nodiscard("unnecessary construction")]] Schema GRAPHQLSERVICE_EXPORT explicit Schema(const std::shared_ptr& schema); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::optional + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional getDescription() const; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] std::vector> getTypes() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::shared_ptr + [[nodiscard( + "unnecessary call")]] GRAPHQLSERVICE_EXPORT std::vector> + getTypes() const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::shared_ptr getQueryType() const; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] std::shared_ptr getMutationType() const; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] std::shared_ptr getSubscriptionType() const; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] std::vector> + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::shared_ptr + getMutationType() const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::shared_ptr + getSubscriptionType() const; + [[nodiscard( + "unnecessary call")]] GRAPHQLSERVICE_EXPORT std::vector> getDirectives() const; private: @@ -49,30 +50,29 @@ class [[nodiscard("unnecessary construction")]] Type GRAPHQLSERVICE_EXPORT explicit Type(const std::shared_ptr& type); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] TypeKind getKind() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::optional getName() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT TypeKind getKind() const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional getName() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::optional + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional getDescription() const; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] std::optional>> - getFields(std::optional && includeDeprecatedArg) const; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] std::optional>> + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional< + std::vector>> + getFields(std::optional&& includeDeprecatedArg) const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional< + std::vector>> getInterfaces() const; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] std::optional>> + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional< + std::vector>> getPossibleTypes() const; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] std::optional>> - getEnumValues(std::optional && includeDeprecatedArg) const; - GRAPHQLSERVICE_EXPORT - [[nodiscard( - "unnecessary call")]] std::optional>> + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional< + std::vector>> + getEnumValues(std::optional&& includeDeprecatedArg) const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional< + std::vector>> getInputFields() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::shared_ptr + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::shared_ptr getOfType() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::optional + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional getSpecifiedByURL() const; private: @@ -85,16 +85,16 @@ class [[nodiscard("unnecessary construction")]] Field GRAPHQLSERVICE_EXPORT explicit Field(const std::shared_ptr& field); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string getName() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::optional + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string getName() const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional getDescription() const; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] std::vector> getArgs() - const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::shared_ptr getType() + [[nodiscard( + "unnecessary call")]] GRAPHQLSERVICE_EXPORT std::vector> + getArgs() const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::shared_ptr getType() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] bool getIsDeprecated() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::optional + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT bool getIsDeprecated() const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional getDeprecationReason() const; private: @@ -108,12 +108,12 @@ class [[nodiscard("unnecessary construction")]] InputValue const std::shared_ptr& inputValue); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string getName() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::optional + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string getName() const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional getDescription() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::shared_ptr getType() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::shared_ptr getType() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::optional + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional getDefaultValue() const; private: @@ -127,11 +127,11 @@ class [[nodiscard("unnecessary construction")]] EnumValue const std::shared_ptr& enumValue); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string getName() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::optional + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string getName() const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional getDescription() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] bool getIsDeprecated() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::optional + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT bool getIsDeprecated() const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional getDeprecationReason() const; private: @@ -145,15 +145,15 @@ class [[nodiscard("unnecessary construction")]] Directive const std::shared_ptr& directive); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string getName() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::optional + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string getName() const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::optional getDescription() const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::vector + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::vector getLocations() const; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] std::vector> getArgs() - const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] bool getIsRepeatable() const; + [[nodiscard( + "unnecessary call")]] GRAPHQLSERVICE_EXPORT std::vector> + getArgs() const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT bool getIsRepeatable() const; private: const std::shared_ptr _directive; diff --git a/include/graphqlservice/internal/Schema.h b/include/graphqlservice/internal/Schema.h index 53c33cbe..24480943 100644 --- a/include/graphqlservice/internal/Schema.h +++ b/include/graphqlservice/internal/Schema.h @@ -37,39 +37,35 @@ class EnumValue; class [[nodiscard("unnecessary construction")]] Schema : public std::enable_shared_from_this { public: - GRAPHQLSERVICE_EXPORT explicit Schema(bool noIntrospection = false, - std::string_view description = ""); + GRAPHQLSERVICE_EXPORT explicit Schema( + bool noIntrospection = false, std::string_view description = ""); GRAPHQLSERVICE_EXPORT void AddQueryType(std::shared_ptr query); GRAPHQLSERVICE_EXPORT void AddMutationType(std::shared_ptr mutation); GRAPHQLSERVICE_EXPORT void AddSubscriptionType(std::shared_ptr subscription); GRAPHQLSERVICE_EXPORT void AddType(std::string_view name, std::shared_ptr type); - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::shared_ptr& LookupType( - std::string_view name) const; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::shared_ptr + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::shared_ptr& + LookupType(std::string_view name) const; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::shared_ptr WrapType(introspection::TypeKind kind, std::shared_ptr ofType); GRAPHQLSERVICE_EXPORT void AddDirective(std::shared_ptr directive); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] bool supportsIntrospection() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT bool supportsIntrospection() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view description() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view description() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] const std::vector< + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::vector< std::pair>>& types() const noexcept; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::shared_ptr& queryType() - const noexcept; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::shared_ptr& mutationType() - const noexcept; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::shared_ptr& subscriptionType() - const noexcept; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::vector>& + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::shared_ptr& + queryType() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::shared_ptr& + mutationType() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::shared_ptr& + subscriptionType() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::vector< + std::shared_ptr>& directives() const noexcept; private: @@ -97,32 +93,31 @@ class [[nodiscard("unnecessary construction")]] BaseType GRAPHQLSERVICE_EXPORT virtual ~BaseType() = default; // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] introspection::TypeKind kind() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT introspection::TypeKind kind() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] virtual std::string_view name() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT virtual std::string_view name() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view description() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view description() const noexcept; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] virtual const std::vector>& - fields() const noexcept; - GRAPHQLSERVICE_EXPORT - [[nodiscard( - "unnecessary call")]] virtual const std::vector>& + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT virtual const std::vector< + std::shared_ptr>& + fields() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT virtual const std::vector< + std::shared_ptr>& interfaces() const noexcept; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] virtual const std::vector>& - possibleTypes() const noexcept; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] virtual const std::vector>& + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT virtual const std::vector< + std::weak_ptr>& + possibleTypes() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT virtual const std::vector< + std::shared_ptr>& enumValues() const noexcept; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] virtual const std::vector>& + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT virtual const std::vector< + std::shared_ptr>& inputFields() const noexcept; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] virtual const std::weak_ptr& - ofType() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] virtual std::string_view + [[nodiscard( + "unnecessary call")]] GRAPHQLSERVICE_EXPORT virtual const std::weak_ptr& + ofType() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT virtual std::string_view specifiedByURL() const noexcept; protected: @@ -141,17 +136,15 @@ class [[nodiscard("unnecessary construction")]] ScalarType : public BaseType struct init; public: - explicit ScalarType(init && params); + explicit ScalarType(init&& params); - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] static std::shared_ptr Make( - std::string_view name, - std::string_view description, - std::string_view specifiedByURL); + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT static std::shared_ptr Make( + std::string_view name, std::string_view description, std::string_view specifiedByURL); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view name() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept final; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view specifiedByURL() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view specifiedByURL() const noexcept final; private: @@ -167,25 +160,24 @@ class [[nodiscard("unnecessary construction")]] ObjectType : public BaseType struct init; public: - explicit ObjectType(init && params); + explicit ObjectType(init&& params); - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] static std::shared_ptr Make( - std::string_view name, - std::string_view description); + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT static std::shared_ptr Make( + std::string_view name, std::string_view description); GRAPHQLSERVICE_EXPORT void AddInterfaces( - std::vector> && interfaces); - GRAPHQLSERVICE_EXPORT void AddFields(std::vector> && fields); + std::vector>&& interfaces); + GRAPHQLSERVICE_EXPORT void AddFields(std::vector>&& fields); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view name() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept final; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::vector>& - fields() const noexcept final; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::vector>& - interfaces() const noexcept final; + [[nodiscard( + "unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::vector>& + fields() const noexcept final; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::vector< + std::shared_ptr>& + interfaces() const noexcept final; private: const std::string_view _name; @@ -202,28 +194,28 @@ class [[nodiscard("unnecessary construction")]] InterfaceType : public BaseType struct init; public: - explicit InterfaceType(init && params); + explicit InterfaceType(init&& params); - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] static std::shared_ptr + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT static std::shared_ptr Make(std::string_view name, std::string_view description); GRAPHQLSERVICE_EXPORT void AddPossibleType(std::weak_ptr possibleType); GRAPHQLSERVICE_EXPORT void AddInterfaces( - std::vector> && interfaces); - GRAPHQLSERVICE_EXPORT void AddFields(std::vector> && fields); + std::vector>&& interfaces); + GRAPHQLSERVICE_EXPORT void AddFields(std::vector>&& fields); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view name() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept final; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::vector>& - fields() const noexcept final; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::vector>& - possibleTypes() const noexcept final; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::vector>& - interfaces() const noexcept final; + [[nodiscard( + "unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::vector>& + fields() const noexcept final; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::vector< + std::weak_ptr>& + possibleTypes() const noexcept final; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::vector< + std::shared_ptr>& + interfaces() const noexcept final; private: const std::string_view _name; @@ -241,21 +233,20 @@ class [[nodiscard("unnecessary construction")]] UnionType : public BaseType struct init; public: - explicit UnionType(init && params); + explicit UnionType(init&& params); - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] static std::shared_ptr Make( - std::string_view name, - std::string_view description); + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT static std::shared_ptr Make( + std::string_view name, std::string_view description); GRAPHQLSERVICE_EXPORT void AddPossibleTypes( - std::vector> && possibleTypes); + std::vector>&& possibleTypes); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view name() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept final; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::vector>& - possibleTypes() const noexcept final; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::vector< + std::weak_ptr>& + possibleTypes() const noexcept final; private: const std::string_view _name; @@ -278,20 +269,19 @@ class [[nodiscard("unnecessary construction")]] EnumType : public BaseType struct init; public: - explicit EnumType(init && params); + explicit EnumType(init&& params); - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] static std::shared_ptr Make( - std::string_view name, - std::string_view description); + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT static std::shared_ptr Make( + std::string_view name, std::string_view description); - GRAPHQLSERVICE_EXPORT void AddEnumValues(std::vector && enumValues); + GRAPHQLSERVICE_EXPORT void AddEnumValues(std::vector&& enumValues); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view name() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept final; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::vector>& - enumValues() const noexcept final; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::vector< + std::shared_ptr>& + enumValues() const noexcept final; private: const std::string_view _name; @@ -307,20 +297,20 @@ class [[nodiscard("unnecessary construction")]] InputObjectType : public BaseTyp struct init; public: - explicit InputObjectType(init && params); + explicit InputObjectType(init&& params); - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] static std::shared_ptr + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT static std::shared_ptr Make(std::string_view name, std::string_view description); GRAPHQLSERVICE_EXPORT void AddInputValues( - std::vector> && inputValues); + std::vector>&& inputValues); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view name() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept final; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::vector>& - inputFields() const noexcept final; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::vector< + std::shared_ptr>& + inputFields() const noexcept final; private: const std::string_view _name; @@ -336,13 +326,13 @@ class [[nodiscard("unnecessary construction")]] WrapperType : public BaseType struct init; public: - explicit WrapperType(init && params); + explicit WrapperType(init&& params); - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] static std::shared_ptr + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT static std::shared_ptr Make(introspection::TypeKind kind, std::weak_ptr ofType); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] const std::weak_ptr& + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::weak_ptr& ofType() const noexcept final; private: @@ -357,27 +347,23 @@ class [[nodiscard("unnecessary construction")]] Field : public std::enable_share struct init; public: - explicit Field(init && params); - - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] static std::shared_ptr Make( - std::string_view name, - std::string_view description, - std::optional - deprecationReason, - std::weak_ptr - type, + explicit Field(init&& params); + + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT static std::shared_ptr Make( + std::string_view name, std::string_view description, + std::optional deprecationReason, std::weak_ptr type, std::vector>&& args = {}); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view name() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view description() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view description() const noexcept; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::vector>& - args() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] const std::weak_ptr& + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::vector< + std::shared_ptr>& + args() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::weak_ptr& type() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] const std::optional& + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::optional& deprecationReason() const noexcept; private: @@ -397,22 +383,19 @@ class [[nodiscard("unnecessary construction")]] InputValue struct init; public: - explicit InputValue(init && params); + explicit InputValue(init&& params); - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] static std::shared_ptr Make( - std::string_view name, - std::string_view description, - std::weak_ptr - type, + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT static std::shared_ptr Make( + std::string_view name, std::string_view description, std::weak_ptr type, std::string_view defaultValue); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view name() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view description() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view description() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] const std::weak_ptr& + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::weak_ptr& type() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view defaultValue() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view defaultValue() const noexcept; private: @@ -431,19 +414,17 @@ class [[nodiscard("unnecessary construction")]] EnumValue struct init; public: - explicit EnumValue(init && params); + explicit EnumValue(init&& params); - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] static std::shared_ptr Make( - std::string_view name, - std::string_view description, - std::optional - deprecationReason); + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT static std::shared_ptr Make( + std::string_view name, std::string_view description, + std::optional deprecationReason); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view name() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view description() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view description() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] const std::optional& + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::optional& deprecationReason() const noexcept; private: @@ -461,26 +442,24 @@ class [[nodiscard("unnecessary construction")]] Directive struct init; public: - explicit Directive(init && params); + explicit Directive(init&& params); - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] static std::shared_ptr Make( - std::string_view name, - std::string_view description, - std::vector && locations, - std::vector> && args, - bool isRepeatable); + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT static std::shared_ptr Make( + std::string_view name, std::string_view description, + std::vector&& locations, + std::vector>&& args, bool isRepeatable); // Accessors - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view name() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] std::string_view description() + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::string_view description() const noexcept; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::vector& - locations() const noexcept; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] const std::vector>& - args() const noexcept; - GRAPHQLSERVICE_EXPORT [[nodiscard("unnecessary call")]] bool isRepeatable() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::vector< + introspection::DirectiveLocation>& + locations() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT const std::vector< + std::shared_ptr>& + args() const noexcept; + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT bool isRepeatable() const noexcept; private: const std::string_view _name; From f4ec887acc53758b51baabb42bc1f3791dfef5a8 Mon Sep 17 00:00:00 2001 From: Bill Avery Date: Sun, 11 Jun 2023 20:33:03 -0700 Subject: [PATCH 2/8] Missed method in regex search/replace --- include/graphqlservice/GraphQLService.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/graphqlservice/GraphQLService.h b/include/graphqlservice/GraphQLService.h index 4f7d770f..0e7f2ea6 100644 --- a/include/graphqlservice/GraphQLService.h +++ b/include/graphqlservice/GraphQLService.h @@ -1494,8 +1494,8 @@ class [[nodiscard("unnecessary construction")]] Request [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::list validate( peg::ast& query) const; - GRAPHQLSERVICE_EXPORT - [[nodiscard("unnecessary call")]] std::pair + [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::pair findOperationDefinition(peg::ast& query, std::string_view operationName) const; [[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT response::AwaitableValue resolve( From d24f190bea2e9b8f2bfbf56bc3f9c14b3da0ffbf Mon Sep 17 00:00:00 2001 From: Bill Avery Date: Fri, 16 Jun 2023 17:50:18 -0700 Subject: [PATCH 3/8] vcpkg x-update-baseline --add-initial-baseline --- vcpkg.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index 31514ab0..40e9ba0f 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -43,5 +43,6 @@ "dependencies": [ "pegtl", "rapidjson" - ] + ], + "builtin-baseline": "fbc868ee5e12e3e81f464104be246ec06553c274" } From 68d44a7564c102c91c8e7f580dbe8b3183dea941 Mon Sep 17 00:00:00 2001 From: Bill Avery Date: Fri, 16 Jun 2023 18:21:45 -0700 Subject: [PATCH 4/8] Rollback to last known commit in macOS vcpkg --- vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index 40e9ba0f..cdf3bdb3 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -44,5 +44,5 @@ "pegtl", "rapidjson" ], - "builtin-baseline": "fbc868ee5e12e3e81f464104be246ec06553c274" + "builtin-baseline": "a618637937298060bdbe5fbcfb628eabd1082c8a" } From 3f1efc71c365f33c3142ef485285e2721fea4f77 Mon Sep 17 00:00:00 2001 From: Bill Avery Date: Sat, 17 Jun 2023 12:07:35 -0700 Subject: [PATCH 5/8] Fix JSONResponse.h missed in regex replace --- include/graphqlservice/JSONResponse.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/graphqlservice/JSONResponse.h b/include/graphqlservice/JSONResponse.h index 4293300f..c264fd82 100644 --- a/include/graphqlservice/JSONResponse.h +++ b/include/graphqlservice/JSONResponse.h @@ -22,9 +22,9 @@ namespace graphql::response { -JSONRESPONSE_EXPORT [[nodiscard("unnecessary conversion")]] std::string toJSON(Value&& response); +[[nodiscard("unnecessary conversion")]] JSONRESPONSE_EXPORT std::string toJSON(Value&& response); -JSONRESPONSE_EXPORT [[nodiscard("unnecessary conversion")]] Value parseJSON( +[[nodiscard("unnecessary conversion")]] JSONRESPONSE_EXPORT Value parseJSON( const std::string& json); } // namespace graphql::response From 5164d88091b3dcd0d6afd63853f646ffa3e93ab9 Mon Sep 17 00:00:00 2001 From: Bill Avery Date: Sat, 17 Jun 2023 12:08:50 -0700 Subject: [PATCH 6/8] Use custom rules for RC files with x64-Clang configs in VS --- src/CMakeLists.txt | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 02c3208c..4b6d4412 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,7 +48,17 @@ if(WIN32) if(BUILD_SHARED_LIBS) function(add_version_rc target) - add_library(${target}_version OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/../res/${target}_version.rc) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}_version.rc.res + COMMAND ${CMAKE_RC_COMPILER} ${CMAKE_RC_FLAGS} $<$:${CMAKE_RC_FLAGS_DEBUG}> + "/fo${CMAKE_CURRENT_BINARY_DIR}/${target}_version.rc.res" + "${CMAKE_CURRENT_SOURCE_DIR}/../res/${target}_version.rc" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../res/${target}_version.rc") + add_custom_target(build_${target}_version_rc ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${target}_version.rc.res) + + add_library(${target}_version OBJECT ${CMAKE_CURRENT_BINARY_DIR}/${target}_version.rc.res) + set_target_properties(${target}_version PROPERTIES LINKER_LANGUAGE CXX) + add_dependencies(${target}_version build_${target}_version_rc) target_link_libraries(${target} PRIVATE ${target}_version) endfunction() endif() @@ -193,7 +203,17 @@ if(GRAPHQL_BUILD_CLIENTGEN) endif() if(WIN32) - add_library(clientgen_version OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/../res/ClientGen.rc) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ClientGen.rc.res + COMMAND ${CMAKE_RC_COMPILER} ${CMAKE_RC_FLAGS} $<$:${CMAKE_RC_FLAGS_DEBUG}> + "/fo${CMAKE_CURRENT_BINARY_DIR}/ClientGen.rc.res" + "${CMAKE_CURRENT_SOURCE_DIR}/../res/ClientGen.rc" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../res/ClientGen.rc") + add_custom_target(build_clientgen_rc ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ClientGen.rc.res) + + add_library(clientgen_version OBJECT ${CMAKE_CURRENT_BINARY_DIR}/ClientGen.rc.res) + set_target_properties(clientgen_version PROPERTIES LINKER_LANGUAGE CXX) + add_dependencies(clientgen_version build_clientgen_rc) target_link_libraries(clientgen PRIVATE clientgen_version) endif() @@ -231,7 +251,17 @@ if(GRAPHQL_BUILD_SCHEMAGEN) endif() if(WIN32) - add_library(schemagen_version OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/../res/SchemaGen.rc) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SchemaGen.rc.res + COMMAND ${CMAKE_RC_COMPILER} ${CMAKE_RC_FLAGS} $<$:${CMAKE_RC_FLAGS_DEBUG}> + "/fo${CMAKE_CURRENT_BINARY_DIR}/SchemaGen.rc.res" + "${CMAKE_CURRENT_SOURCE_DIR}/../res/SchemaGen.rc" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../res/SchemaGen.rc") + add_custom_target(build_schemagen_rc ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SchemaGen.rc.res) + + add_library(schemagen_version OBJECT ${CMAKE_CURRENT_BINARY_DIR}/SchemaGen.rc.res) + set_target_properties(schemagen_version PROPERTIES LINKER_LANGUAGE CXX) + add_dependencies(schemagen_version build_schemagen_rc) target_link_libraries(schemagen PRIVATE schemagen_version) endif() From ad194d5bb0a62237fc2c23acbc0544be8cf518c9 Mon Sep 17 00:00:00 2001 From: Bill Avery Date: Sun, 25 Jun 2023 14:51:31 -0700 Subject: [PATCH 7/8] Detect toolchains that don't support co_await in Boost.Asio --- cmake/test_boost_beast.cpp | 15 +++++++++++++++ samples/CMakeLists.txt | 10 ++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 cmake/test_boost_beast.cpp diff --git a/cmake/test_boost_beast.cpp b/cmake/test_boost_beast.cpp new file mode 100644 index 00000000..b59b338a --- /dev/null +++ b/cmake/test_boost_beast.cpp @@ -0,0 +1,15 @@ +// This is a dummy program that just needs to compile to tell us if Boost.Asio +// supports co_await and Boost.Beast is installed. + +#include + +#include + +int main() +{ +#ifdef BOOST_ASIO_HAS_CO_AWAIT + return 0; +#else + #error BOOST_ASIO_HAS_CO_AWAIT is undefined +#endif +} \ No newline at end of file diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index ba79854e..bddfd792 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -12,11 +12,17 @@ if(GRAPHQL_BUILD_HTTP_SAMPLE) find_package(Boost QUIET) if(Boost_FOUND) if(Boost_VERSION VERSION_GREATER_EQUAL "1.81.0") - if(EXISTS "${Boost_INCLUDE_DIR}/boost/beast.hpp") + try_compile(TEST_RESULT + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/test_boost_beast.cpp + CMAKE_FLAGS -DINCLUDE_DIRECTORIES:STRING=${Boost_INCLUDE_DIR} + CXX_STANDARD 20) + + if(TEST_RESULT) message(STATUS "Using Boost.Beast ${Boost_VERSION}") add_subdirectory(proxy) else() - message(WARNING "GRAPHQL_BUILD_HTTP_SAMPLE requires the Boost.Beast header-only library, but it was not found in ${Boost_INCLUDE_DIR}.") + message(WARNING "GRAPHQL_BUILD_HTTP_SAMPLE requires the Boost.Beast header-only library and a toolchain that supports co_await in Boost.Asio.") endif() else() message(WARNING "GRAPHQL_BUILD_HTTP_SAMPLE requires the Boost.Beast header-only library >= 1.81.0, but only ${Boost_VERSION} was found in ${Boost_INCLUDE_DIR}.") From 1d5486996a71bde144a40bd290d495a3ed42af30 Mon Sep 17 00:00:00 2001 From: Bill Avery Date: Sun, 25 Jun 2023 15:04:35 -0700 Subject: [PATCH 8/8] Bump the patch version --- cmake/version.txt | 2 +- include/graphqlservice/internal/Version.h | 4 ++-- res/ClientGen.rc | 4 ++-- res/SchemaGen.rc | 4 ++-- res/graphqlclient_version.rc | 4 ++-- res/graphqljson_version.rc | 4 ++-- res/graphqlpeg_version.rc | 4 ++-- res/graphqlresponse_version.rc | 4 ++-- res/graphqlservice_version.rc | 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cmake/version.txt b/cmake/version.txt index ae6e65bd..d01c9f66 100644 --- a/cmake/version.txt +++ b/cmake/version.txt @@ -1 +1 @@ -4.5.3 \ No newline at end of file +4.5.4 \ No newline at end of file diff --git a/include/graphqlservice/internal/Version.h b/include/graphqlservice/internal/Version.h index 30e07ffa..7913c244 100644 --- a/include/graphqlservice/internal/Version.h +++ b/include/graphqlservice/internal/Version.h @@ -10,11 +10,11 @@ namespace graphql::internal { -constexpr std::string_view FullVersion { "4.5.3" }; +constexpr std::string_view FullVersion { "4.5.4" }; constexpr size_t MajorVersion = 4; constexpr size_t MinorVersion = 5; -constexpr size_t PatchVersion = 3; +constexpr size_t PatchVersion = 4; } // namespace graphql::internal diff --git a/res/ClientGen.rc b/res/ClientGen.rc index 3b6f435f..08e74717 100644 --- a/res/ClientGen.rc +++ b/res/ClientGen.rc @@ -3,8 +3,8 @@ #include -#define GRAPHQL_RC_VERSION 4,5,3,0 -#define GRAPHQL_RC_VERSION_STR "4.5.3" +#define GRAPHQL_RC_VERSION 4,5,4,0 +#define GRAPHQL_RC_VERSION_STR "4.5.4" #ifndef DEBUG #define VER_DEBUG 0 diff --git a/res/SchemaGen.rc b/res/SchemaGen.rc index 843402c3..ea81cc60 100644 --- a/res/SchemaGen.rc +++ b/res/SchemaGen.rc @@ -3,8 +3,8 @@ #include -#define GRAPHQL_RC_VERSION 4,5,3,0 -#define GRAPHQL_RC_VERSION_STR "4.5.3" +#define GRAPHQL_RC_VERSION 4,5,4,0 +#define GRAPHQL_RC_VERSION_STR "4.5.4" #ifndef DEBUG #define VER_DEBUG 0 diff --git a/res/graphqlclient_version.rc b/res/graphqlclient_version.rc index 146c3a85..7ceb7bec 100644 --- a/res/graphqlclient_version.rc +++ b/res/graphqlclient_version.rc @@ -3,8 +3,8 @@ #include -#define GRAPHQL_RC_VERSION 4,5,3,0 -#define GRAPHQL_RC_VERSION_STR "4.5.3" +#define GRAPHQL_RC_VERSION 4,5,4,0 +#define GRAPHQL_RC_VERSION_STR "4.5.4" #ifndef DEBUG #define VER_DEBUG 0 diff --git a/res/graphqljson_version.rc b/res/graphqljson_version.rc index d1f97958..d19660f6 100644 --- a/res/graphqljson_version.rc +++ b/res/graphqljson_version.rc @@ -3,8 +3,8 @@ #include -#define GRAPHQL_RC_VERSION 4,5,3,0 -#define GRAPHQL_RC_VERSION_STR "4.5.3" +#define GRAPHQL_RC_VERSION 4,5,4,0 +#define GRAPHQL_RC_VERSION_STR "4.5.4" #ifndef DEBUG #define VER_DEBUG 0 diff --git a/res/graphqlpeg_version.rc b/res/graphqlpeg_version.rc index bb5ffef2..b3401c9a 100644 --- a/res/graphqlpeg_version.rc +++ b/res/graphqlpeg_version.rc @@ -3,8 +3,8 @@ #include -#define GRAPHQL_RC_VERSION 4,5,3,0 -#define GRAPHQL_RC_VERSION_STR "4.5.3" +#define GRAPHQL_RC_VERSION 4,5,4,0 +#define GRAPHQL_RC_VERSION_STR "4.5.4" #ifndef DEBUG #define VER_DEBUG 0 diff --git a/res/graphqlresponse_version.rc b/res/graphqlresponse_version.rc index a387322f..870b7bf5 100644 --- a/res/graphqlresponse_version.rc +++ b/res/graphqlresponse_version.rc @@ -3,8 +3,8 @@ #include -#define GRAPHQL_RC_VERSION 4,5,3,0 -#define GRAPHQL_RC_VERSION_STR "4.5.3" +#define GRAPHQL_RC_VERSION 4,5,4,0 +#define GRAPHQL_RC_VERSION_STR "4.5.4" #ifndef DEBUG #define VER_DEBUG 0 diff --git a/res/graphqlservice_version.rc b/res/graphqlservice_version.rc index d7826987..d8517603 100644 --- a/res/graphqlservice_version.rc +++ b/res/graphqlservice_version.rc @@ -3,8 +3,8 @@ #include -#define GRAPHQL_RC_VERSION 4,5,3,0 -#define GRAPHQL_RC_VERSION_STR "4.5.3" +#define GRAPHQL_RC_VERSION 4,5,4,0 +#define GRAPHQL_RC_VERSION_STR "4.5.4" #ifndef DEBUG #define VER_DEBUG 0