]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
selftest: Move C-specific tests to c_family
authorArthur Cohen <arthur.cohen@embecosm.com>
Sat, 19 Mar 2022 18:25:51 +0000 (14:25 -0400)
committerJeff Law <jeffreyalaw@gmail.com>
Sat, 19 Mar 2022 18:29:43 +0000 (14:29 -0400)
When trying to make use of the selftest framework over on the rust
frontend, we ran into issues where rust1 was expected to produce errors
containing C-like type names such as `int`.

I had gotten in contact with David Malcolm on the gcc mailing list [1],
who advised moving some test functions to a better location. The
offending functions have also been renamed in order to better fit the C
family of tests, and are thus not called when performing general
selftests anymore.

Kindly,

[1]: https://gcc.gnu.org/pipermail/gcc/2021-November/237703.html

2022-02-16 Arthur Cohen <arthur.cohen@embecosm.com>

gcc/c-family/

* c-common.cc (c_family_tests): Call the new tests.
* c-common.h (c_diagnostic_tests): Declare.
(c_opt_problem_cc_tests): Likewise.

gcc/
* diagnostic.cc (diagnostic_cc_tests): Rename to...
(c_diagnostic_cc_tests): ...this.
* opt-problem.cc (opt_problem_cc_tests): Rename to...
(c_opt_problem_cc_tests): ...this.
* selftest-run-tests.cc (selftest::run_tests): No longer run
opt_problem_cc_tests or diagnostic_cc_tests.
* selftest.h (diagnostic_cc_tests): Remove declaration.
(opt_problem_cc_tests): Likewise.

gcc/c-family/c-common.cc
gcc/c-family/c-common.h
gcc/diagnostic.cc
gcc/opt-problem.cc
gcc/selftest-run-tests.cc
gcc/selftest.h

index 7203d761df1c53149fcf269628537c0833eccd62..d034837bb5bb7ad82967c4f4751b3df73541323e 100644 (file)
@@ -9120,6 +9120,8 @@ c_family_tests (void)
   c_indentation_cc_tests ();
   c_pretty_print_cc_tests ();
   c_spellcheck_cc_tests ();
+  c_diagnostic_cc_tests ();
+  c_opt_problem_cc_tests ();
 }
 
 } // namespace selftest
index 5f0b5d99d07f1a4bb829b5c282c6c98dc5e73892..52a85bfb78308fa7d703bd7f1c03639197e331ce 100644 (file)
@@ -1512,8 +1512,10 @@ extern tree braced_lists_to_strings (tree, tree);
 namespace selftest {
   /* Declarations for specific families of tests within c-family,
      by source file, in alphabetical order.  */
+  extern void c_diagnostic_cc_tests (void);
   extern void c_format_cc_tests (void);
   extern void c_indentation_cc_tests (void);
+  extern void c_opt_problem_cc_tests (void);
   extern void c_pretty_print_cc_tests (void);
   extern void c_spellcheck_cc_tests (void);
 
index 87eb473d2f35515a5866ec3a8603806326fc3009..73324a728fe550619c2345e3ecdb0fd40b6eb257 100644 (file)
@@ -2472,7 +2472,7 @@ test_num_digits ()
 /* Run all of the selftests within this file.  */
 
 void
-diagnostic_cc_tests ()
+c_diagnostic_cc_tests ()
 {
   test_print_escaped_string ();
   test_print_parseable_fixits_none ();
index e45d14e94b60f0071ae82e18e184a7d7bd17f946..11fec57d6791d25b58553e7b9e21bdf1a924c0ac 100644 (file)
@@ -324,7 +324,7 @@ test_opt_result_failure_at (const line_table_case &case_)
 /* Run all of the selftests within this file.  */
 
 void
-opt_problem_cc_tests ()
+c_opt_problem_cc_tests ()
 {
   test_opt_result_success ();
   for_each_line_table_case (test_opt_result_failure_at);
index 99c3542325368215dbabe3c0d312c54d9ddff6a1..d59e0aeddee24d4c657d05fe26928f479b05aabe 100644 (file)
@@ -76,7 +76,6 @@ selftest::run_tests ()
   json_cc_tests ();
   cgraph_cc_tests ();
   optinfo_emit_json_cc_tests ();
-  opt_problem_cc_tests ();
   ordered_hash_map_tests_cc_tests ();
   splay_tree_cc_tests ();
 
@@ -95,7 +94,6 @@ selftest::run_tests ()
   /* Higher-level tests, or for components that other selftests don't
      rely on.  */
   diagnostic_show_locus_cc_tests ();
-  diagnostic_cc_tests ();
   diagnostic_format_json_cc_tests ();
   edit_context_cc_tests ();
   fold_const_cc_tests ();
index 7a715631c623fa566d2368059874880733f8c550..7568a6d24d499fdb474b8dc5ff46e8b0fc44d896 100644 (file)
@@ -222,7 +222,6 @@ extern void attribs_cc_tests ();
 extern void bitmap_cc_tests ();
 extern void cgraph_cc_tests ();
 extern void convert_cc_tests ();
-extern void diagnostic_cc_tests ();
 extern void diagnostic_format_json_cc_tests ();
 extern void diagnostic_show_locus_cc_tests ();
 extern void digraph_cc_tests ();
@@ -238,7 +237,6 @@ extern void hash_map_tests_cc_tests ();
 extern void hash_set_tests_cc_tests ();
 extern void input_cc_tests ();
 extern void json_cc_tests ();
-extern void opt_problem_cc_tests ();
 extern void optinfo_emit_json_cc_tests ();
 extern void opts_cc_tests ();
 extern void ordered_hash_map_tests_cc_tests ();