FILE *f = popen(buf, "r");
if (f == NULL) {
fprintf(stderr, "invoking preprocessor failed\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
/* we don't really need that anymore */
int err = system(buf);
if (err != 0) {
fprintf(stderr, "assembler reported an error\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
obstack_free(&asflags_obst, NULL);
int err = system(commandline);
if (err != EXIT_SUCCESS) {
fprintf(stderr, "linker reported an error\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
}
if (fd == -1) {
fprintf(stderr, "couldn't create temporary file: %s\n",
strerror(errno));
- exit(1);
+ exit(EXIT_FAILURE);
}
FILE *out = fdopen(fd, "w");
if (out == NULL) {
fprintf(stderr, "couldn't create temporary file FILE*\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
file_list_entry_t *entry = xmalloc(sizeof(*entry));
if (in == NULL) {
fprintf(stderr, "Couldn't open '%s': %s\n", filename,
strerror(errno));
- exit(1);
+ exit(EXIT_FAILURE);
}
return in;
GET_ARG_AFTER(opt, "-isystem");
add_flag(&cppflags_obst, "-isystem");
add_flag(&cppflags_obst, "%s", opt);
+#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__CYGWIN__)
+ } else if (streq(option, "pthread")) {
+ /* set flags for the preprocessor */
+ add_flag(&cppflags_obst, "-D_REENTRANT");
+ /* set flags for the linker */
+ add_flag(&ldflags_obst, "-lpthread");
+#endif
} else if (streq(option, "nostdinc")
|| streq(option, "trigraphs")) {
/* pass these through to the preprocessor */
mode = PrintCaml;
} else if (streq(option, "print-jna")) {
mode = PrintJna;
+ } else if (streq(option, "jna-limit")) {
+ ++i;
+ if (i >= argc) {
+ fprintf(stderr, "error: "
+ "expected argument after '--jna-limit'\n");
+ argument_errors = true;
+ break;
+ }
+ jna_limit_output(argv[i]);
+ } else if (streq(option, "jna-libname")) {
+ ++i;
+ if (i >= argc) {
+ fprintf(stderr, "error: "
+ "expected argument after '--jna-libname'\n");
+ argument_errors = true;
+ break;
+ }
+ jna_set_libname(argv[i]);
} else if (streq(option, "time")) {
do_timing = true;
} else if (streq(option, "version")) {
print_cparser_version();
- exit(EXIT_SUCCESS);
+ return EXIT_SUCCESS;
} else if (streq(option, "help")) {
print_help(argv[0]);
help_displayed = true;
streq(suffix, "S") ? FILETYPE_ASSEMBLER :
streq(suffix, "a") ? FILETYPE_OBJECT :
streq(suffix, "c") ? FILETYPE_C :
+ streq(suffix, "C") ? FILETYPE_CXX :
streq(suffix, "cc") ? FILETYPE_CXX :
+ streq(suffix, "cp") ? FILETYPE_CXX :
streq(suffix, "cpp") ? FILETYPE_CXX :
+ streq(suffix, "CPP") ? FILETYPE_CXX :
streq(suffix, "cxx") ? FILETYPE_CXX :
+ streq(suffix, "c++") ? FILETYPE_CXX :
+ streq(suffix, "ii") ? FILETYPE_CXX :
streq(suffix, "h") ? FILETYPE_C :
streq(suffix, "ir") ? FILETYPE_IR :
streq(suffix, "o") ? FILETYPE_OBJECT :
in = open_file(filename);
lextest(in, filename);
fclose(in);
- exit(EXIT_SUCCESS);
+ return EXIT_SUCCESS;
}
FILE *preprocessed_in = NULL;
/* remove output file */
if (out != stdout)
unlink(outname);
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
}
if (irg == NULL) {
fprintf(stderr, "No graph for function '%s' found\n",
dumpfunction);
- exit(1);
+ return EXIT_FAILURE;
}
dump_ir_graph_file(out, irg);
fclose(out);
- exit(EXIT_SUCCESS);
+ return EXIT_SUCCESS;
}
if (mode == CompileExportIR) {
fclose(out);
ir_export(outname);
- exit(EXIT_SUCCESS);
+ return EXIT_SUCCESS;
}
gen_firm_finish(asm_out, filename, have_const_functions);
int err = system(commandline);
if (err != EXIT_SUCCESS) {
fprintf(stderr, "linker reported an error\n");
- exit(EXIT_FAILURE);
+ return EXIT_FAILURE;
}
}