mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Enabled -fno-exceptions
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
project(HPCore)
|
||||
|
||||
add_definitions("-std=c++17")
|
||||
add_definitions("-std=c++17" "-fno-exceptions")
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY build)
|
||||
|
||||
@@ -22,7 +22,7 @@ add_executable(hpcore
|
||||
target_link_libraries(hpcore
|
||||
libsodium.a
|
||||
libboost_system.a
|
||||
libboost_filesystem.a
|
||||
stdc++fs
|
||||
pthread
|
||||
protobuf.a
|
||||
)
|
||||
14
src/conf.cpp
14
src/conf.cpp
@@ -1,13 +1,13 @@
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <experimental/filesystem>
|
||||
#include <sodium.h>
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/schema.h>
|
||||
#include <rapidjson/istreamwrapper.h>
|
||||
#include <rapidjson/ostreamwrapper.h>
|
||||
#include <rapidjson/prettywriter.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "conf.hpp"
|
||||
#include "crypto.hpp"
|
||||
#include "util.hpp"
|
||||
@@ -67,15 +67,15 @@ int rekey()
|
||||
*/
|
||||
int create_contract()
|
||||
{
|
||||
if (boost::filesystem::exists(ctx.contractDir))
|
||||
if (std::experimental::filesystem::exists(ctx.contractDir))
|
||||
{
|
||||
std::cerr << "Contract dir already exists. Cannot create contract at the same location.\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
boost::filesystem::create_directories(ctx.configDir);
|
||||
boost::filesystem::create_directories(ctx.histDir);
|
||||
boost::filesystem::create_directories(ctx.stateDir);
|
||||
std::experimental::filesystem::create_directories(ctx.configDir);
|
||||
std::experimental::filesystem::create_directories(ctx.histDir);
|
||||
std::experimental::filesystem::create_directories(ctx.stateDir);
|
||||
|
||||
//Create config file with default settings.
|
||||
|
||||
@@ -335,7 +335,7 @@ int validate_config()
|
||||
}
|
||||
|
||||
// Check whether the contract binary actually exists.
|
||||
if (!boost::filesystem::exists(cfg.binary))
|
||||
if (!std::experimental::filesystem::exists(cfg.binary))
|
||||
{
|
||||
std::cerr << "Contract binary does not exist: " << cfg.binary << std::endl;
|
||||
return -1;
|
||||
@@ -364,7 +364,7 @@ int validate_contract_dir_paths()
|
||||
|
||||
for (std::string &dir : dirs)
|
||||
{
|
||||
if (!boost::filesystem::exists(dir))
|
||||
if (!std::experimental::filesystem::exists(dir))
|
||||
{
|
||||
std::cerr << dir << " does not exist.\n";
|
||||
return -1;
|
||||
|
||||
12
src/main.cpp
12
src/main.cpp
@@ -2,6 +2,9 @@
|
||||
Entry point for HP Core
|
||||
**/
|
||||
|
||||
// This will direct all boost exceptions to our error handler.
|
||||
#define BOOST_NO_EXCEPTIONS
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
@@ -147,3 +150,12 @@ int main(int argc, char **argv)
|
||||
std::cout << "exited normally\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Global exception handler for boost exceptions.
|
||||
*/
|
||||
void boost::throw_exception(std::exception const &e)
|
||||
{
|
||||
std::cerr << "Boost error:" << e.what() << std::endl;
|
||||
exit(-1);
|
||||
}
|
||||
Reference in New Issue
Block a user