diff options
-rw-r--r-- | gcc/ChangeLog | 26 | ||||
-rw-r--r-- | gcc/Makefile.in | 62 | ||||
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 16 | ||||
-rw-r--r-- | gcc/c-family/c-common.h | 6 | ||||
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-lang.c | 5 | ||||
-rw-r--r-- | gcc/c/c-tree.h | 7 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/cp-lang.c | 24 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 6 |
11 files changed, 154 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d016a8e..20fcd82 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,29 @@ +2017-07-06 David Malcolm <dmalcolm@redhat.com> + + * Makefile.in (SELFTEST_FLAGS): Drop "-x c", moving it to... + (C_SELFTEST_FLAGS): New. + (CPP_SELFTEST_FLAGS): New. + (SELFTEST_DEPS): New, from deps of s-selftest. + (C_SELFTEST_DEPS): New, from deps of s-selftest. + (CPP_SELFTEST_DEPS): New. + (selftest): Add dependency on s-selftest-c++. + (s-selftest): Rename to... + (s-selftest-c): ...this, moving deps to SELFTEST_DEPS + and C_SELFTEST_DEPS, and using C_SELFTEST_FLAGS rather + than SELFTEST_FLAGS. + (selftest-gdb): Rename to... + (selftest-c-gdb): ...this, using C_SELFTEST_DEPS and + C_SELFTEST_FLAGS. + (selftest-gdb): Reintroduce as an alias for selftest-c-gdb. + (selftest-valgrind): Rename to... + (selftest-c-valgrind): ...this, using C_SELFTEST_DEPS and + C_SELFTEST_FLAGS. + (selftest-valgrind): Reintroduce as an alias for + selftest-c-valgrind. + (s-selftest-c++): New. + (selftest-c++-gdb): New. + (selftest-c++-valgrind): New. + 2017-07-06 Olivier Hainque <hainque@adacore.com> * gcc.c (process_command): When deciding if undefined variables diff --git a/gcc/Makefile.in b/gcc/Makefile.in index a3beaad..2189bc0 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1904,30 +1904,62 @@ rest.cross: specs # "nul.s" on Windows. Because on Windows "nul" is a reserved file name. # Specify the path to gcc/testsuite/selftests within the srcdir # as an argument to -fself-test. -SELFTEST_FLAGS = -nostdinc -x c /dev/null -S -o /dev/null \ +SELFTEST_FLAGS = -nostdinc /dev/null -S -o /dev/null \ -fself-test=$(srcdir)/testsuite/selftests -# Run the selftests during the build once we have a driver and a cc1, +C_SELFTEST_FLAGS = -xc $(SELFTEST_FLAGS) +CPP_SELFTEST_FLAGS = -xc++ $(SELFTEST_FLAGS) + +SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests + +C_SELFTEST_DEPS = cc1$(exeext) $(SELFTEST_DEPS) +CPP_SELFTEST_DEPS = cc1plus$(exeext) $(SELFTEST_DEPS) + +# Run the selftests during the build once we have a driver and the frontend, # so that self-test failures are caught as early as possible. -# Use "s-selftest" to ensure that we only run the selftests if the -# driver, cc1, or selftest data change. +# Use "s-selftest-FE" to ensure that we only run the selftests if the +# driver, frontend, or selftest data change. .PHONY: selftest -selftest: s-selftest -s-selftest: $(GCC_PASSES) cc1$(exeext) stmp-int-hdrs \ - $(srcdir)/testsuite/selftests - $(GCC_FOR_TARGET) $(SELFTEST_FLAGS) +selftest: s-selftest-c s-selftest-c++ + +# C selftests +s-selftest-c: $(C_SELFTEST_DEPS) + $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS) $(STAMP) $@ -# Convenience method for running selftests under gdb: -.PHONY: selftest-gdb -selftest-gdb: $(GCC_PASSES) cc1$(exeext) stmp-int-hdrs - $(GCC_FOR_TARGET) $(SELFTEST_FLAGS) \ +# Convenience methods for running C selftests under gdb: +.PHONY: selftest-c-gdb +selftest-c-gdb: $(C_SELFTEST_DEPS) + $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS) \ -wrapper gdb,--args -# Convenience method for running selftests under valgrind: +.PHONY: selftest-gdb +selftest-gdb: selftest-c-gdb + +# Convenience methods for running C selftests under valgrind: +.PHONY: selftest-c-valgrind +selftest-c-valgrind: $(C_SELFTEST_DEPS) + $(GCC_FOR_TARGET) $(C_SELFTEST_FLAGS) \ + -wrapper valgrind,--leak-check=full + .PHONY: selftest-valgrind -selftest-valgrind: $(GCC_PASSES) cc1$(exeext) stmp-int-hdrs - $(GCC_FOR_TARGET) $(SELFTEST_FLAGS) \ +selftest-valgrind: selftest-c-valgrind + +# C++ selftests +s-selftest-c++: $(CPP_SELFTEST_DEPS) + $(GCC_FOR_TARGET) $(CPP_SELFTEST_FLAGS) + $(STAMP) $@ + +# Convenience method for running C++ selftests under gdb: +.PHONY: selftest-c++-gdb +selftest-c++-gdb: $(CPP_SELFTEST_DEPS) + $(GCC_FOR_TARGET) $(CPP_SELFTEST_FLAGS) \ + -wrapper gdb,--args + +# Convenience method for running C++ selftests under valgrind: +.PHONY: selftest-c++-valgrind +selftest-c++-valgrind: $(CPP_SELFTEST_DEPS) + $(GCC_FOR_TARGET) $(CPP_SELFTEST_FLAGS) \ -wrapper valgrind,--leak-check=full # Recompile all the language-independent object files. diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index a54beee..7ddf192 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2017-07-06 David Malcolm <dmalcolm@redhat.com> + + * c-common.c (selftest::c_family_tests): New. + * c-common.h (selftest::run_c_tests): Move decl to c/c-lang.h. + (selftest::c_family_tests): New decl. + 2017-07-04 Marek Polacek <polacek@redhat.com> PR c/81231 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 1b6ac8c..b4217f3 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -8003,4 +8003,20 @@ c_flt_eval_method (bool maybe_c11_only_p) return c_ts18661_flt_eval_method (); } +#if CHECKING_P + +namespace selftest { + +/* Run all of the tests within c-family. */ + +void +c_family_tests (void) +{ + c_format_c_tests (); +} + +} // namespace selftest + +#endif /* #if CHECKING_P */ + #include "gt-c-family-c-common.h" diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index f3d051a..7e7efb2 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -1558,8 +1558,12 @@ extern void add_no_sanitize_value (tree node, unsigned int flags); #if CHECKING_P namespace selftest { + /* Declarations for specific families of tests within c-family, + by source file, in alphabetical order. */ extern void c_format_c_tests (void); - extern void run_c_tests (void); + + /* The entrypoint for running all of the above tests. */ + extern void c_family_tests (void); } // namespace selftest #endif /* #if CHECKING_P */ diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index fabddc1..aba0868 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2017-07-06 David Malcolm <dmalcolm@redhat.com> + + * c-lang.c (selftest::run_c_tests): Move body to c_family_tests, + and call that instead. + * c-tree.h (selftest::run_c_tests): New decl. + 2017-06-26 Marek Polacek <polacek@redhat.com> PR c/80116 diff --git a/gcc/c/c-lang.c b/gcc/c/c-lang.c index 510b7e7..e05741d 100644 --- a/gcc/c/c-lang.c +++ b/gcc/c/c-lang.c @@ -58,7 +58,10 @@ namespace selftest { void run_c_tests (void) { - c_format_c_tests (); + /* Run selftests shared within the C family. */ + c_family_tests (); + + /* Additional C-specific tests. */ } } // namespace selftest diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h index ce25fae..a8197eb 100644 --- a/gcc/c/c-tree.h +++ b/gcc/c/c-tree.h @@ -764,4 +764,11 @@ extern tree decl_constant_value_for_optimization (tree); extern vec<tree> incomplete_record_decls; +#if CHECKING_P +namespace selftest { + extern void run_c_tests (void); +} // namespace selftest +#endif /* #if CHECKING_P */ + + #endif /* ! GCC_C_TREE_H */ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4dffee4..2617fff 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2017-07-06 David Malcolm <dmalcolm@redhat.com> + + * cp-lang.c (LANG_HOOKS_RUN_LANG_SELFTESTS): Define as + selftest::run_cp_tests. + (selftest::run_cp_tests): New function. + * cp-tree.h (selftest::run_cp_tests): New decl. + 2017-07-04 Jakub Jelinek <jakub@redhat.com> * parser.c (cp_parser_decomposition_declaration): Replace diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index defcbdc..805319a 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -79,6 +79,11 @@ static tree cxx_enum_underlying_base_type (const_tree); #undef LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE #define LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE cxx_enum_underlying_base_type +#if CHECKING_P +#undef LANG_HOOKS_RUN_LANG_SELFTESTS +#define LANG_HOOKS_RUN_LANG_SELFTESTS selftest::run_cp_tests +#endif /* #if CHECKING_P */ + /* Each front end provides its own lang hook initializer. */ struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; @@ -229,6 +234,25 @@ tree cxx_enum_underlying_base_type (const_tree type) return underlying_type; } +#if CHECKING_P + +namespace selftest { + +/* Implementation of LANG_HOOKS_RUN_LANG_SELFTESTS for the C++ frontend. */ + +void +run_cp_tests (void) +{ + /* Run selftests shared within the C family. */ + c_family_tests (); + + /* Additional C++-specific tests. */ +} + +} // namespace selftest + +#endif /* #if CHECKING_P */ + #include "gt-cp-cp-lang.h" #include "gtype-cp.h" diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index abaef68..50f4235e 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -7364,6 +7364,12 @@ extern tree cp_ubsan_maybe_instrument_downcast (location_t, tree, tree, tree); extern tree cp_ubsan_maybe_instrument_cast_to_vbase (location_t, tree, tree); extern void cp_ubsan_maybe_initialize_vtbl_ptrs (tree); +#if CHECKING_P +namespace selftest { + extern void run_cp_tests (void); +} // namespace selftest +#endif /* #if CHECKING_P */ + /* Inline bodies. */ inline tree |