From dc493d492d4d9c090dab410a0cb80eca490c32aa Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 14 Aug 2019 12:57:33 -0400 Subject: 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 --- .../c-compile-pass-through-shared-library.c | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/cpp-compiler/c-compile-pass-through-shared-library.c (limited to 'tests') 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 +#include +#include + +#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; +} + -- cgit v1.2.3