This is the mail archive of the gcc@gcc.gnu.org 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]

Write test case for libstdc++ with C source


Hallo,

I would like to add a test case to the libstdc++ tests to test for C/C++ compatibility of the atomic operations. A straight forward approach like in the attached patch doesn't work since the "dg-additional-sources" is not supported:

ERROR: 29_atomics/atomic/pr60932-c++.cc: unknown dg option: dg-additional-sources 3 pr60932-c.c for " dg-additional-sources 3 "pr60932-c.c" " UNRESOLVED: 29_atomics/atomic/pr60932-c++.cc: unknown dg option: dg-additional-sources 3 pr60932-c.c for " dg-additional-sources 3 "pr60932-c.c" "

Since I am not an expert in the GCC test suite scripts, is it possible to add such a test case at all with a moderate amount of work?

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

>From 34a2fd03ffdd06c214c62a3490ab720c6c65fa9e Mon Sep 17 00:00:00 2001
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date: Sun, 27 Apr 2014 14:08:19 +0200
Subject: [PATCH] PR60932 test case

---
 libstdc++-v3/testsuite/29_atomics/atomic/pr60932-c++.cc | 10 ++++++++++
 libstdc++-v3/testsuite/29_atomics/atomic/pr60932-c.c    |  4 ++++
 libstdc++-v3/testsuite/29_atomics/atomic/pr60932.h      |  6 ++++++
 3 files changed, 20 insertions(+)
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic/pr60932-c++.cc
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic/pr60932-c.c
 create mode 100644 libstdc++-v3/testsuite/29_atomics/atomic/pr60932.h

diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/pr60932-c++.cc b/libstdc++-v3/testsuite/29_atomics/atomic/pr60932-c++.cc
new file mode 100644
index 0000000..a26f96a
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/pr60932-c++.cc
@@ -0,0 +1,10 @@
+// { dg-do link }
+// { dg-options "-std=c++11" }
+// { dg-additional-sources "pr60932-c.c" }
+
+#include "pr60932.h"
+
+int main()
+{
+	return 0;
+}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/pr60932-c.c b/libstdc++-v3/testsuite/29_atomics/atomic/pr60932-c.c
new file mode 100644
index 0000000..9e69a62
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/pr60932-c.c
@@ -0,0 +1,4 @@
+// { dg-do compile }
+// { dg-options "-x c -std=c11" }
+
+#include "pr60932.h"
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/pr60932.h b/libstdc++-v3/testsuite/29_atomics/atomic/pr60932.h
new file mode 100644
index 0000000..c92cbd8
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/pr60932.h
@@ -0,0 +1,6 @@
+#ifdef __cplusplus
+#include <atomic>
+using namespace std;
+#else
+#include <stdatomic.h>
+#endif
-- 
1.8.1.4


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