From 6876d05ff1a5c210bde1f9c5929e68fe4b37d8e7 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 20 Dec 2017 09:41:08 -0500 Subject: [PATCH 24/25] {approved} Add selftest for "fold_for_warn (error_mark_node)" 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. --- gcc/c-family/c-common.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 (); -- 1.8.5.3