Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/build/
/linux-build/

/.vs/
/out/
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set(CMAKE_CXX_STANDARD 20)

add_definitions(-DVERSP_RELEASE=$<CONFIG:Release> -DVERSP_DEBUG=$<CONFIG:Debug> -DNOMINMAX)

# Comment out this line to use std::string instead of std::string_view in InvalidPartitionName
# add_compile_definitions(FIX_MEMORY_ACCESS_BUG)

include_directories (include)

add_subdirectory (src)
4 changes: 4 additions & 0 deletions include/ifc/abstract-sgraph.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -3518,7 +3518,11 @@ namespace ifc {

// -- exception type in case of an invalid partition name
struct InvalidPartitionName {
#ifdef FIX_MEMORY_ACCESS_BUG
std::string name;
#else
std::string_view name;
#endif
};

// Retrieve a partition summary based on the partition's name.
Expand Down
6 changes: 6 additions & 0 deletions src/ifc-printer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ target_link_libraries(ifc-printer
)

target_link_libraries(ifc-printer PRIVATE GSL)

add_custom_command(
TARGET ifc-printer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/file.cxx.ifc
${CMAKE_CURRENT_BINARY_DIR}/file.cxx.ifc)
Binary file added src/ifc-printer/file.cxx.ifc
Binary file not shown.
4 changes: 4 additions & 0 deletions src/ifc-printer/main.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ void translate_exception()
{
std::cerr << "ifc architecture mismatch\n";
}
catch (ifc::InvalidPartitionName& e)
{
std::cout << "ifc invalid partition name: '" << e.name << "'\n";
}
catch(ifc::error_condition::UnexpectedVisitor& e)
{
std::cerr << "visit unexpected " << e.category << ": "
Expand Down
4 changes: 4 additions & 0 deletions src/sgraph.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,11 @@ namespace ifc {
{
auto p = table.find(name);
if (p == table.end())
#ifdef FIX_MEMORY_ACCESS_BUG
throw InvalidPartitionName{std::string{name}};
#else
throw InvalidPartitionName{name};
#endif
return p->sort;
}

Expand Down