summaryrefslogtreecommitdiffstats
path: root/prelude/slang-cpp-prelude.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-08-20 09:43:59 -0400
committerGitHub <noreply@github.com>2019-08-20 09:43:59 -0400
commit7258ef4ddebd021208a019f6ee73edcda57a88f7 (patch)
tree30cccf48c8f03e59e48a2d265e05494238fe758d /prelude/slang-cpp-prelude.h
parent3e78e4654cdf9556869325f2ed2da517f252d879 (diff)
User defined downstream compiler prelude (#1028)
* Added setDownstreamCompilerPrelude Renamed setPassThroughPath to setDownstreamCompilerPath. Fixed tests. Added prelude directory & code to TestToolUtil to setup default preludes for testing/command line apis. * Fix merge problem * Remove hacks to make prelude work by adding a search path as no longer needed with 'user prelude'. * Split up prelude into scalar intrinsics, and types. Use slang.h for main header. slang-cpp-prelude.h can now just include what it needs (relative to prelude directory) and define the few remaining things/work arounds. * Fix typo.
Diffstat (limited to 'prelude/slang-cpp-prelude.h')
-rw-r--r--prelude/slang-cpp-prelude.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/prelude/slang-cpp-prelude.h b/prelude/slang-cpp-prelude.h
new file mode 100644
index 000000000..15d200d2f
--- /dev/null
+++ b/prelude/slang-cpp-prelude.h
@@ -0,0 +1,33 @@
+#ifndef SLANG_CPP_PRELUDE_H
+#define SLANG_CPP_PRELUDE_H
+
+#include "../slang.h"
+
+#include <math.h>
+#include <assert.h>
+#include <stdlib.h>
+
+#if defined(_MSC_VER)
+# define SLANG_PRELUDE_SHARED_LIB_EXPORT __declspec(dllexport)
+#else
+# define SLANG_PRELUDE_SHARED_LIB_EXPORT __attribute__((__visibility__("default")))
+//# define SLANG_PRELUDE_SHARED_LIB_EXPORT __attribute__ ((dllexport)) __attribute__((__visibility__("default")))
+#endif
+
+#ifdef __cplusplus
+# define SLANG_PRELUDE_EXTERN_C extern "C"
+#else
+# define SLANG_PRELUDE_EXTERN_C
+#endif
+
+#define SLANG_PRELUDE_EXPORT SLANG_PRELUDE_EXTERN_C SLANG_PRELUDE_SHARED_LIB_EXPORT
+
+#include "slang-cpp-types.h"
+#include "slang-cpp-scalar-intrinsics.h"
+
+// TODO(JS): Hack! Output C++ code from slang can copy uninitialized variables.
+#if SLANG_VC
+# pragma warning(disable : 4700)
+#endif
+
+#endif