-
Notifications
You must be signed in to change notification settings - Fork 274
Variant submodule #4344
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
Variant submodule #4344
Conversation
src/util/variant.h
Outdated
/*******************************************************************\ | ||
|
||
Module: typedef for optional class template. To be replaced with | ||
std::optional once C++17 support is enabled |
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.
Should this be in 'nonstd/' with the existing optional
code?
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.
Since it is a submodule, I don't think I can change the namespace it is in? Or do you mean, making the using nostd::variantt = ...
- the optionalt
is declared in the global scope so I figured this was more consistent.
But your comment highlighted a copy-pasta error in the docs - fixed
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.
Thinking about it; just a comment saying // Swap for std::variant when switching to C++17
or something.
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.
Not sure I follow, comment currently reads (typo not withstanding):
To be replaced with std::variant once C++17 support is enabled
Is your suggestion your wording is clearer? Happy to change if that is indeed what you mean, but for me they are equivalent
3355d77
to
f0db1cd
Compare
f0db1cd
to
dc49182
Compare
Full tests are provided in the submodule - this checks that it compiles and links correctly.
cd81a6f
to
8437b25
Compare
This is failing due to Makefile not linking the variant in util. Before I spend some time figuring out how |
@@ -1,3 +1,6 @@ | |||
[submodule "jbmc/lib/java-models-library"] | |||
path = jbmc/lib/java-models-library | |||
url = https://github.com/diffblue/java-models-library.git | |||
[submodule "lib/variant"] |
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.
Instead of introducing a new top-level folder, can we place this in nonstd/variant
instead of lib/variant
?
cd lib/variant | ||
mkdir -p build | ||
cd build | ||
cmake -DMPARK_VARIANT_INCLUDE_TESTS="mpark" -DCMAKE_CXX_FLAGS="-std=c++11" .. |
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.
Are we sure that cmake
is installed prior to running this (as this is being run in all Travis jobs)?
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.
Hmm good point - what would you suggest - the project is in CMake not Make? (one option of course being: abandon this approach!)
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 think there's a problem asking for cmake
to be installed. Just make sure it's documented/actually done in CI configurations.
nonstd | ||
sys # system | ||
util | ||
|
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.
Not needed
#ifndef CPROVER_UTIL_VARIANT_H | ||
#define CPROVER_UTIL_VARIANT_H | ||
|
||
#include <mpark/variant.hpp> |
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 suppose this works with CMake, but shouldn't this be #include <lib/variant/mpark/variant.hpp>
? If that, however, does not work with CMake
then we'd need to update INCLUDES
in any Makefile
that wants to use this.
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.
So only the util includes need to change, since all other users should use the variantt
wrapper. But happy to do that if that's the preference.
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.
Well, but the variant.h
file uses this include, so if I'm in directory X
and have a file x/y.cpp
that includes variant.h
then the preprocessor still needs to know how to resolve that include.
I am concerned about the following: so far, we have been able to build cbmc from a tarball (I am aware that this doesn't work with jbmc). We would now introduce a compile-time dependency on git, plus the ability to clone that repo. |
@@ -0,0 +1,12 @@ | |||
// Copyright 2016-2019 Diffblue Limited. All Rights Reserved. |
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.
Wrong copyright header
@kroening subtree rather than submodule would fix that |
If dependency on a repo that is not under our control is considered a problem we could also fork it into the org.
Note that CBMC already now requires an extra step (minisat) to build it from a tarball - tracking https://github.com/niklasso/minisat (or a fork of it) through a submodule would be more convenient. |
As a rather different suggestion: have people considered to just build using |
I'd love that, and nothing technical is stopping us from doing so. But someone doesn't want that. Nevertheless, availability of variant in CBMC wouldn't be a bad thing. |
If you want a self-sufficient repo but also the ability to easily track what other-repo commit we're using, just subtree it. That would satisfy @kroening's concern |
Closing this PR on the basis of:
If you believe this has been in err, feel free to reopen the issue. |
This is a proposed replacement for #3962 that I hope might be less controversial. It provides the following advantages:
I didn't spend much time on this, so if people don't like it, no harm no fowl, but would quite like to be able to use variant.