Skip to content

Commit c816e9c

Browse files
author
Andrei Popescu
authored
Reduce compiler warnings about deprecated methods/classes. (#715)
As we deprecated some classes that are public but only to be used internaly there are a lot of deprecated warnings when building the SDK. This adds pragma compiler flag disables for the places where we actually use these classes internaly until we can finaly move these classes to private. Also this commit removes the version usage from the request key creation and adds again pragma disables to the repositories which are still using the version setters/getters internaly. This will be changed in the future but until then we need to lower the warnings count while building. Resolves: OLPSUP-9858 Signed-off-by: Andrei Popescu <[email protected]>
1 parent 533f273 commit c816e9c

File tree

10 files changed

+51
-15
lines changed

10 files changed

+51
-15
lines changed

olp-cpp-sdk-authentication/include/olp/authentication/TokenEndpoint.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,17 @@ namespace olp {
3737
namespace authentication {
3838
class AutoRefreshingToken;
3939

40-
PORTING_PUSH_WARNINGS()
41-
PORTING_CLANG_GCC_DISABLE_WARNING("-Wdeprecated-declarations")
42-
4340
/**
4441
* @brief Corresponds to the token endpoint as specified in the OAuth2.0
4542
* specification.
4643
*/
4744
class AUTHENTICATION_API OLP_SDK_DEPRECATED("Will be removed in 04.2020")
4845
TokenEndpoint {
4946
public:
47+
// Needed to avoid endless warnings from TokenRequest/TokenResult
48+
PORTING_PUSH_WARNINGS()
49+
PORTING_CLANG_GCC_DISABLE_WARNING("-Wdeprecated-declarations")
50+
5051
/// Defines the signature used to return the response to the client.
5152
using TokenResponse = Response<TokenResult>;
5253
/// Defines the callback that is invoked when the response on
@@ -114,6 +115,8 @@ class AUTHENTICATION_API OLP_SDK_DEPRECATED("Will be removed in 04.2020")
114115
AutoRefreshingToken RequestAutoRefreshingToken(
115116
const TokenRequest& token_request = TokenRequest());
116117

118+
PORTING_POP_WARNINGS()
119+
117120
/**
118121
* @brief Creates the `TokenEndpoint` instance with the given `settings`
119122
* parameter.
@@ -128,6 +131,5 @@ class AUTHENTICATION_API OLP_SDK_DEPRECATED("Will be removed in 04.2020")
128131
std::shared_ptr<Impl> impl_;
129132
};
130133

131-
PORTING_POP_WARNINGS()
132134
} // namespace authentication
133135
} // namespace olp

olp-cpp-sdk-authentication/src/TokenEndpoint.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
#include "olp/authentication/TokenEndpoint.h"
2121

22+
PORTING_PUSH_WARNINGS()
23+
PORTING_CLANG_GCC_DISABLE_WARNING("-Wdeprecated-declarations")
24+
2225
#include "olp/authentication/AuthenticationClient.h"
2326
#include "olp/authentication/AuthenticationCredentials.h"
2427
#include "olp/authentication/AutoRefreshingToken.h"
@@ -134,5 +137,6 @@ AutoRefreshingToken TokenEndpoint::RequestAutoRefreshingToken(
134137
return AutoRefreshingToken(*this, token_request);
135138
}
136139

140+
PORTING_POP_WARNINGS()
137141
} // namespace authentication
138142
} // namespace olp

olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/DataRequest.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ class DATASERVICE_READ_API DataRequest final {
245245
out << GetDataHandle().get();
246246
}
247247
out << "]";
248-
if (GetVersion()) {
249-
out << "@" << GetVersion().get();
248+
if (catalog_version_) {
249+
out << "@" << catalog_version_.get();
250250
}
251251
if (GetBillingTag()) {
252252
out << "$" << GetBillingTag().get();

olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PartitionsRequest.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ class DATASERVICE_READ_API PartitionsRequest final {
220220
std::string CreateKey(const std::string& layer_id) const {
221221
std::stringstream out;
222222
out << layer_id;
223-
if (GetVersion()) {
224-
out << "@" << GetVersion().get();
223+
if (catalog_version_) {
224+
out << "@" << catalog_version_.get();
225225
}
226226
if (GetBillingTag()) {
227227
out << "$" << GetBillingTag().get();

olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PrefetchTilesRequest.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class DATASERVICE_READ_API PrefetchTilesRequest final {
123123
* version is specified, the latest version is retrieved.
124124
*
125125
* @return A reference to the updated `PrefetchTilesRequest` instance.
126-
*
126+
*
127127
* @deprecated The version is now a part of the VersionedLayerClient
128128
* constructor.
129129
*/
@@ -202,8 +202,8 @@ class DATASERVICE_READ_API PrefetchTilesRequest final {
202202
std::stringstream out;
203203
out << layer_id << "[" << GetMinLevel() << "/" << GetMaxLevel() << "]"
204204
<< "(" << GetTileKeys().size() << ")";
205-
if (GetVersion()) {
206-
out << "@" << GetVersion().get();
205+
if (catalog_version_) {
206+
out << "@" << catalog_version_.get();
207207
}
208208
if (GetBillingTag()) {
209209
out << "$" << GetBillingTag().get();

olp-cpp-sdk-dataservice-read/src/VersionedLayerClientImpl.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
#include "repositories/PartitionsRepository.h"
3434
#include "repositories/PrefetchTilesRepository.h"
3535

36+
// Needed to avoid endless warnings from GetVersion/WithVersion
37+
#include <olp/core/porting/warning_disable.h>
38+
PORTING_PUSH_WARNINGS()
39+
PORTING_CLANG_GCC_DISABLE_WARNING("-Wdeprecated-declarations")
40+
3641
namespace olp {
3742
namespace dataservice {
3843
namespace read {
@@ -366,7 +371,6 @@ VersionedLayerClientImpl::PrefetchTiles(PrefetchTilesRequest request) {
366371
promise);
367372
}
368373

369-
370374
CatalogVersionResponse VersionedLayerClientImpl::GetVersion(
371375
boost::optional<std::string> billing_tag, const FetchOptions& fetch_options,
372376
const client::CancellationContext& context) {
@@ -446,9 +450,9 @@ client::CancellableFuture<DataResponse> VersionedLayerClientImpl::GetData(
446450
});
447451
return client::CancellableFuture<DataResponse>(std::move(cancel_token),
448452
std::move(promise));
449-
450453
}
451454

455+
PORTING_POP_WARNINGS()
452456
} // namespace read
453457
} // namespace dataservice
454458
} // namespace olp

olp-cpp-sdk-dataservice-read/src/repositories/DataRepository.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
#include "olp/dataservice/read/PartitionsRequest.h"
3838
#include "olp/dataservice/read/TileRequest.h"
3939

40+
// Needed to avoid endless warnings from GetVersion/WithVersion
41+
#include <olp/core/porting/warning_disable.h>
42+
PORTING_PUSH_WARNINGS()
43+
PORTING_CLANG_GCC_DISABLE_WARNING("-Wdeprecated-declarations")
44+
4045
namespace olp {
4146
namespace dataservice {
4247
namespace read {
@@ -226,6 +231,7 @@ DataResponse DataRepository::GetVolatileData(
226231
catalog, layer_id, kVolatileBlobService, request, context, settings);
227232
}
228233

234+
PORTING_POP_WARNINGS()
229235
} // namespace repository
230236
} // namespace read
231237
} // namespace dataservice

olp-cpp-sdk-dataservice-read/src/repositories/PartitionsCacheRepository.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
#include "generated/serializer/JsonSerializer.h"
3434
// clang-format on
3535

36+
// Needed to avoid endless warnings from GetVersion/WithVersion
37+
#include <olp/core/porting/warning_disable.h>
38+
PORTING_PUSH_WARNINGS()
39+
PORTING_CLANG_GCC_DISABLE_WARNING("-Wdeprecated-declarations")
40+
3641
namespace {
3742
constexpr auto kLogTag = "PartitionsCacheRepository";
3843

@@ -201,6 +206,7 @@ void PartitionsCacheRepository::ClearPartitions(
201206
}
202207
}
203208

209+
PORTING_POP_WARNINGS()
204210
} // namespace repository
205211
} // namespace read
206212
} // namespace dataservice

olp-cpp-sdk-dataservice-read/src/repositories/PartitionsRepository.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
#include "olp/dataservice/read/PartitionsRequest.h"
3434
#include "olp/dataservice/read/TileRequest.h"
3535

36+
// Needed to avoid endless warnings from GetVersion/WithVersion
37+
#include <olp/core/porting/warning_disable.h>
38+
PORTING_PUSH_WARNINGS()
39+
PORTING_CLANG_GCC_DISABLE_WARNING("-Wdeprecated-declarations")
40+
3641
namespace olp {
3742
namespace dataservice {
3843
namespace read {
@@ -141,7 +146,7 @@ PartitionsResponse PartitionsRepository::GetPartitions(
141146
PartitionsResponse response;
142147

143148
const auto& partition_ids = request.GetPartitionIds();
144-
149+
145150
if (partition_ids.empty()) {
146151
auto metadata_api =
147152
ApiClientLookup::LookupApi(catalog, cancellation_context, "metadata",
@@ -386,6 +391,8 @@ model::Partitions PartitionsRepository::GetTileFromCache(
386391
}
387392
return {};
388393
}
394+
395+
PORTING_POP_WARNINGS()
389396
} // namespace repository
390397
} // namespace read
391398
} // namespace dataservice

olp-cpp-sdk-dataservice-read/src/repositories/PrefetchTilesRepository.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
#include "PartitionsRepository.h"
3232
#include "generated/api/QueryApi.h"
3333

34+
// Needed to avoid endless warnings from GetVersion/WithVersion
35+
#include <olp/core/porting/warning_disable.h>
36+
PORTING_PUSH_WARNINGS()
37+
PORTING_CLANG_GCC_DISABLE_WARNING("-Wdeprecated-declarations")
38+
3439
namespace olp {
3540
namespace dataservice {
3641
namespace read {
@@ -244,7 +249,8 @@ SubQuadsResponse PrefetchTilesRepository::GetSubQuads(
244249

245250
// add to bulk partitions for cacheing
246251
partitions.GetMutablePartitions().emplace_back(
247-
PartitionsRepository::PartitionFromSubQuad(*subquad, subtile.ToHereTile()));
252+
PartitionsRepository::PartitionFromSubQuad(*subquad,
253+
subtile.ToHereTile()));
248254
}
249255

250256
// add to cache
@@ -255,6 +261,7 @@ SubQuadsResponse PrefetchTilesRepository::GetSubQuads(
255261
return result;
256262
}
257263

264+
PORTING_POP_WARNINGS()
258265
} // namespace repository
259266
} // namespace read
260267
} // namespace dataservice

0 commit comments

Comments
 (0)