diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-10-29 14:49:26 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-29 14:49:26 +0800 |
| commit | f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch) | |
| tree | ea1d61342cd29368e19135000ec2948813096205 /tests/cpp-compiler | |
| parent | a729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff) | |
format
* format
* Minor test fixes
* enable checking cpp format in ci
Diffstat (limited to 'tests/cpp-compiler')
| -rw-r--r-- | tests/cpp-compiler/c-compile-error.c | 8 | ||||
| -rw-r--r-- | tests/cpp-compiler/c-compile-link-error.c | 6 | ||||
| -rw-r--r-- | tests/cpp-compiler/c-compile-pass-through-shared-library.c | 25 | ||||
| -rw-r--r-- | tests/cpp-compiler/c-compile-shared-library-link-error.c | 27 | ||||
| -rw-r--r-- | tests/cpp-compiler/c-compile-shared-library.c | 27 | ||||
| -rw-r--r-- | tests/cpp-compiler/c-compile.c | 6 | ||||
| -rw-r--r-- | tests/cpp-compiler/cpp-compile-shared-library.cpp | 18 | ||||
| -rw-r--r-- | tests/cpp-compiler/cpp-compile.cpp | 4 | ||||
| -rw-r--r-- | tests/cpp-compiler/simple-c-compile.c | 6 |
9 files changed, 61 insertions, 66 deletions
diff --git a/tests/cpp-compiler/c-compile-error.c b/tests/cpp-compiler/c-compile-error.c index ae36dd9c5..c81bfd315 100644 --- a/tests/cpp-compiler/c-compile-error.c +++ b/tests/cpp-compiler/c-compile-error.c @@ -1,12 +1,12 @@ -//TEST(smoke):CPP_COMPILER_EXECUTE: +// TEST(smoke):CPP_COMPILER_EXECUTE: -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> int main(int argc, char** argv) { int a = b + c; - + printf("Hello World!\n"); - return 0; + return 0; } diff --git a/tests/cpp-compiler/c-compile-link-error.c b/tests/cpp-compiler/c-compile-link-error.c index 08b93a38b..406f9cefb 100644 --- a/tests/cpp-compiler/c-compile-link-error.c +++ b/tests/cpp-compiler/c-compile-link-error.c @@ -1,12 +1,12 @@ -//TEST(smoke):CPP_COMPILER_EXECUTE: +// TEST(smoke):CPP_COMPILER_EXECUTE: -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> extern int thing; int main(int argc, char** argv) { printf("Hello World %d!\n", thing); - return 0; + return 0; } diff --git a/tests/cpp-compiler/c-compile-pass-through-shared-library.c b/tests/cpp-compiler/c-compile-pass-through-shared-library.c index 143817325..2dca175ee 100644 --- a/tests/cpp-compiler/c-compile-pass-through-shared-library.c +++ b/tests/cpp-compiler/c-compile-pass-through-shared-library.c @@ -1,24 +1,23 @@ -//TEST(smoke):CPP_COMPILER_COMPILE: -pass-through c -entry test -target callable +// TEST(smoke):CPP_COMPILER_COMPILE: -pass-through c -entry test -target callable -#include <stdlib.h> #include <stdio.h> -#include <string.h> - +#include <stdlib.h> +#include <string.h> + #if defined(_MSC_VER) -# define DLL_EXPORT __declspec(dllexport) -#else -# define DLL_EXPORT __attribute__((__visibility__("default"))) -#endif +#define DLL_EXPORT __declspec(dllexport) +#else +#define DLL_EXPORT __attribute__((__visibility__("default"))) +#endif -#ifdef __cplusplus +#ifdef __cplusplus #define EXTERN_C extern "C" #else -#define EXTERN_C -#endif - +#define EXTERN_C +#endif + EXTERN_C DLL_EXPORT int test(int intValue, const char* textValue, char* outTextValue) { strcpy(outTextValue, textValue); return intValue; } - diff --git a/tests/cpp-compiler/c-compile-shared-library-link-error.c b/tests/cpp-compiler/c-compile-shared-library-link-error.c index 1339a3b52..6f48fb435 100644 --- a/tests/cpp-compiler/c-compile-shared-library-link-error.c +++ b/tests/cpp-compiler/c-compile-shared-library-link-error.c @@ -1,27 +1,26 @@ -//TEST(smoke):CPP_COMPILER_SHARED_LIBRARY: +// TEST(smoke):CPP_COMPILER_SHARED_LIBRARY: -#include <stdlib.h> #include <stdio.h> -#include <string.h> - +#include <stdlib.h> +#include <string.h> + #if defined(_MSC_VER) -# define DLL_EXPORT __declspec(dllexport) -#else -//# define DLL_EXPORT -# define DLL_EXPORT __attribute__ ((dllexport)) __attribute__((__visibility__("default"))) -#endif +#define DLL_EXPORT __declspec(dllexport) +#else +// # define DLL_EXPORT +#define DLL_EXPORT __attribute__((dllexport)) __attribute__((__visibility__("default"))) +#endif -#ifdef __cplusplus +#ifdef __cplusplus #define EXTERN_C extern "C" #else -#define EXTERN_C -#endif +#define EXTERN_C +#endif extern int symbolNotFound; - + EXTERN_C DLL_EXPORT int test(int intValue, const char* textValue, char* outTextValue) { strcpy(outTextValue, textValue); return intValue + symbolNotFound; } - diff --git a/tests/cpp-compiler/c-compile-shared-library.c b/tests/cpp-compiler/c-compile-shared-library.c index 5ae61d65b..5af13b4c9 100644 --- a/tests/cpp-compiler/c-compile-shared-library.c +++ b/tests/cpp-compiler/c-compile-shared-library.c @@ -1,25 +1,24 @@ -//TEST(smoke,shared-library):CPP_COMPILER_SHARED_LIBRARY: +// TEST(smoke,shared-library):CPP_COMPILER_SHARED_LIBRARY: -#include <stdlib.h> #include <stdio.h> -#include <string.h> - +#include <stdlib.h> +#include <string.h> + #if defined(_MSC_VER) -# define DLL_EXPORT __declspec(dllexport) -#else -//# define DLL_EXPORT -# define DLL_EXPORT __attribute__ ((dllexport)) __attribute__((__visibility__("default"))) -#endif +#define DLL_EXPORT __declspec(dllexport) +#else +// # define DLL_EXPORT +#define DLL_EXPORT __attribute__((dllexport)) __attribute__((__visibility__("default"))) +#endif -#ifdef __cplusplus +#ifdef __cplusplus #define EXTERN_C extern "C" #else -#define EXTERN_C -#endif - +#define EXTERN_C +#endif + EXTERN_C DLL_EXPORT int test(int intValue, const char* textValue, char* outTextValue) { strcpy(outTextValue, textValue); return intValue; } - diff --git a/tests/cpp-compiler/c-compile.c b/tests/cpp-compiler/c-compile.c index 75fdbdaa4..f8cd3d41f 100644 --- a/tests/cpp-compiler/c-compile.c +++ b/tests/cpp-compiler/c-compile.c @@ -1,10 +1,10 @@ -//TEST(smoke):CPP_COMPILER_EXECUTE: +// TEST(smoke):CPP_COMPILER_EXECUTE: -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> int main(int argc, char** argv) { printf("Hello World!\n"); - return 0; + return 0; } diff --git a/tests/cpp-compiler/cpp-compile-shared-library.cpp b/tests/cpp-compiler/cpp-compile-shared-library.cpp index c802a57cd..a69e22899 100644 --- a/tests/cpp-compiler/cpp-compile-shared-library.cpp +++ b/tests/cpp-compiler/cpp-compile-shared-library.cpp @@ -1,21 +1,19 @@ -//TEST(smoke):CPP_COMPILER_SHARED_LIBRARY: +// TEST(smoke):CPP_COMPILER_SHARED_LIBRARY: -#include <stdlib.h> +#include <iostream> #include <stdio.h> +#include <stdlib.h> #include <string.h> - -#include <iostream> using namespace std; - + #if defined(_MSC_VER) -# define DLL_EXPORT __declspec(dllexport) +#define DLL_EXPORT __declspec(dllexport) #else -# define DLL_EXPORT __attribute__((__visibility__("default"))) -#endif - +#define DLL_EXPORT __attribute__((__visibility__("default"))) +#endif + extern "C" DLL_EXPORT int test(int intValue, const char* textValue, char* outTextValue) { strcpy(outTextValue, textValue); return intValue; } - diff --git a/tests/cpp-compiler/cpp-compile.cpp b/tests/cpp-compiler/cpp-compile.cpp index c3141a876..543b7e0be 100644 --- a/tests/cpp-compiler/cpp-compile.cpp +++ b/tests/cpp-compiler/cpp-compile.cpp @@ -1,9 +1,9 @@ -//TEST(smoke):CPP_COMPILER_EXECUTE: +// TEST(smoke):CPP_COMPILER_EXECUTE: #include <iostream> using namespace std; int main(int argc, char** argv) { cout << "Hello World!" << endl; - return 0; + return 0; } diff --git a/tests/cpp-compiler/simple-c-compile.c b/tests/cpp-compiler/simple-c-compile.c index 32b5561f1..5bdc0146e 100644 --- a/tests/cpp-compiler/simple-c-compile.c +++ b/tests/cpp-compiler/simple-c-compile.c @@ -1,10 +1,10 @@ -//TEST:SIMPLE: -entry main -target exe -pass-through c +// TEST:SIMPLE: -entry main -target exe -pass-through c -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> int main(int argc, char** argv) { printf("Hello World!\n"); - return 0; + return 0; } |
