This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add selftest for "fold_for_warn (error_mark_node)"

Maybe this is overkill, but this patch adds a selftest that:

   fold_for_warn (error_mark_node)

does the right thing.

Successfully bootstrapped&regrtested 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?

	* 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.  */
 c_family_tests (void)
+  c_common_c_tests ();
   c_format_c_tests ();
   c_pretty_print_c_tests ();
   c_spellcheck_cc_tests ();

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]