summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-08-14 12:57:33 -0400
committerTim Foley <tfoleyNV@users.noreply.github.com>2019-08-14 09:57:33 -0700
commitdc493d492d4d9c090dab410a0cb80eca490c32aa (patch)
treef0de85ae64d53afd9b9144df23d2450436565d20 /tests
parentea200663ffe33d7b4c739c0d84e9c21a3ae2ffa6 (diff)
Small improvements around C/C++ testing (#1017)
* * Simplify some of test code around CPPCompiler * Test using 'callable' with pass-through * Small cpu doc improvements * Improvements to Clang output parsing. * Remove temporary file (base filename) . * Improve handling of external errors - handle severity. * On error dumping out to 'actual' file for runCPPCompilerCompile. * Small fixes. Set the source language type correctly for pass thru. * Remove warning for test for clang backend c
Diffstat (limited to 'tests')
-rw-r--r--tests/cpp-compiler/c-compile-pass-through-shared-library.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/cpp-compiler/c-compile-pass-through-shared-library.c b/tests/cpp-compiler/c-compile-pass-through-shared-library.c
new file mode 100644
index 000000000..9f33bc430
--- /dev/null
+++ b/tests/cpp-compiler/c-compile-pass-through-shared-library.c
@@ -0,0 +1,24 @@
+//TEST(smoke,shared-library):CPP_COMPILER_COMPILE: -pass-through c -entry test -target callable
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#if defined(_MSC_VER)
+# define DLL_EXPORT __declspec(dllexport)
+#else
+# define DLL_EXPORT __attribute__((__visibility__("default")))
+#endif
+
+#ifdef __cplusplus
+#define EXTERN_C extern "C"
+#else
+#define EXTERN_C
+#endif
+
+EXTERN_C DLL_EXPORT int test(int intValue, const char* textValue, char* outTextValue)
+{
+ strcpy(outTextValue, textValue);
+ return intValue;
+}
+