Skip to content

Commit bb82c9d

Browse files
committed
Fix -Wall -Wextra -pedantic warnings for gcc
1 parent c938c92 commit bb82c9d

File tree

4 files changed

+18
-21
lines changed

4 files changed

+18
-21
lines changed

include/SchemaLoader.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct ScalarType
4848
{
4949
std::string_view type;
5050
std::string_view description;
51-
std::string_view specifiedByURL;
51+
std::string_view specifiedByURL {};
5252
};
5353

5454
using ScalarTypeList = std::vector<ScalarType>;
@@ -105,7 +105,7 @@ struct InputType
105105
std::string_view cppType;
106106
InputFieldList fields;
107107
std::string_view description;
108-
std::unordered_set<std::string_view> dependencies;
108+
std::unordered_set<std::string_view> dependencies {};
109109
};
110110

111111
using InputTypeList = std::vector<InputType>;
@@ -298,8 +298,8 @@ class SchemaLoader
298298
void validateImplementedInterfaces() const;
299299
const InterfaceType& findInterfaceType(
300300
std::string_view typeName, std::string_view interfaceName) const;
301-
void validateInterfaceFields(std::string_view typeName,
302-
std::string_view interfaceName, const OutputFieldList& typeFields) const;
301+
void validateInterfaceFields(std::string_view typeName, std::string_view interfaceName,
302+
const OutputFieldList& typeFields) const;
303303
void validateTransitiveInterfaces(
304304
std::string_view typeName, const std::vector<std::string_view>& interfaces) const;
305305

include/graphqlservice/GraphQLService.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ GRAPHQLSERVICE_EXPORT error_path buildErrorPath(const std::optional<field_path>&
7676
struct schema_error
7777
{
7878
std::string message;
79-
schema_location location;
80-
error_path path;
79+
schema_location location {};
80+
error_path path {};
8181
};
8282

8383
GRAPHQLSERVICE_EXPORT response::Value buildErrorValues(std::list<schema_error>&& structuredErrors);
@@ -579,7 +579,7 @@ struct ResolverParams : SelectionSetParams
579579
struct ResolverResult
580580
{
581581
response::Value data;
582-
std::list<schema_error> errors;
582+
std::list<schema_error> errors {};
583583
};
584584

585585
using AwaitableResolver = internal::Awaitable<ResolverResult>;
@@ -1195,10 +1195,10 @@ struct RequestResolveParams
11951195
response::Value variables { response::Type::Map };
11961196

11971197
// Optional async execution awaitable.
1198-
await_async launch;
1198+
await_async launch {};
11991199

12001200
// Optional sub-class of RequestState which will be passed to each resolver and field accessor.
1201-
std::shared_ptr<RequestState> state;
1201+
std::shared_ptr<RequestState> state {};
12021202
};
12031203

12041204
struct RequestSubscribeParams
@@ -1212,10 +1212,10 @@ struct RequestSubscribeParams
12121212
response::Value variables { response::Type::Map };
12131213

12141214
// Optional async execution awaitable.
1215-
await_async launch;
1215+
await_async launch {};
12161216

12171217
// Optional sub-class of RequestState which will be passed to each resolver and field accessor.
1218-
std::shared_ptr<RequestState> state;
1218+
std::shared_ptr<RequestState> state {};
12191219
};
12201220

12211221
struct RequestUnsubscribeParams
@@ -1224,7 +1224,7 @@ struct RequestUnsubscribeParams
12241224
SubscriptionKey key;
12251225

12261226
// Optional async execution awaitable.
1227-
await_async launch;
1227+
await_async launch {};
12281228
};
12291229

12301230
using SubscriptionArguments = std::map<std::string_view, response::Value>;
@@ -1240,7 +1240,7 @@ struct SubscriptionFilter
12401240

12411241
// Optional field directives filter, which can either be a set of required directives and
12421242
// arguments, or a callback which returns true if the directives match custom criteria.
1243-
std::optional<std::variant<Directives, SubscriptionDirectiveFilterCallback>> directives;
1243+
std::optional<std::variant<Directives, SubscriptionDirectiveFilterCallback>> directives {};
12441244
};
12451245

12461246
// Deliver to a specific subscription key, or apply custom criteria for the field name, arguments,
@@ -1254,13 +1254,13 @@ struct RequestDeliverParams
12541254

12551255
// Optional filter to control which subscriptions will receive the event. If not specified,
12561256
// every subscription on this field will receive the event and evaluate their queries.
1257-
RequestDeliverFilter filter;
1257+
RequestDeliverFilter filter {};
12581258

12591259
// Optional async execution awaitable.
1260-
await_async launch;
1260+
await_async launch {};
12611261

12621262
// Optional override for the default Subscription operation object.
1263-
std::shared_ptr<Object> subscriptionObject;
1263+
std::shared_ptr<Object> subscriptionObject {};
12641264
};
12651265

12661266
using TypeMap = internal::string_view_map<std::shared_ptr<Object>>;

src/ClientGenerator.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,7 @@ static_assert(graphql::internal::MinorVersion == )cpp"
206206
{
207207
pendingSeparator.reset();
208208

209-
headerFile << R"cpp(enum class )cpp" << _schemaLoader.getCppType(enumType->name())
210-
<< R"cpp(
209+
headerFile << R"cpp(enum class )cpp" << _schemaLoader.getCppType(enumType->name()) << R"cpp(
211210
{
212211
)cpp";
213212
for (const auto& enumValue : enumType->enumValues())
@@ -459,15 +458,13 @@ using namespace )cpp"
459458

460459
const auto& enumValues = enumType->enumValues();
461460
const auto cppType = _schemaLoader.getCppType(enumType->name());
462-
bool firstValue = true;
463461

464462
sourceFile << R"cpp(static const std::array<std::string_view, )cpp" << enumValues.size()
465463
<< R"cpp(> s_names)cpp" << cppType << R"cpp( = {
466464
)cpp";
467465

468466
for (const auto& enumValue : enumValues)
469467
{
470-
firstValue = false;
471468
sourceFile << R"cpp( ")cpp" << SchemaLoader::getSafeCppName(enumValue->name())
472469
<< R"cpp("sv,
473470
)cpp";

src/RequestLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ void RequestLoader::reorderInputTypeDependencies() noexcept
845845
{
846846
RequestSchemaType type;
847847
std::string_view name;
848-
std::unordered_set<std::string_view> dependencies;
848+
std::unordered_set<std::string_view> dependencies {};
849849
};
850850

851851
std::vector<InputTypeDependencies> inputTypes(_referencedInputTypes.size());

0 commit comments

Comments
 (0)