Skip to content

Commit

Permalink
Merge pull request #292 from wravery/reorder-attributes
Browse files Browse the repository at this point in the history
Fix DLL export attribute order for clang on Windows
  • Loading branch information
wravery committed Jun 25, 2023
2 parents 00a6d4b + 1d54869 commit 1d65922
Show file tree
Hide file tree
Showing 23 changed files with 397 additions and 402 deletions.
15 changes: 15 additions & 0 deletions cmake/test_boost_beast.cpp
Original file line number Diff line number Diff line change
@@ -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 <boost/asio/use_awaitable.hpp>

#include <boost/beast.hpp>

int main()
{
#ifdef BOOST_ASIO_HAS_CO_AWAIT
return 0;
#else
#error BOOST_ASIO_HAS_CO_AWAIT is undefined
#endif
}
2 changes: 1 addition & 1 deletion cmake/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.5.3
4.5.4
6 changes: 3 additions & 3 deletions doc/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -64,7 +64,7 @@ The `internal::Awaitable<T>` 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`
Expand Down Expand Up @@ -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<std::string_view, const peg::ast_node*>
[[nodiscard("unnecessary call")]] GRAPHQLSERVICE_EXPORT std::pair<std::string_view, const peg::ast_node*>
findOperationDefinition(peg::ast& query, std::string_view operationName) const;
```
39 changes: 17 additions & 22 deletions include/Validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ using ValidateArgumentVariant = std::variant<ValidateArgumentVariable, int, doub

struct [[nodiscard("unnecessary construction")]] ValidateArgumentValue
{
ValidateArgumentValue(ValidateArgumentVariable && value);
ValidateArgumentValue(ValidateArgumentVariable&& value);
ValidateArgumentValue(int value);
ValidateArgumentValue(double value);
ValidateArgumentValue(std::string_view value);
ValidateArgumentValue(bool value);
ValidateArgumentValue(ValidateArgumentEnumValue && value);
ValidateArgumentValue(ValidateArgumentList && value);
ValidateArgumentValue(ValidateArgumentMap && value);
ValidateArgumentValue(ValidateArgumentEnumValue&& value);
ValidateArgumentValue(ValidateArgumentList&& value);
ValidateArgumentValue(ValidateArgumentMap&& value);

ValidateArgumentVariant data;
};
Expand All @@ -102,7 +102,7 @@ struct [[nodiscard("unnecessary construction")]] ValidateArgumentValue
class [[nodiscard("unnecessary construction")]] ValidateArgumentValueVisitor
{
public:
ValidateArgumentValueVisitor(std::list<schema_error> & errors);
ValidateArgumentValueVisitor(std::list<schema_error>& errors);

void visit(const peg::ast_node& value);

Expand All @@ -127,10 +127,8 @@ using ValidateFieldArguments = internal::string_view_map<ValidateArgumentValuePt

struct [[nodiscard("unnecessary construction")]] ValidateField
{
ValidateField(ValidateType && returnType,
ValidateType && objectType,
std::string_view fieldName,
ValidateFieldArguments && arguments);
ValidateField(ValidateType&& returnType, ValidateType&& objectType, std::string_view fieldName,
ValidateFieldArguments&& arguments);

[[nodiscard("unnecessary call")]] bool operator==(const ValidateField& other) const;

Expand All @@ -147,8 +145,8 @@ using ValidateTypes = internal::string_view_map<ValidateType>;
class [[nodiscard("unnecessary construction")]] ValidateVariableTypeVisitor
{
public:
ValidateVariableTypeVisitor(const std::shared_ptr<schema::Schema>& schema,
const ValidateTypes& types);
ValidateVariableTypeVisitor(
const std::shared_ptr<schema::Schema>& schema, const ValidateTypes& types);

void visit(const peg::ast_node& typeName);

Expand Down Expand Up @@ -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<schema_error>
[[nodiscard("unnecessary construction")]] GRAPHQLSERVICE_EXPORT std::list<schema_error>
getStructuredErrors();

private:
Expand All @@ -201,12 +199,11 @@ class [[nodiscard("unnecessary construction")]] ValidateExecutableVisitor
[[nodiscard("unnecessary call")]] static const ValidateType& getValidateFieldType(
const InputFieldTypes::mapped_type& value);
template <class _FieldTypes>
[[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 <class _FieldTypes>
[[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);
Expand All @@ -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::Schema> _schema;
Expand Down
11 changes: 4 additions & 7 deletions include/graphqlservice/GraphQLClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -105,22 +105,19 @@ concept ScalarVariableClass = std::is_same_v<Type, std::string>

// Any non-scalar class used in a variable is a generated INPUT_OBJECT type.
template <typename Type>
concept InputVariableClass = std::is_class_v<Type> && !
ScalarVariableClass<Type>;
concept InputVariableClass = std::is_class_v<Type> && !ScalarVariableClass<Type>;

// Test if there are any non-None modifiers left.
template <TypeModifier... Other>
concept OnlyNoneModifiers = (... && (Other == TypeModifier::None));

// Test if the next modifier is Nullable.
template <TypeModifier Modifier>
concept NullableModifier = Modifier ==
TypeModifier::Nullable;
concept NullableModifier = Modifier == TypeModifier::Nullable;

// Test if the next modifier is List.
template <TypeModifier Modifier>
concept ListModifier = Modifier ==
TypeModifier::List;
concept ListModifier = Modifier == TypeModifier::List;

// Special-case an innermost nullable INPUT_OBJECT type.
template <typename Type, TypeModifier... Other>
Expand Down
10 changes: 5 additions & 5 deletions include/graphqlservice/GraphQLParse.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 1d65922

Please sign in to comment.