-
Notifications
You must be signed in to change notification settings - Fork 75
refactor: suppress warnings #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,9 +39,9 @@ namespace iceberg::rest { | |
|
|
||
| /// \brief Server-provided configuration for the catalog. | ||
| struct ICEBERG_REST_EXPORT CatalogConfig { | ||
| std::unordered_map<std::string, std::string> defaults; // required | ||
| std::unordered_map<std::string, std::string> overrides; // required | ||
| std::vector<std::string> endpoints; | ||
| std::unordered_map<std::string, std::string> defaults{}; // required | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need to add
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like they are necessary. The following warnings occurred when removing the initialization. Do you have any better idea?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd suggest adding |
||
| std::unordered_map<std::string, std::string> overrides{}; // required | ||
| std::vector<std::string> endpoints{}; | ||
|
|
||
| /// \brief Validates the CatalogConfig. | ||
| Status Validate() const { | ||
|
|
@@ -58,7 +58,7 @@ struct ICEBERG_REST_EXPORT ErrorModel { | |
| std::string message; // required | ||
| std::string type; // required | ||
| uint32_t code; // required | ||
| std::vector<std::string> stack; | ||
| std::vector<std::string> stack{}; | ||
|
|
||
| /// \brief Validates the ErrorModel. | ||
| Status Validate() const { | ||
|
|
@@ -88,16 +88,16 @@ struct ICEBERG_REST_EXPORT ErrorResponse { | |
| /// \brief Request to create a namespace. | ||
| struct ICEBERG_REST_EXPORT CreateNamespaceRequest { | ||
| Namespace namespace_; // required | ||
| std::unordered_map<std::string, std::string> properties; | ||
| std::unordered_map<std::string, std::string> properties{}; | ||
|
|
||
| /// \brief Validates the CreateNamespaceRequest. | ||
| Status Validate() const { return {}; } | ||
| }; | ||
|
|
||
| /// \brief Update or delete namespace properties request. | ||
| struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesRequest { | ||
| std::vector<std::string> removals; | ||
| std::unordered_map<std::string, std::string> updates; | ||
| std::vector<std::string> removals{}; | ||
| std::unordered_map<std::string, std::string> updates{}; | ||
|
|
||
| /// \brief Validates the UpdateNamespacePropertiesRequest. | ||
| Status Validate() const { | ||
|
|
@@ -171,7 +171,7 @@ using LoadTableResponse = LoadTableResult; | |
| /// \brief Response body for listing namespaces. | ||
| struct ICEBERG_REST_EXPORT ListNamespacesResponse { | ||
| PageToken next_page_token; | ||
| std::vector<Namespace> namespaces; | ||
| std::vector<Namespace> namespaces{}; | ||
|
|
||
| /// \brief Validates the ListNamespacesResponse. | ||
| Status Validate() const { return {}; } | ||
|
|
@@ -180,7 +180,7 @@ struct ICEBERG_REST_EXPORT ListNamespacesResponse { | |
| /// \brief Response body after creating a namespace. | ||
| struct ICEBERG_REST_EXPORT CreateNamespaceResponse { | ||
| Namespace namespace_; // required | ||
| std::unordered_map<std::string, std::string> properties; | ||
| std::unordered_map<std::string, std::string> properties{}; | ||
|
|
||
| /// \brief Validates the CreateNamespaceResponse. | ||
| Status Validate() const { return {}; } | ||
|
|
@@ -189,17 +189,17 @@ struct ICEBERG_REST_EXPORT CreateNamespaceResponse { | |
| /// \brief Response body for loading namespace properties. | ||
| struct ICEBERG_REST_EXPORT GetNamespaceResponse { | ||
| Namespace namespace_; // required | ||
| std::unordered_map<std::string, std::string> properties; | ||
| std::unordered_map<std::string, std::string> properties{}; | ||
|
|
||
| /// \brief Validates the GetNamespaceResponse. | ||
| Status Validate() const { return {}; } | ||
| }; | ||
|
|
||
| /// \brief Response body after updating namespace properties. | ||
| struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesResponse { | ||
| std::vector<std::string> updated; // required | ||
| std::vector<std::string> removed; // required | ||
| std::vector<std::string> missing; | ||
| std::vector<std::string> updated{}; // required | ||
| std::vector<std::string> removed{}; // required | ||
| std::vector<std::string> missing{}; | ||
|
|
||
| /// \brief Validates the UpdateNamespacePropertiesResponse. | ||
| Status Validate() const { return {}; } | ||
|
|
@@ -208,7 +208,7 @@ struct ICEBERG_REST_EXPORT UpdateNamespacePropertiesResponse { | |
| /// \brief Response body for listing tables in a namespace. | ||
| struct ICEBERG_REST_EXPORT ListTablesResponse { | ||
| PageToken next_page_token; | ||
| std::vector<TableIdentifier> identifiers; | ||
| std::vector<TableIdentifier> identifiers{}; | ||
|
|
||
| /// \brief Validates the ListTablesResponse. | ||
| Status Validate() const { return {}; } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,6 +103,7 @@ class ICEBERG_EXPORT Schema : public StructType { | |
| friend bool operator==(const Schema& lhs, const Schema& rhs) { return lhs.Equals(rhs); } | ||
|
|
||
| private: | ||
| using Type::Equals; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wgtmac It seems that we should override the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me keep this change because this commit is to refactor the code.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't make it clear. This and the previous comments are just to remind wgtmac. You don't need to modify these. |
||
| /// \brief Compare two schemas for equality. | ||
| bool Equals(const Schema& other) const; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove the parameters' names instead of adding
[[maybe_unused]]to keep the code clear.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure your suggestion seems to be aligned with the original design. These functions overrode the pure virtual functions in
Catalog.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get your point. Removing the names in child class don't change the function signature even though it overrides virtual function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HuaHuaY Let's compare the two options. I prefer to use
[[maybe_unused]]rather than omitting the parameter name. Adding the attribute can bring better readability and maintenance when enabling parameters.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to C++ core guidelines https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#rf-unused,
[[maybe_unused]]is used when parameters are conditionally unused.I think it's the responsibility of who implements this feature in the future to add the name back. If we don't need the variable, we should not give a name to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen several patterns regarding to this:
I think
void func_b(int /*a*/)strikes a good balance.