diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-11-09 10:55:04 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-11-09 10:55:04 +0100 |
commit | a112b1093444429a1a55a90b73c58c8b7ffee1bc (patch) | |
tree | c4591d1557b7d28d86da5ec37163de01b217fb54 /kernel | |
parent | fe829bdbdc436f425e082ab1cc8c3d276f168945 (diff) | |
download | yosys-a112b1093444429a1a55a90b73c58c8b7ffee1bc.tar.gz yosys-a112b1093444429a1a55a90b73c58c8b7ffee1bc.tar.bz2 yosys-a112b1093444429a1a55a90b73c58c8b7ffee1bc.zip |
Introducing YS_OVERRIDE, YS_FINAL, YS_ATTRIBUTE, YS_NORETURN
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/log.h | 16 | ||||
-rw-r--r-- | kernel/modtools.h | 2 | ||||
-rw-r--r-- | kernel/register.h | 4 | ||||
-rw-r--r-- | kernel/yosys.h | 22 |
4 files changed, 24 insertions, 20 deletions
diff --git a/kernel/log.h b/kernel/log.h index b003aba22..b69e2ee2d 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -52,13 +52,13 @@ extern int log_verbose_level; void logv(const char *format, va_list ap); void logv_header(const char *format, va_list ap); void logv_warning(const char *format, va_list ap); -_NORETURN_ void logv_error(const char *format, va_list ap) __attribute__((noreturn)); +YS_NORETURN void logv_error(const char *format, va_list ap) YS_ATTRIBUTE(noreturn); -void log(const char *format, ...) __attribute__((format(printf, 1, 2))); -void log_header(const char *format, ...) __attribute__((format(printf, 1, 2))); -void log_warning(const char *format, ...) __attribute__((format(printf, 1, 2))); -_NORETURN_ void log_error(const char *format, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn)); -_NORETURN_ void log_cmd_error(const char *format, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn)); +void log(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2)); +void log_header(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2)); +void log_warning(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2)); +YS_NORETURN void log_error(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2), noreturn); +YS_NORETURN void log_cmd_error(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2), noreturn); void log_spacer(); void log_push(); @@ -92,14 +92,14 @@ static inline void log_assert_worker(bool cond, const char *expr, const char *fi #ifdef YOSYS_ENABLE_COVER #define cover(_id) do { \ - static CoverData __d __attribute__((section("yosys_cover_list"), aligned(1), used)) = { __FILE__, __FUNCTION__, _id, __LINE__, 0 }; \ + static CoverData __d YS_ATTRIBUTE(section("yosys_cover_list"), aligned(1), used) = { __FILE__, __FUNCTION__, _id, __LINE__, 0 }; \ __d.counter++; \ } while (0) struct CoverData { const char *file, *func, *id; int line, counter; -} __attribute__ ((packed)); +} YS_ATTRIBUTE(packed); // this two symbols are created by the linker for the "yosys_cover_list" ELF section extern "C" struct CoverData __start_yosys_cover_list[]; diff --git a/kernel/modtools.h b/kernel/modtools.h index 1b6968d74..e3020ae3c 100644 --- a/kernel/modtools.h +++ b/kernel/modtools.h @@ -102,7 +102,7 @@ struct ModIndex : public RTLIL::Monitor auto_reload_module = false; } - virtual void notify_connect(RTLIL::Cell *cell, const RTLIL::IdString &port, const RTLIL::SigSpec &old_sig, RTLIL::SigSpec &sig) OVERRIDE + virtual void notify_connect(RTLIL::Cell *cell, const RTLIL::IdString &port, const RTLIL::SigSpec &old_sig, RTLIL::SigSpec &sig) YS_OVERRIDE { if (auto_reload_module) reload_module(); diff --git a/kernel/register.h b/kernel/register.h index a49675ed2..5214dd9a3 100644 --- a/kernel/register.h +++ b/kernel/register.h @@ -73,7 +73,7 @@ struct Frontend : Pass Frontend(std::string name, std::string short_help = "** document me **"); virtual void run_register(); virtual ~Frontend(); - virtual void execute(std::vector<std::string> args, RTLIL::Design *design) OVERRIDE FINAL; + virtual void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE YS_FINAL; virtual void execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) = 0; static std::vector<std::string> next_args; @@ -89,7 +89,7 @@ struct Backend : Pass Backend(std::string name, std::string short_help = "** document me **"); virtual void run_register(); virtual ~Backend(); - virtual void execute(std::vector<std::string> args, RTLIL::Design *design) OVERRIDE FINAL; + virtual void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE YS_FINAL; virtual void execute(std::ostream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) = 0; void extra_args(std::ostream *&f, std::string &filename, std::vector<std::string> args, size_t argidx); diff --git a/kernel/yosys.h b/kernel/yosys.h index 11f356adc..b64739ad4 100644 --- a/kernel/yosys.h +++ b/kernel/yosys.h @@ -102,18 +102,22 @@ #define USING_YOSYS_NAMESPACE using namespace Yosys; #if __cplusplus >= 201103L -# define OVERRIDE override -# define FINAL final +# define YS_OVERRIDE override +# define YS_FINAL final #else -# define OVERRIDE -# define FINAL +# define YS_OVERRIDE +# define YS_FINAL #endif -#if !defined(__GNUC__) && !defined(__clang__) -# define __attribute__(...) -# define _NORETURN_ __declspec(noreturn) +#if defined(__GNUC__) || defined(__clang__) +# define YS_ATTRIBUTE(...) __attribute__((__VA_ARGS__)) +# define YS_NORETURN +#elif defined(_MSC_VER) +# define YS_ATTRIBUTE(...) +# define YS_NORETURN __declspec(noreturn) #else -# define _NORETURN_ +# define YS_ATTRIBUTE(...) +# define YS_NORETURN #endif YOSYS_NAMESPACE_BEGIN @@ -125,7 +129,7 @@ namespace RTLIL { struct Cell; } -std::string stringf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); +std::string stringf(const char *fmt, ...) YS_ATTRIBUTE(format(printf, 1, 2)); std::string vstringf(const char *fmt, va_list ap); int readsome(std::istream &f, char *s, int n); std::string next_token(std::string &text, const char *sep); |