Skip to content

Commit

Permalink
Disable "-Wmaybe-uninitialized" diagnostic for some lines of code due…
Browse files Browse the repository at this point in the history
… to GCC11 false positive
  • Loading branch information
smtrfnv committed Jan 3, 2024
1 parent f4ea959 commit 1219359
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion groups/ntc/ntcdns/ntcdns_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,13 +812,22 @@ void ClientGetDomainNameOperation::processResponse(
timeToLive.makeValue(answer.ttl());
}
else {
bsl::size_t timeToLiveValue = timeToLive.value();
const bsl::size_t timeToLiveValue = timeToLive.value();
if (timeToLiveValue != answer.ttl()) {
NTCDNS_CLIENT_OPERATION_LOG_TTL_MISMATCH(answer.ttl(),
timeToLiveValue);
// Some versions of GCC erroneously warn when 'timeToLive.value()' is
// called even when protected by a check of '!timeToLive.isNull()'.
#if defined(BSLS_PLATFORM_CMP_GNU)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
if (answer.ttl() < timeToLiveValue) {
timeToLive = answer.ttl();
}
#if defined(BSLS_PLATFORM_CMP_GNU)
#pragma GCC diagnostic pop
#endif
}
}

Expand Down

0 comments on commit 1219359

Please sign in to comment.