summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-01-09 17:32:53 +0100
committerClifford Wolf <clifford@clifford.at>2015-01-09 17:32:53 +0100
commit95f1eb9b87064719c17d45f24775c3e97497b6df (patch)
treef97d1cfd5483cda79fe10b1c71bcf21d8ae290d4
parentbd3dd8052665f4f8a27a90dc745c1fca1b6da98f (diff)
Only enable code coverage counters on linux
-rw-r--r--kernel/driver.cc2
-rw-r--r--kernel/log.cc2
-rw-r--r--kernel/log.h4
-rw-r--r--passes/cmds/cover.cc4
4 files changed, 6 insertions, 6 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc
index 1698e216..c7f233c5 100644
--- a/kernel/driver.cc
+++ b/kernel/driver.cc
@@ -406,7 +406,7 @@ int main(int argc, char **argv)
}
}
-#ifdef YOSYS_ENABLE_COVER
+#if defined(YOSYS_ENABLE_COVER) && defined(__linux__)
if (getenv("YOSYS_COVER_DIR") || getenv("YOSYS_COVER_FILE"))
{
string filename;
diff --git a/kernel/log.cc b/kernel/log.cc
index 70bff8f5..401dbeeb 100644
--- a/kernel/log.cc
+++ b/kernel/log.cc
@@ -402,7 +402,7 @@ void log_cell(RTLIL::Cell *cell, std::string indent)
// ---------------------------------------------------
// This is the magic behind the code coverage counters
// ---------------------------------------------------
-#ifdef YOSYS_ENABLE_COVER
+#if defined(YOSYS_ENABLE_COVER) && defined(__linux__)
dict<std::string, std::pair<std::string, int>> extra_coverage_data;
diff --git a/kernel/log.h b/kernel/log.h
index fa02d239..e61d19b6 100644
--- a/kernel/log.h
+++ b/kernel/log.h
@@ -92,10 +92,10 @@ static inline void log_assert_worker(bool cond, const char *expr, const char *fi
// This is the magic behind the code coverage counters
// ---------------------------------------------------
-#ifdef YOSYS_ENABLE_COVER
+#if defined(YOSYS_ENABLE_COVER) && defined(__linux__)
#define cover(_id) do { \
- static CoverData __d YS_ATTRIBUTE(section("yosys_cover_list"), aligned(1), used) = { __FILE__, __FUNCTION__, _id, __LINE__, 0 }; \
+ static CoverData __d __attribute__((section("yosys_cover_list"), aligned(1), used)) = { __FILE__, __FUNCTION__, _id, __LINE__, 0 }; \
__d.counter++; \
} while (0)
diff --git a/passes/cmds/cover.cc b/passes/cmds/cover.cc
index 6a70d1de..5644066a 100644
--- a/passes/cmds/cover.cc
+++ b/passes/cmds/cover.cc
@@ -80,7 +80,7 @@ struct CoverPass : public Pass {
log(" printf \"%%-60s %%10d %%s\\n\", p[i], c[i], i; }' {files} | sort -k3\n");
log("\n");
log("\n");
- log("Coverage counters are only available in debug builds of Yosys for Linux.\n");
+ log("Coverage counters are only available in Yosys for Linux.\n");
log("\n");
}
virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
@@ -128,7 +128,7 @@ struct CoverPass : public Pass {
log("\n");
}
-#ifdef YOSYS_ENABLE_COVER
+#if defined(YOSYS_ENABLE_COVER) && defined(__linux__)
for (auto &it : get_coverage_data()) {
if (!patterns.empty()) {
for (auto &p : patterns)