mirror of https://github.com/YosysHQ/yosys.git
- frontends/vhdl2verilog/vhdl2verilog.cc: #include <cerrno> for errno; use POSIX getcwd() for portability.
This commit is contained in:
parent
c056217e72
commit
f6579282d7
|
@ -26,6 +26,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
struct Vhdl2verilogPass : public Pass {
|
struct Vhdl2verilogPass : public Pass {
|
||||||
Vhdl2verilogPass() : Pass("vhdl2verilog", "importing VHDL designs using vhdl2verilog") { }
|
Vhdl2verilogPass() : Pass("vhdl2verilog", "importing VHDL designs using vhdl2verilog") { }
|
||||||
|
@ -93,9 +94,12 @@ struct Vhdl2verilogPass : public Pass {
|
||||||
log_error("For some reason mkdtemp() failed!\n");
|
log_error("For some reason mkdtemp() failed!\n");
|
||||||
|
|
||||||
if (!out_file.empty() && out_file[0] != '/') {
|
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);
|
out_file = pwd + ("/" + out_file);
|
||||||
free(pwd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *f = fopen(stringf("%s/files.list", tempdir_name).c_str(), "wt");
|
FILE *f = fopen(stringf("%s/files.list", tempdir_name).c_str(), "wt");
|
||||||
|
@ -104,9 +108,12 @@ struct Vhdl2verilogPass : public Pass {
|
||||||
if (file.empty())
|
if (file.empty())
|
||||||
continue;
|
continue;
|
||||||
if (file[0] != '/') {
|
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);
|
file = pwd + ("/" + file);
|
||||||
free(pwd);
|
|
||||||
}
|
}
|
||||||
fprintf(f, "%s\n", file.c_str());
|
fprintf(f, "%s\n", file.c_str());
|
||||||
log("Adding '%s' to the file list.\n", file.c_str());
|
log("Adding '%s' to the file list.\n", file.c_str());
|
||||||
|
|
Loading…
Reference in New Issue