BugFix: Implement missing void casts, this fixed cp_error064.c
[cparser] / main.c
diff --git a/main.c b/main.c
index 5e2c7bc..5a58d74 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1191,6 +1191,24 @@ int main(int argc, char **argv)
                                        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")) {
@@ -1268,7 +1286,7 @@ int main(int argc, char **argv)
 
        if (print_file_name_file != NULL) {
                print_file_name(print_file_name_file);
-               return 0;
+               return EXIT_SUCCESS;
        }
        if (files == NULL) {
                fprintf(stderr, "error: no input files specified\n");
@@ -1277,7 +1295,7 @@ int main(int argc, char **argv)
 
        if (argument_errors) {
                usage(argv[0]);
-               return 1;
+               return EXIT_FAILURE;
        }
 
        /* we do the lowering in ast2firm */
@@ -1364,7 +1382,7 @@ int main(int argc, char **argv)
                if (out == NULL) {
                        fprintf(stderr, "Couldn't open '%s' for writing: %s\n", outname,
                                        strerror(errno));
-                       return 1;
+                       return EXIT_FAILURE;
                }
        }
 
@@ -1566,13 +1584,13 @@ graph_built:
 
                                dump_ir_graph_file(out, irg);
                                fclose(out);
-                               exit(0);
+                               exit(EXIT_SUCCESS);
                        }
 
                        if (mode == CompileExportIR) {
                                fclose(out);
                                ir_export(outname);
-                               exit(0);
+                               exit(EXIT_SUCCESS);
                        }
 
                        gen_firm_finish(asm_out, filename, have_const_functions);
@@ -1673,7 +1691,7 @@ graph_built:
                int err = system(commandline);
                if (err != EXIT_SUCCESS) {
                        fprintf(stderr, "linker reported an error\n");
-                       exit(1);
+                       exit(EXIT_FAILURE);
                }
        }
 
@@ -1693,5 +1711,5 @@ graph_built:
        exit_types();
        exit_tokens();
        exit_symbol_table();
-       return 0;
+       return EXIT_SUCCESS;
 }