Checking out custom libraries
See original GitHub issueMotivation
All too often, I copy my code to Compiler Explorer, only to realise I’m not compiling with Standard headers. I often end up with dummy code like this:
namespace ranges {
using std::move;
} // namespace ranges
This works for simple things, but full libraries are quite difficult to import. Consider Asio, Boost, Ranges TS, etc.
Proposal
It’d be great if we could checkout our own libraries via a textbox. Here’s what I envision:
git https://github.com/Microsoft/GSL # master branch checked out by default
git https://github.com/cjdb/cmcstl2 numerics # numeric branch checked out
It’d then be possible to compile with GSL and Ranges TS without needing to make a feature request for library X, every time something novel comes around.
How it’d work (if it is local)
for each url:
git clone $url
git checkout $branch
<compile line> -I <dir1> -I <dir2> ...
for each url
sudo rm -rf <end of url>
Concerns
Obviously, this is a terrible idea for anyone that’s remote. The input needs to be sanitised, and we’d need to make sure that it isn’t abused (e.g. if someone decided to checkout GCC or LLVM, the amount of space required would be enormous).
I also don’t (yet) have a solid grasp for how Compiler Explorer actually works on a technical level, so the above functionality is all speculative.
Extensions
- For now, I think Git would be a good starting point to see if and how it works, but I’d like to see support for Subversion and Mercurial at some point.
- Caching would be a good idea for the most popular repositories and branches: something that’s frequently used (e.g. Boost, GSL, etc.) might benefit from being stored permanently to reduce system load with respect to downloads and removal. This is purely speculation at this point.
Contacts
@mattjegan is a developer with a keen interest in security. Perhaps you might like to follow this?
Issue Analytics
- State:
- Created 6 years ago
- Comments:18 (10 by maintainers)
Top GitHub Comments
Hi @simonvpe that’s already possible… sort of ( https://godbolt.org/g/dDKkA5 ) . CE supports #include-ing github permalink URLs. But the issue is following the include that the GH link brings in: I don’t want to implement a full preprocessor which is what would be needed in order to resolve those.
@mattgodbolt I addded information about the ability to
#include
a GH permalink on the wiki page. If my guess is correct you can#include
any URL that points to a header file. I wasn’t sure of that though. If that’s the case the Wiki page should be updated.