diff --git a/bootstrap_compiler/jou_compiler.h b/bootstrap_compiler/jou_compiler.h index 23918319..fa15c9bb 100644 --- a/bootstrap_compiler/jou_compiler.h +++ b/bootstrap_compiler/jou_compiler.h @@ -7,8 +7,6 @@ #include #include "util.h" -void update_jou_compiler(void); - // don't like repeating "struct" outside this header file typedef struct Location Location; typedef struct Token Token; @@ -627,7 +625,6 @@ Token *tokenize(FILE *f, const char *filename); AstFile parse(const Token *tokens, const char *stdlib_path); // Type checking happens between parsing and building CFGs. CfGraphFile build_control_flow_graphs(const AstFile *ast, FileTypes *ft); -void simplify_control_flow_graphs(const CfGraphFile *cfgfile); LLVMModuleRef codegen(const CfGraphFile *cfgfile, const FileTypes *ft); char *compile_to_object_file(LLVMModuleRef module); char *get_default_exe_path(void); diff --git a/bootstrap_compiler/main.c b/bootstrap_compiler/main.c index 548993cc..f6295a62 100644 --- a/bootstrap_compiler/main.c +++ b/bootstrap_compiler/main.c @@ -36,7 +36,6 @@ static const char help_fmt[] = "Usage:\n" " [-o OUTFILE] [-O0|-O1|-O2|-O3] [--verbose] [--linker-flags \"...\"] FILENAME\n" " --help # This message\n" - " --update # Download and install the latest Jou\n" "\n" "Options:\n" " -o OUTFILE output an executable file, don't run the code\n" @@ -72,14 +71,9 @@ void parse_arguments(int argc, char **argv) exit(0); } - if (argc == 2 && !strcmp(argv[1], "--update")) { - update_jou_compiler(); - exit(0); - } - int i = 1; while (i < argc) { - if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "--update")) { + if (!strcmp(argv[i], "--help")) { fprintf(stderr, "%s: \"%s\" cannot be used with other arguments", argv[0], argv[i]); goto wrong_usage; } else if (!strcmp(argv[i], "--verbose")) { @@ -276,12 +270,6 @@ static char *compile_ast_to_object_file(struct FileState *fs) if(command_line_args.verbosity >= 2) print_control_flow_graphs(&cfgfile); - if(command_line_args.verbosity >= 1) - printf("Analyzing CFGs: %s\n", fs->path); - simplify_control_flow_graphs(&cfgfile); - if(command_line_args.verbosity >= 2) - print_control_flow_graphs(&cfgfile); - if (command_line_args.verbosity >= 1) printf("Building LLVM IR: %s\n", fs->path); diff --git a/bootstrap_compiler/update.c b/bootstrap_compiler/update.c deleted file mode 100644 index 1caba0b4..00000000 --- a/bootstrap_compiler/update.c +++ /dev/null @@ -1,76 +0,0 @@ -// Self-update: "jou --update" updates the Jou compiler. - -#ifdef _WIN32 - #include - #define chdir _chdir -#else - #include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include "util.h" - -#ifdef __NetBSD__ - #define MAKE "gmake" -#else - #define MAKE "make" -#endif - -static noreturn void fail() -{ - char *s = - "\n" - "Updating Jou failed. If you need help, please create an issue on GitHub:\n" - " https://github.com/Akuli/jou/issues/new" - ; - puts(s); - exit(1); -} - -static void confirm(const char *prompt) -{ - printf("%s (y/n) ", prompt); - fflush(stdout); - - char line[50] = {0}; - fgets(line, sizeof line, stdin); - trim_whitespace(line); - - bool yes = !strcmp(line, "Y") || !strcmp(line, "y"); - if (!yes) { - printf("Aborted.\n"); - exit(1); - } -} - -void update_jou_compiler() -{ - char *exe = find_current_executable(); - const char *exedir = dirname(exe); - printf("Installation directory: %s\n\n", exedir); - - if (chdir(exedir) == -1) { - fprintf(stderr, "chdir(\"%s\") failed: %s\n", exedir, strerror(errno)); - fail(); - } - -#ifdef _WIN32 - confirm("Download and install the latest version of Jou from GitHub releases?"); - if (system("powershell -ExecutionPolicy bypass -File update.ps1") != 0) - fail(); -#else - confirm("Run \"git pull && "MAKE"\"?"); - if (system("git pull && " MAKE)) - fail(); -#endif - - free(exe); - printf("\n\nYou now have the latest version of Jou :)\n"); -} diff --git a/bootstrap_compiler/simplify_cfg.c b/self_hosted_old/simplify_cfg.c similarity index 100% rename from bootstrap_compiler/simplify_cfg.c rename to self_hosted_old/simplify_cfg.c