diff options
author | Martin Liska <mliska@suse.cz> | 2018-06-28 09:11:16 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-06-28 07:11:16 +0000 |
commit | d86c7648fb9643640d8c82be19d49927aa488768 (patch) | |
tree | b45fc0d4134e27d198b87360705d0182c44f8f25 /gcc/selftest.h | |
parent | 98086b2ba2bd021e887788cea410410e61eaee42 (diff) | |
download | gcc-d86c7648fb9643640d8c82be19d49927aa488768.zip gcc-d86c7648fb9643640d8c82be19d49927aa488768.tar.gz gcc-d86c7648fb9643640d8c82be19d49927aa488768.tar.bz2 |
Come up with new --completion option.
2018-06-28 Martin Liska <mliska@suse.cz>
* common.opt: Introduce -completion option.
* gcc.c (driver_handle_option): Handle it.
(driver::main): Print completions if completion
is set.
* opt-suggestions.c (option_proposer::get_completions):
New function.
(option_proposer::suggest_completion): Likewise.
(option_proposer::find_param_completions): Likewise.
(verify_autocompletions): Likewise.
(test_completion_valid_options): Likewise.
(test_completion_valid_params): Likewise.
(in_completion_p): Likewise.
(empty_completion_p): Likewise.
(test_completion_partial_match): Likewise.
(test_completion_garbage): Likewise.
(opt_proposer_c_tests): Likewise.
* opt-suggestions.h: Declare new functions.
* opts.c (common_handle_option): Handle OPT__completion_.
* selftest-run-tests.c (selftest::run_tests): Add
opt_proposer_c_tests.
* selftest.c (assert_str_startswith): New.
* selftest.h (assert_str_startswith): Likewise.
(opt_proposer_c_tests): New.
(ASSERT_STR_STARTSWITH): Likewise.
From-SVN: r262210
Diffstat (limited to 'gcc/selftest.h')
-rw-r--r-- | gcc/selftest.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/selftest.h b/gcc/selftest.h index a5507cc..d66fb93 100644 --- a/gcc/selftest.h +++ b/gcc/selftest.h @@ -78,6 +78,15 @@ extern void assert_str_contains (const location &loc, const char *val_haystack, const char *val_needle); +/* Implementation detail of ASSERT_STR_STARTSWITH. */ + +extern void assert_str_startswith (const location &loc, + const char *desc_str, + const char *desc_prefix, + const char *val_str, + const char *val_prefix); + + /* A named temporary file for use in selftests. Usable for writing out files, and as the base class for temp_source_file. @@ -217,6 +226,7 @@ extern void unique_ptr_tests_cc_tests (); extern void vec_c_tests (); extern void vec_perm_indices_c_tests (); extern void wide_int_cc_tests (); +extern void opt_proposer_c_tests (); extern int num_passes; @@ -402,6 +412,16 @@ extern int num_passes; (HAYSTACK), (NEEDLE)); \ SELFTEST_END_STMT +/* Evaluate STR and PREFIX and determine if STR starts with PREFIX. + ::selftest::pass if STR does start with PREFIX. + ::selftest::fail if does not, or either is NULL. */ + +#define ASSERT_STR_STARTSWITH(STR, PREFIX) \ + SELFTEST_BEGIN_STMT \ + ::selftest::assert_str_startswith (SELFTEST_LOCATION, #STR, #PREFIX, \ + (STR), (PREFIX)); \ + SELFTEST_END_STMT + /* Evaluate PRED1 (VAL1), calling ::selftest::pass if it is true, ::selftest::fail if it is false. */ |