tests: compile all C tests using C++ too

Improve test coverage by compiling all of our C tests using C++.

Bug: 1292951
Change-Id: I32e4b85081d2bbd9a9a800dca89a915ff7a9d722
Reviewed-on: https://chromium-review.googlesource.com/c/linux-syscall-support/+/3846315
Reviewed-by: Peter Kasting <pkasting@chromium.org>
diff --git a/tests/Makefile b/tests/Makefile
index b54e0f5..554813d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -55,6 +55,10 @@
 %_test: %.c test_skel.h $(top_srcdir)/linux_syscall_support.h
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $<
 
+# Force building C as C++ code to improve compile-time coverage.
+%_cc_test: %.c test_skel.h $(top_srcdir)/linux_syscall_support.h
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $<
+
 %_test: %.cc test_skel.h $(top_srcdir)/linux_syscall_support.h
 	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $<
 
@@ -72,10 +76,10 @@
 		exit 1; \
 	fi
 
-ALL_TEST_TARGETS = $(TESTS:=_test)
+ALL_TEST_TARGETS = $(TESTS:=_test) $(TESTS:=_cc_test)
 compile_tests: $(ALL_TEST_TARGETS)
 
-ALL_RUN_TARGETS = $(TESTS:=_run)
+ALL_RUN_TARGETS = $(TESTS:=_run) $(TESTS:=_cc_run)
 check: $(ALL_RUN_TARGETS)
 
 # The "tempfile" targets are the names we use with temp files.