aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-opts.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2002-08-13 06:48:18 +0000
committerNeil Booth <neil@gcc.gnu.org>2002-08-13 06:48:18 +0000
commitc31cddfd7c8429bbd091f9553c50f7bece23dd1e (patch)
treea0fdb2c9eaea85457195caca65b57d693edf0d99 /gcc/c-opts.c
parentf076f0ce31b273760d49817aeb128347c9b7d867 (diff)
downloadgcc-c31cddfd7c8429bbd091f9553c50f7bece23dd1e.zip
gcc-c31cddfd7c8429bbd091f9553c50f7bece23dd1e.tar.gz
gcc-c31cddfd7c8429bbd091f9553c50f7bece23dd1e.tar.bz2
c-opts.c (c_common_init_options): Check option array is sorted if checking enabled.
* c-opts.c (c_common_init_options): Check option array is sorted if checking enabled. From-SVN: r56241
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r--gcc/c-opts.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 189cb1b..2be9971 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -495,6 +495,14 @@ c_common_init_options (lang)
runtime. */
qsort (cl_options, N_OPTS, sizeof (struct cl_option), opt_comp);
#endif
+#if ENABLE_CHECKING
+ size_t i;
+
+ for (i = 1; i < N_OPTS; i++)
+ if (strcmp (cl_options[i - 1].opt_text, cl_options[i].opt_text) >= 0)
+ error ("options array incorrectly sorted: %s is before %s",
+ cl_options[i - 1].opt_text, cl_options[i].opt_text);
+#endif
c_language = lang;
parse_in = cpp_create_reader (lang == clk_c ? CLK_GNUC89 : CLK_GNUCXX);