aboutsummaryrefslogtreecommitdiffstats
path: root/common/nextpnr.h
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-07-03 08:52:19 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-07-03 08:53:44 +0200
commit1cf82930191d6498fc14e1854472f0d955a4c4ea (patch)
tree58edfdc7fc506ab46591beac8e74ba9dd8c5b08f /common/nextpnr.h
parentfe1ad5b086c46b82aa72cb0f9625ebdf941e50f9 (diff)
downloadnextpnr-1cf82930191d6498fc14e1854472f0d955a4c4ea.tar.gz
nextpnr-1cf82930191d6498fc14e1854472f0d955a4c4ea.tar.bz2
nextpnr-1cf82930191d6498fc14e1854472f0d955a4c4ea.zip
Fixed macros and includes for MSVC
Diffstat (limited to 'common/nextpnr.h')
-rw-r--r--common/nextpnr.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h
index 094d6241..96511acf 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -41,6 +41,23 @@
#define USING_NEXTPNR_NAMESPACE
#endif
+#if defined(__GNUC__) || defined(__clang__)
+# define NPNR_ATTRIBUTE(...) __attribute__((__VA_ARGS__))
+# define NPNR_NORETURN
+# define NPNR_DEPRECATED __attribute__((deprecated))
+# define NPNR_PACKED_STRUCT( ... ) __VA_ARGS__ __attribute__((packed))
+#elif defined(_MSC_VER)
+# define NPNR_ATTRIBUTE(...)
+# define NPNR_NORETURN __declspec(noreturn)
+# define NPNR_DEPRECATED __declspec(deprecated)
+# define NPNR_PACKED_STRUCT( ... ) __pragma(pack(push, 1)) __VA_ARGS__ __pragma(pack(pop))
+#else
+# define NPNR_ATTRIBUTE(...)
+# define NPNR_NORETURN
+# define NPNR_DEPRECATED
+# define NPNR_PACKED_STRUCT( ... ) __VA_ARGS__
+#endif
+
NEXTPNR_NAMESPACE_BEGIN
struct BaseCtx;
@@ -76,7 +93,7 @@ struct IdString
static std::unordered_set<BaseCtx *> global_ctx;
- const std::string &global_str() const __attribute__((deprecated))
+ NPNR_DEPRECATED const std::string &global_str() const
{
assert(global_ctx.size() == 1);
return str(*global_ctx.begin());