From 1a7684be24ba5d776c4f1f4c0889e1200c41d7b6 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 12 Oct 2014 12:18:38 +0200 Subject: [PATCH] Various small fixes for non-win32 builds --- kernel/yosys.cc | 10 +++++++--- kernel/yosys.h | 5 ++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 4af3ff9c0..fa14c5d9a 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -30,6 +30,11 @@ #ifdef _WIN32 # include +#elif defined(__APPLE__) +# include +#else +# include +# include #endif #include @@ -263,7 +268,7 @@ std::string make_temp_dir(std::string template_str) log_assert(suffixlen == 0); char *p = strdup(template_str.c_str()); - mkdtemp(p, suffixlen); + mkdtemp(p); template_str = p; free(p); @@ -282,7 +287,7 @@ void remove_directory(std::string dirname) log_assert(n >= 0); for (int i = 0; i < n; i++) { if (strcmp(namelist[i]->d_name, ".") && strcmp(namelist[i]->d_name, "..")) { - buffer = stringf("%s/%s", dirname.c_str(), namelist[i]->d_name); + std::string buffer = stringf("%s/%s", dirname.c_str(), namelist[i]->d_name); if (!stat(buffer.c_str(), &stbuf) && S_ISREG(stbuf.st_mode)) { log("Removing `%s'.\n", buffer.c_str()); remove(buffer.c_str()); @@ -455,7 +460,6 @@ std::string proc_self_dirname() return std::string(path, buflen); } #elif defined(__APPLE__) -#include std::string proc_self_dirname() { char *path = NULL; diff --git a/kernel/yosys.h b/kernel/yosys.h index e579e90d9..5a37dd3c5 100644 --- a/kernel/yosys.h +++ b/kernel/yosys.h @@ -58,6 +58,10 @@ #include #include +#ifdef YOSYS_ENABLE_TCL +# include +#endif + #define PRIVATE_NAMESPACE_BEGIN namespace { #define PRIVATE_NAMESPACE_END } #define YOSYS_NAMESPACE_BEGIN namespace Yosys { @@ -107,7 +111,6 @@ void yosys_setup(); void yosys_shutdown(); #ifdef YOSYS_ENABLE_TCL -#include Tcl_Interp *yosys_get_tcl_interp(); #endif