diff main.c @ 141:63414cddf09c

Accept and ignore -m32. I thought this had been handled a long time back, but apparently not. :-?
author David A. Holland
date Wed, 10 Jul 2013 13:48:07 -0400
parents 904f7a9827e3
children 26ee741196d1
line wrap: on
line diff
--- a/main.c	Wed Jul 10 02:03:26 2013 -0400
+++ b/main.c	Wed Jul 10 13:48:07 2013 -0400
@@ -83,9 +83,6 @@
 	.unused = false,
 };
 
-/* this is always true, but can be set explicitly with -traditional */
-static bool traditional = true;
-
 ////////////////////////////////////////////////////////////
 // commandline macros
 
@@ -735,6 +732,10 @@
 ////////////////////////////////////////////////////////////
 // options
 
+struct ignore_option {
+	const char *string;
+};
+
 struct flag_option {
 	const char *string;
 	bool *flag;
@@ -756,6 +757,12 @@
 	void (*func)(const struct place *, char *);
 };
 
+static const struct ignore_option ignore_options[] = {
+	{ "m32" },
+	{ "traditional" },
+};
+static const unsigned num_ignore_options = HOWMANY(ignore_options);
+
 static const struct flag_option flag_options[] = {
 	{ "C",                          &mode.output_retain_comments,  true },
 	{ "CC",                         &mode.output_retain_comments,  true },
@@ -775,7 +782,6 @@
 	{ "fdollars-in-identifiers",    &mode.input_allow_dollars,     true },
 	{ "fno-dollars-in-identifiers", &mode.input_allow_dollars,     false },
 	{ "nostdinc",                   &mode.do_stdinc,               false },
-	{ "traditional",		&traditional,    	       true },
 	{ "undef",                      &mode.do_stddef,               false },
 };
 static const unsigned num_flag_options = HOWMANY(flag_options);
@@ -825,6 +831,25 @@
 
 static
 bool
+check_ignore_option(const char *opt)
+{
+	unsigned i;
+	int r;
+
+	for (i=0; i<num_ignore_options; i++) {
+		r = strcmp(opt, ignore_options[i].string);
+		if (r == 0) {
+			return true;
+		}
+		if (r < 0) {
+			break;
+		}
+	}
+	return false;
+}
+
+static
+bool
 check_flag_option(const char *opt)
 {
 	unsigned i;
@@ -1017,6 +1042,9 @@
 			break;
 		}
 		place_setcommandline(&cmdplace, i, 1);
+		if (check_ignore_option(argv[i]+1)) {
+			continue;
+		}
 		if (check_flag_option(argv[i]+1)) {
 			continue;
 		}