Skip to content

Commit

Permalink
changes to compile with c++11; -Y option, generate icd
Browse files Browse the repository at this point in the history
  • Loading branch information
rochus-keller committed May 8, 2024
1 parent 3fdcbdd commit 38318fa
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
6 changes: 4 additions & 2 deletions BUSY
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ let config : Config {
} else {
.ldflags += "-static"
}
.cflags_cc += "-std=c++14"
.cflags_cc += "-std=c++11"
.defines += "HAVE_UNISTD_H"
}else if (target_toolchain == `clang) {
# NOTE: this is an experimental compile with Clang 4.0.1 and the libc++ headers;
# it compiles when the original C headers from the system are available
# linking is yet another adventure to be solved
.lib_names += [ "m" "stdc++" ]
.cflags_cc += "-std=c++14";
.cflags_cc += "-std=c++11";
.defines += "HAVE_UNISTD_H"
.include_dirs += [
//home/me/Programme/clang-4/includes
Expand Down Expand Up @@ -326,6 +326,8 @@ let eigen* : Executable {
./src/occopt/output.h
./src/occopt/configx86.cpp
./src/occopt/configx86.h
./src/occopt/iout.cpp
./src/occopt/iout.h

./src/ocpp/Floating.cpp
./src/ocpp/Floating.h
Expand Down
21 changes: 21 additions & 0 deletions src/eigen/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "SharedMemory.h"
#include "ilunstream.h"
#include "ioptimizer.h"
#include "ildata.h"
#include "iout.h"
using namespace Optimizer;

static const int MAX_SHARED_REGION = 500 * 1024 * 1024;
Expand Down Expand Up @@ -67,6 +69,25 @@ int main(int argc, char *argv[])
Utils::Fatal("cannot open input file");
}
if (!LoadFile(parserMem))
{
Utils::Fatal("internal error: could not load intermediate file");
return -1;
}
if (WriteIcdFile.GetValue())
{
char realOutFile[260];
strcpy(realOutFile, files[1].c_str());
Utils::StripExt(realOutFile);
Utils::AddExt(realOutFile, "_.icd");
Optimizer::icdFile = fopen(realOutFile, "w");
if (!Optimizer::icdFile)
{
Utils::Fatal("Cannot open '%s' for write", realOutFile);
return -1;
}
setvbuf(Optimizer::icdFile, 0, _IOFBF, 32768);
Optimizer::OutputIcdFile();
}

return 0;
}
8 changes: 4 additions & 4 deletions src/util/CmdSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ int CmdSwitchDefine::Parse(const char* data)
{
return -1;
}
std::unique_ptr<define> newDefine = std::make_unique<define>();
std::unique_ptr<define> newDefine(new define() );
newDefine->name = name;
if (*data == '=')
{
Expand Down Expand Up @@ -212,7 +212,7 @@ int CmdSwitchFile::Parse(const char* data)
in.seekg(0, std::ios::end);
size_t size = in.tellg();
in.seekg(0, std::ios::beg);
std::unique_ptr<char[]> data1 = std::make_unique<char[]>(size + 1);
std::unique_ptr<char[]> data1( new char[size + 1] );
memset(data1.get(), 0, size + 1);
in.read(data1.get(), size);
data1[size] = 0;
Expand All @@ -226,7 +226,7 @@ void CmdSwitchFile::Dispatch(char* data)
{
int max = 10;
argc = 1;
argv = std::make_unique<char*[]>(max);
argv.reset(new char*[max]);
argv[0] = (char*)"";
while (*data)
{
Expand All @@ -235,7 +235,7 @@ void CmdSwitchFile::Dispatch(char* data)
{
max += 10;
std::unique_ptr<char*[]> p = std::move(argv);
argv = std::make_unique<char*[]>(max);
argv.reset(new char*[max]);
memcpy(argv.get(), p.get(), argc * sizeof(char*));
}
}
Expand Down

0 comments on commit 38318fa

Please sign in to comment.