Mercurial > octave
changeset 32360:9865d2a1b49b
maint: Merge stable to default.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 29 Sep 2023 12:09:39 +0200 |
parents | 8f4bc20584ed (current diff) f760ab971d40 (diff) |
children | 2239b16d17cd |
files | src/mkoctfile.in.cc |
diffstat | 1 files changed, 20 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/mkoctfile.in.cc Thu Sep 28 19:32:56 2023 -0400 +++ b/src/mkoctfile.in.cc Fri Sep 29 12:09:39 2023 +0200 @@ -755,6 +755,7 @@ bool r2018a_option = false; // The default for this may change in the future. bool mx_has_interleaved_complex = false; + bool pass_on_followup = false; for (int i = 1; i < argc; i++) { @@ -762,6 +763,8 @@ std::string file; + bool found_unknown_dash_arg = false; + if (ends_with (arg, ".c")) { file = arg; @@ -936,22 +939,21 @@ } else if (starts_with (arg, "-")) { + found_unknown_dash_arg = true; + // Pass through any unrecognized options. pass_on_options += (' ' + arg); - // If the current argument does not contain a '=' character, check - // for an additional argument following the option. - // However, don't copy the final position which is typically a file. - // FIXME: We might be copying flags that might need to be parsed - // instead. See bugs #52928 and #64590. - if (i < argc-2 && (arg.find ('=') == std::string::npos)) - { - arg = argv[i+1]; - if (arg[0] != '-') - { - pass_on_options += (' ' + arg); - i++; - } - } + + // Don't pass on the final position which is typically a file. + // FIXME: Does it make sense to have that exception for the last + // argument? + if (i < argc-2) + pass_on_followup = true; + } + else if (pass_on_followup) + { + // Pass through a followup argument. + pass_on_options += (' ' + arg); } else { @@ -959,6 +961,10 @@ return 1; } + // reset pass_on_followup if anything but an unknown argument was found + if (! found_unknown_dash_arg) + pass_on_followup = false; + if (! file.empty () && octfile.empty ()) octfile = file; }