diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/register.cc | 14 | ||||
-rw-r--r-- | kernel/sigtools.h | 11 | ||||
-rw-r--r-- | kernel/yosys.cc | 2 |
3 files changed, 22 insertions, 5 deletions
diff --git a/kernel/register.cc b/kernel/register.cc index 1fd1bad1d..8131fa279 100644 --- a/kernel/register.cc +++ b/kernel/register.cc @@ -48,7 +48,7 @@ using zlib to write gzip-compressed data every time the stream is flushed. */ class gzip_ostream : public std::ostream { public: - gzip_ostream() + gzip_ostream() : std::ostream(nullptr) { rdbuf(&outbuf); } @@ -71,7 +71,7 @@ private: str(""); return 0; } - ~gzip_streambuf() + virtual ~gzip_streambuf() { sync(); gzclose(gzf); @@ -498,7 +498,15 @@ void Frontend::extra_args(std::istream *&f, std::string &filename, std::vector<s if (f != NULL) { // Check for gzip magic unsigned char magic[3]; - int n = readsome(*ff, reinterpret_cast<char*>(magic), 3); + int n = 0; + while (n < 3) + { + int c = ff->get(); + if (c != EOF) { + magic[n] = (unsigned char) c; + } + n++; + } if (n == 3 && magic[0] == 0x1f && magic[1] == 0x8b) { #ifdef YOSYS_ENABLE_ZLIB log("Found gzip magic in file `%s', decompressing using zlib.\n", filename.c_str()); diff --git a/kernel/sigtools.h b/kernel/sigtools.h index 4e97bb775..2517d6de3 100644 --- a/kernel/sigtools.h +++ b/kernel/sigtools.h @@ -135,9 +135,11 @@ struct SigPool } }; -template <typename T, class Compare = std::less<T>> +template <typename T, class Compare = void> struct SigSet { + static_assert(!std::is_same<Compare,void>::value, "Default value for `Compare' class not found for SigSet<T>. Please specify."); + struct bitDef_t : public std::pair<RTLIL::Wire*, int> { bitDef_t() : std::pair<RTLIL::Wire*, int>(NULL, 0) { } bitDef_t(const RTLIL::SigBit &bit) : std::pair<RTLIL::Wire*, int>(bit.wire, bit.offset) { } @@ -220,6 +222,13 @@ struct SigSet } }; +template<typename T> +class SigSet<T, typename std::enable_if<!std::is_pointer<T>::value>::type> : public SigSet<T, std::less<T>> {}; +template<typename T> +using sort_by_name_id_guard = typename std::enable_if<std::is_same<T,RTLIL::Cell*>::value>::type; +template<typename T> +class SigSet<T, sort_by_name_id_guard<T>> : public SigSet<T, RTLIL::sort_by_name_id<typename std::remove_pointer<T>::type>> {}; + struct SigMap { mfp<SigBit> database; diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 747f2d739..5018a4888 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -129,7 +129,7 @@ void yosys_banner() log(" | |\n"); log(" | yosys -- Yosys Open SYnthesis Suite |\n"); log(" | |\n"); - log(" | Copyright (C) 2012 - 2018 Clifford Wolf <clifford@clifford.at> |\n"); + log(" | Copyright (C) 2012 - 2019 Clifford Wolf <clifford@clifford.at> |\n"); log(" | |\n"); log(" | Permission to use, copy, modify, and/or distribute this software for any |\n"); log(" | purpose with or without fee is hereby granted, provided that the above |\n"); |