-
Notifications
You must be signed in to change notification settings - Fork 36
Added XEUS_SEARCH_PATH support in xeus-cpp #257
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,7 @@ __get_cxx_version () | |
createInterpreter(Args(argv ? argv + 1 : argv, argv + argc)); | ||
m_version = get_stdopt(); | ||
redirect_output(); | ||
init_includes(); | ||
init_preamble(); | ||
init_magic(); | ||
} | ||
|
@@ -356,6 +357,24 @@ __get_cxx_version () | |
publish_stream("stderr", s); | ||
} | ||
|
||
void interpreter::init_includes() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: method 'init_includes' can be made static [readability-convert-member-functions-to-static] include/xeus-cpp/xinterpreter.hpp:74: - void init_includes();
+ static void init_includes(); |
||
{ | ||
if (const char* paths = std::getenv("XEUS_SEARCH_PATH")) | ||
{ | ||
std::istringstream stream(paths); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "std::istringstream" is directly included [misc-include-cleaner] src/xinterpreter.cpp:19: - #ifndef EMSCRIPTEN
+ #include <sstream>
+ #ifndef EMSCRIPTEN |
||
std::string path; | ||
char delimiter = (std::string(paths).find(';') != std::string::npos) ? ';' : ':'; | ||
|
||
while (std::getline(stream, path, delimiter)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "std::getline" is directly included [misc-include-cleaner] while (std::getline(stream, path, delimiter))
^ |
||
{ | ||
if (!path.empty()) | ||
{ | ||
Cpp::AddIncludePath(path.c_str()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
void interpreter::init_preamble() | ||
{ | ||
//NOLINTBEGIN(cppcoreguidelines-owning-memory) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef TEST_HEADER_HPP | ||
#define TEST_HEADER_HPP | ||
|
||
namespace test_ns | ||
{ | ||
constexpr int test_value = 42; | ||
} | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "test_header.hpp" | ||
#include <doctest/doctest.h> | ||
#include <string> | ||
|
||
TEST_CASE("Test non-standard include paths") | ||
{ | ||
CHECK(test_ns::test_value == 42); | ||
} |
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.
warning: included header sstream is not used directly [misc-include-cleaner]