From 36d955a7aaefac5bc970ecf86b391044b3fec458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=99=BD=E4=BA=91?= <71159641+littlewhitecloud@users.noreply.github.com> Date: Sun, 17 Dec 2023 21:27:29 +0800 Subject: [PATCH] O1 is the default in the help message (#464) Co-authored-by: Akuli --- src/main.c | 7 +++---- tests/should_succeed/compiler_cli.jou | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index 9cff4bc5..17129562 100644 --- a/src/main.c +++ b/src/main.c @@ -40,7 +40,7 @@ static const char help_fmt[] = "\n" "Options:\n" " -o OUTFILE output an executable file, don't run the code\n" - " -O0/-O1/-O2/-O3 set optimization level (0 = default, 3 = runs fastest)\n" + " -O0/-O1/-O2/-O3 set optimization level (0 = no optimization, 1 = default, 3 = runs fastest)\n" " -v / --verbose display some progress information\n" " -vv display a lot of information about all compilation steps\n" " --valgrind use valgrind when running the code\n" @@ -55,9 +55,8 @@ void parse_arguments(int argc, char **argv) { memset(&command_line_args, 0, sizeof command_line_args); command_line_args.argv0 = argv[0]; - command_line_args.optlevel = 1; /* Set default optimize to O1 - User sets optimize will overwrite the default flag - */ + /* Set default optimize to O1, user sets optimize will overwrite the default flag*/ + command_line_args.optlevel = 1; if (argc == 2 && !strcmp(argv[1], "--help")) { // Print help. diff --git a/tests/should_succeed/compiler_cli.jou b/tests/should_succeed/compiler_cli.jou index df9b3a8c..abf56f03 100644 --- a/tests/should_succeed/compiler_cli.jou +++ b/tests/should_succeed/compiler_cli.jou @@ -37,7 +37,7 @@ def main() -> int: # Output: # Output: Options: # Output: -o OUTFILE output an executable file, don't run the code - # Output: -O0/-O1/-O2/-O3 set optimization level (0 = default, 3 = runs fastest) + # Output: -O0/-O1/-O2/-O3 set optimization level (0 = no optimization, 1 = default, 3 = runs fastest) # Output: -v / --verbose display some progress information # Output: -vv display a lot of information about all compilation steps # Output: --valgrind use valgrind when running the code