Message ID | 1513799139-15089-1-git-send-email-dmalcolm@redhat.com |
---|---|
State | New |
Headers | show |
Series | Add selftest for "fold_for_warn (error_mark_node)" | expand |
On 12/20/2017 12:45 PM, David Malcolm wrote: > Maybe this is overkill, but this patch adds a selftest that: > > fold_for_warn (error_mark_node) > > does the right thing. > > Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. > > Manually tested with "make s-selftest-c++" (since we don't run > the selftests for cc1plus by default). > > OK for trunk? > > gcc/c-family/ChangeLog: > * c-common.c: Include "selftest.h". > (selftest::test_fold_for_warn): New function. > (selftest::c_common_c_tests): New function. > (selftest::c_family_tests): Call it. OK. jeff
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 7cc749b..80f7495 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see #include "gimplify.h" #include "substring-locations.h" #include "spellcheck.h" +#include "selftest.h" cpp_reader *parse_in; /* Declared in c-pragma.h. */ @@ -8173,11 +8174,28 @@ maybe_suggest_missing_token_insertion (rich_location *richloc, namespace selftest { +/* Verify that fold_for_warn on error_mark_node is safe. */ + +static void +test_fold_for_warn () +{ + ASSERT_EQ (error_mark_node, fold_for_warn (error_mark_node)); +} + +/* Run all of the selftests within this file. */ + +static void +c_common_c_tests () +{ + test_fold_for_warn (); +} + /* Run all of the tests within c-family. */ void c_family_tests (void) { + c_common_c_tests (); c_format_c_tests (); c_pretty_print_c_tests (); c_spellcheck_cc_tests ();