diff mbox series

[2/2] cgcc: -MF, -MQ & -MT need an argument

Message ID 20190220133423.77834-3-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series cgcc: handle -MM, -MD, -MMD, -MF, -MQ & -MT | expand

Commit Message

Luc Van Oostenryck Feb. 20, 2019, 1:34 p.m. UTC
These flags expect an argument. So, the following element in
'@ARGV' must then not be considered as an option or an input file,
exactly like done for '-o FILE'.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 cgcc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/cgcc b/cgcc
index 6d3b10a20..e64e8c142 100755
--- a/cgcc
+++ b/cgcc
@@ -31,10 +31,10 @@  while (@ARGV) {
     # Ditto for stdin.
     $do_check = 1 if $_ eq '-';
 
-    if ($_ eq '-o') {
-	# Need to be checked explicitly since '-o -' is
-	# sometimes used and the '-' would otherwise be
-	# processed as an option.
+    if (/^-(o|MF|MT|MQ)$/) {
+	# Need to be checked explicitly since otherwise
+	# the argument would be processed as a
+	# (non-existant) source file or as an option.
 	die ("$0: missing argument for $_") if !@ARGV;
 	$nargs = 1;
     }