From 940d90b10044e45c097d16327c245e6af7813acf Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Wed, 13 May 2026 20:13:49 +0200 Subject: [PATCH] ivlpp: when using '-V' option return immediatly after printing This avoids a runtime failure. --- ivlpp/main.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ivlpp/main.c b/ivlpp/main.c index fb50b9516..b7910abd4 100644 --- a/ivlpp/main.c +++ b/ivlpp/main.c @@ -59,6 +59,8 @@ char *dep_path = NULL; char dep_mode = 'a'; /* verbose flag */ int verbose_flag = 0; +/* version flag */ +int version_flag = 0; /* Path to vhdlpp */ char *vhdlpp_path = 0; /* vhdlpp work directory */ @@ -350,19 +352,12 @@ int main(int argc, char*argv[]) break; case 'v': - fprintf(stderr, "Icarus Verilog Preprocessor version " - VERSION " (" VERSION_TAG ")\n\n"); - fprintf(stderr, "%s\n\n", COPYRIGHT); - fputs(NOTICE, stderr); verbose_flag = 1; break; case 'V': - fprintf(stdout, "Icarus Verilog Preprocessor version " - VERSION " (" VERSION_TAG ")\n\n"); - fprintf(stdout, "%s\n\n", COPYRIGHT); - fputs(NOTICE, stdout); - return 0; + version_flag = 1; + break; default: flag_errors += 1; @@ -387,6 +382,14 @@ int main(int argc, char*argv[]) return flag_errors; } + if (version_flag) { + fprintf(stdout, "Icarus Verilog Preprocessor version " + VERSION " (" VERSION_TAG ")\n\n"); + fprintf(stdout, "%s\n\n", COPYRIGHT); + fputs(NOTICE, stdout); + return 0; + } + /* Collect the file names on the command line in the source file list, then if there is a file list, read more file names from there. */