+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
# "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.
+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
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"
#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 */
+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
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
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 */
+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
#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;
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"
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