diff options
author | Sean Cross <sean@xobs.io> | 2019-09-08 15:50:24 +0800 |
---|---|---|
committer | Sean Cross <sean@xobs.io> | 2019-09-08 15:50:24 +0800 |
commit | 417f3fe6b19a0ed36cabe526fe3c67214b32971d (patch) | |
tree | c0b386b5af51d61869bdd8ef21b8325c70d3d710 | |
parent | c1b628508d54eb0ab6e5c9559063330a409d0a51 (diff) | |
download | yosys-417f3fe6b19a0ed36cabe526fe3c67214b32971d.tar.gz yosys-417f3fe6b19a0ed36cabe526fe3c67214b32971d.tar.bz2 yosys-417f3fe6b19a0ed36cabe526fe3c67214b32971d.zip |
msys2: launcher: fix warnings and errors under g++
When building under G++, certain C-isms no longer work. For example,
we must now cast the return from `calloc()`.
Fix `launcher.c` so that it builds under whatever $CXX is set to,
which is usually a C++ compiler.
Signed-off-by: Sean Cross <sean@xobs.io>
-rw-r--r-- | misc/launcher.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/misc/launcher.c b/misc/launcher.c index e0d8208f1..49d6414e7 100644 --- a/misc/launcher.c +++ b/misc/launcher.c @@ -65,7 +65,7 @@ SOFTWARE. */ int child_pid=0; -int fail(char *format, char *data) { +int fail(const char *format, const char *data) { /* Print error message to stderr and return 2 */ fprintf(stderr, format, data); return 2; @@ -76,7 +76,7 @@ char *quoted(char *data) { /* We allocate twice as much space as needed to deal with worse-case of having to escape everything. */ - char *result = calloc(ln*2+3, sizeof(char)); + char *result = (char *)calloc(ln*2+3, sizeof(char)); char *presult = result; *presult++ = '"'; @@ -120,7 +120,7 @@ char *loadable_exe(char *exename) { if (!hPython) return NULL; */ /* Return the absolute filename for spawnv */ - result = calloc(MAX_PATH, sizeof(char)); + result = (char *)calloc(MAX_PATH, sizeof(char)); strncpy(result, exename, MAX_PATH); /*if (result) GetModuleFileNameA(hPython, result, MAX_PATH); @@ -158,7 +158,7 @@ char **parse_argv(char *cmdline, int *argc) { /* Parse a command line in-place using MS C rules */ - char **result = calloc(strlen(cmdline), sizeof(char *)); + char **result = (char **)calloc(strlen(cmdline), sizeof(char *)); char *output = cmdline; char c; int nb = 0; |