From c31cddfd7c8429bbd091f9553c50f7bece23dd1e Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Tue, 13 Aug 2002 06:48:18 +0000 Subject: 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 --- gcc/ChangeLog | 5 +++++ gcc/c-opts.c | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e125b61..6284939 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-08-13 Neil Booth + + * c-opts.c (c_common_init_options): Check option array is + sorted if checking enabled. + 2002-08-13 Gabriel Dos Reis * c-pretty-print.c: #include "c-tree.h". 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); -- cgit v1.1