create C files with ".c" suffix
This commit is contained in:
parent
6217665076
commit
bd52a4c5d5
@ -8,7 +8,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static char preprocessed_fname[] = "/tmp/cxlppXXXXXX";
|
static char preprocessed_fname[] = "/tmp/cxlppXXXXXX";
|
||||||
static char c_fname[] = "/tmp/cxlcXXXXXX";
|
static char c_fname[] = "/tmp/cxlcXXXXXX.c";
|
||||||
static bool preprocessed_fname_created = false;
|
static bool preprocessed_fname_created = false;
|
||||||
static bool c_fname_created = false;
|
static bool c_fname_created = false;
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ void write_node(FILE * file, Node * node)
|
|||||||
|
|
||||||
bool emit_c(Node * node)
|
bool emit_c(Node * node)
|
||||||
{
|
{
|
||||||
int fd = mkstemp(c_fname);
|
int fd = mkstemps(c_fname, 2);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
perror("mkstemp");
|
perror("mkstemp");
|
||||||
@ -94,7 +94,7 @@ bool compile()
|
|||||||
}
|
}
|
||||||
else if (pid == 0)
|
else if (pid == 0)
|
||||||
{
|
{
|
||||||
execlp("gcc", "gcc", "-x", "c", "-c", c_fname, "-o", "out.o", NULL);
|
execlp("gcc", "gcc", "-c", c_fname, "-o", "out.o", NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user