-
Notifications
You must be signed in to change notification settings - Fork 271
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
Remove all references to optionalt #8099
Conversation
7163984
to
d59b89b
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #8099 +/- ##
========================================
Coverage 79.08% 79.08%
========================================
Files 1698 1698
Lines 196457 196460 +3
========================================
+ Hits 155370 155376 +6
+ Misses 41087 41084 -3 ☔ View full report in Codecov by Sentry. |
1484567
to
16aed20
Compare
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.
Getting this merged for version 6 should be given a reasonably high priority. The reason being that you cannot construct or assign an optionalt
using an std::optional
(or the other way around.) So if we don't get rid of optionalt
, then this could lead to awkward maintenance where maintainers need to consider which type of optional to use in which place.
@@ -13,8 +13,6 @@ Author: Diffblue Ltd | |||
#include <string> | |||
#include <vector> | |||
|
|||
#include <util/optional.h> |
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.
⛏️ Shouldn't this be replaced by #include <optional>
? If this is working at the moment, I'd guess it was down to transitive includes.
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.
It seemed to work fine on my Ubuntu 20.04, but other OS/compiler combinations indeed make those includes necessary. I had naively assumed that standard library headers would likely (transitively) include that anyway, but as experimenting shows that's not always the case. So, yes, I may well end up putting this back in.
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.
Good to see this being fixed.
I'd prefer to avoid relying on transitive header includes where possible. With optional
as an example my reasoning goes something like -
- Header "A" depends on
optional
so#include <optional>
is added to it. .cpp
file "B" depends on header "A" and usesstd::optional
in its implementation. It therefore depends onoptional
, but as this.cpp
already includes header "A"#include <optional>
is not added to it.- Maintainer of header "A" decides they no longer need to depend on
optional
. Lets say they were using it for the type of a private member function rather than as part of the exposed API. They remove the#include <optional>
from header "A", because it no longer needs it itself. - The compilation of
.cpp
"B" now fails. This means that the maintainer of header "A" now needs to either add the include to the.cpp
file, or to leave the extra include in their header.
Leaving the extra include in could potentially extend compile times. Adding it to the .cpp
increases the number of changes in their PR and potentially requires approval from more code owners. The decision and additional work could have been avoided if the reliance on transitive includes had been avoided.
@@ -9,8 +9,6 @@ Author: Daniel Poetzl | |||
#ifndef CPROVER_GOTO_HARNESS_MEMORY_SNAPSHOT_HARNESS_GENERATOR_H | |||
#define CPROVER_GOTO_HARNESS_MEMORY_SNAPSHOT_HARNESS_GENERATOR_H | |||
|
|||
#include <util/optional.h> |
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.
⛏️ See previous comment about #include <optional>
@@ -14,7 +14,6 @@ Author: Diffblue Ltd. | |||
#include <unordered_set> | |||
|
|||
#include <util/cprover_prefix.h> | |||
#include <util/optional.h> |
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.
⛏️ See previous comment about #include <optional>
@@ -16,7 +16,6 @@ Author: Remi Delmas, [email protected] | |||
#include <util/mathematical_expr.h> | |||
#include <util/mathematical_types.h> | |||
#include <util/namespace.h> | |||
#include <util/optional.h> |
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.
⛏️ See previous comment about #include <optional>
@@ -17,7 +17,6 @@ Date: August 2022 | |||
|
|||
#include <util/message.h> | |||
#include <util/namespace.h> | |||
#include <util/optional.h> |
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.
⛏️ See previous comment about #include <optional>
@@ -22,7 +22,6 @@ Author: Diffblue Ltd. | |||
|
|||
#include <util/exception_utils.h> | |||
#include <util/irep.h> | |||
#include <util/optional.h> |
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.
⛏️ See previous comment about #include <optional>
@@ -13,7 +13,6 @@ Author: Daniel Kroening, [email protected] | |||
#define CPROVER_POINTER_ANALYSIS_ADD_FAILED_SYMBOLS_H | |||
|
|||
#include <util/expr.h> | |||
#include <util/optional.h> |
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.
⛏️ See previous comment about #include <optional>
@@ -12,7 +12,6 @@ Author: Daniel Kroening, [email protected] | |||
|
|||
#include "invariant.h" | |||
#include "mp_arith.h" | |||
#include "optional.h" |
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.
⛏️ See previous comment about #include <optional>
@@ -17,7 +17,6 @@ Author: Diffblue Ltd | |||
#include <vector> | |||
|
|||
#include <util/invariant.h> | |||
#include <util/optional.h> |
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.
⛏️ See previous comment about #include <optional>
56a6b7d
to
f943b6b
Compare
Maybe not under normal circumstances, but I'd be inclined to say that the transition to 6.0 makes it appropriate. |
409998b
to
3294030
Compare
1ed1640
to
d7629f1
Compare
We now use `std::optional` instead.
d7629f1
to
851c486
Compare
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.
LGTM in all contracts related changes.
We now use
std::optional
instead.I am not sure it's worth the code churn to review/merge this at this point. Most of the changes were implemented using
git grep -wl optionalt | xargs sed -i 's/optionalt/std::optional/g'
followed by removal of#include <util/optional.h>
and then manually re-adding#include <optional>
as needed (plus clang-format). My main reason for even embarking on this was to figure out what changes are needed so as to get rid of-Wno-deprecated-declarations
.