This is a bug in the minisat header. It can be fixed by adding spaces before
and after each occurrence of PRIi64 in the header file:
- sudo sed -i 's/PRIi64/ & /' /usr/include/minisat/utils/Options.h
+ sudo sed -i -e 's/PRIi64/ & /' /usr/include/minisat/utils/Options.h
Roadmap / Large-scale TODOs
#include <stdio.h>
#include <string.h>
#include <dirent.h>
+#include <errno.h>
+#include <limits.h>
struct Vhdl2verilogPass : public Pass {
Vhdl2verilogPass() : Pass("vhdl2verilog", "importing VHDL designs using vhdl2verilog") { }
log_error("For some reason mkdtemp() failed!\n");
if (!out_file.empty() && out_file[0] != '/') {
- char *pwd = get_current_dir_name();
+ char pwd [PATH_MAX];
+ if (!getcwd(pwd, sizeof(pwd))) {
+ log_cmd_error("getcwd failed: %s", strerror(errno));
+ log_abort();
+ }
out_file = pwd + ("/" + out_file);
- free(pwd);
}
FILE *f = fopen(stringf("%s/files.list", tempdir_name).c_str(), "wt");
if (file.empty())
continue;
if (file[0] != '/') {
- char *pwd = get_current_dir_name();
+ char pwd [PATH_MAX];
+ if (!getcwd(pwd, sizeof(pwd))) {
+ log_cmd_error("getcwd failed: %s", strerror(errno));
+ log_abort();
+ }
file = pwd + ("/" + file);
- free(pwd);
}
fprintf(f, "%s\n", file.c_str());
log("Adding '%s' to the file list.\n", file.c_str());
#include <unistd.h>
#include <libgen.h>
#include <dlfcn.h>
+#include <errno.h>
#include <algorithm>
#include "kernel/rtlil.h"
#include <stdio.h>
#include <time.h>
+#include <sys/time.h>
+#include <sys/resource.h>
#include <vector>
extern std::vector<FILE*> log_files;
}
static int64_t query() {
+#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)
struct timespec ts;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
return int64_t(ts.tv_sec)*1000000000 + ts.tv_nsec;
+#elif defined(RUSAGE_SELF)
+ struct rusage rusage;
+ int64_t t;
+ if (getrusage(RUSAGE_SELF, &rusage) == -1) {
+ log_cmd_error("getrusage failed!\n");
+ log_abort();
+ }
+ t = 1000000000ULL * (int64_t) rusage.ru_utime.tv_sec + (int64_t) rusage.ru_utime.tv_usec * 1000ULL;
+ t += 1000000000ULL * (int64_t) rusage.ru_stime.tv_sec + (int64_t) rusage.ru_stime.tv_usec * 1000ULL;
+ return t;
+#else
+ #error Dont know how to measure per-process CPU time. Need alternative method (times()/clocks()/gettimeofday()?).
+#endif
}
void reset() {
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <errno.h>
using namespace REGISTER_INTERN;
#define MAX_REG_COUNT 1000
#include <limits.h>
#include <stdint.h>
-#include <signal.h>
+#include <csignal>
#include <cinttypes>
#include <minisat/core/Solver.h>
#endif
}
- sighandler_t old_alarm_sighandler = NULL;
+ struct sigaction sig_action;
+ struct sigaction old_sig_action;
int old_alarm_timeout = 0;
if (solverTimeout > 0) {
+ sig_action.sa_handler = alarmHandler;
+ sigemptyset(&sig_action.sa_mask);
+ sig_action.sa_flags = SA_RESTART;
alarmHandlerThis = this;
alarmHandlerTimeout = clock() + solverTimeout*CLOCKS_PER_SEC;
old_alarm_timeout = alarm(0);
- old_alarm_sighandler = signal(SIGALRM, alarmHandler);
+ sigaction(SIGALRM, &sig_action, &old_sig_action);
alarm(1);
}
if (alarmHandlerTimeout == 0)
solverTimoutStatus = true;
alarm(0);
- signal(SIGALRM, old_alarm_sighandler);
+ sigaction(SIGALRM, &old_sig_action, NULL);
alarm(old_alarm_timeout);
}
#include "ezsat.h"
+#include <cmath>
#include <algorithm>
+#include <cassert>
#include <stdlib.h>
-#include <assert.h>
const int ezSAT::TRUE = 1;
const int ezSAT::FALSE = 2;
#include <stdio.h>
#include <string.h>
#include <dirent.h>
+#include <cerrno>
#include <sstream>
+#include <climits>
#include "blifparse.h"
int lut_mode = 0;
size_t argidx;
- char *pwd = get_current_dir_name();
+ char pwd [PATH_MAX];
+ if (!getcwd(pwd, sizeof(pwd))) {
+ log_cmd_error("getcwd failed: %s\n", strerror(errno));
+ log_abort();
+ }
for (argidx = 1; argidx < args.size(); argidx++) {
std::string arg = args[argidx];
if (arg == "-exe" && argidx+1 < args.size()) {
}
break;
}
- free(pwd);
extra_args(args, argidx, design);
if (lut_mode != 0 && !liberty_file.empty())
#include "kernel/log.h"
#include <string.h>
#include <fnmatch.h>
+#include <errno.h>
using RTLIL::id2cstr;
#include "kernel/consteval.h"
#include "kernel/celltypes.h"
#include "fsmdata.h"
-#include "math.h"
+#include <math.h>
#include <string.h>
+#include <errno.h>
static void fm_set_fsm_print(RTLIL::Cell *cell, RTLIL::Module *module, FsmData &fsm_data, const char *prefix, FILE *f)
{
#include "kernel/log.h"
#include "libparse.h"
#include <string.h>
+#include <errno.h>
using namespace PASS_DFFLIBMAP;