diff options
author | whitequark <whitequark@whitequark.org> | 2020-06-19 15:45:52 +0000 |
---|---|---|
committer | whitequark <whitequark@whitequark.org> | 2020-06-19 15:48:58 +0000 |
commit | c8c3c7af87804a175b3dfc60dce191b03c9741fe (patch) | |
tree | 1494e38f9c0ff81cf6eb3fd372b34cffc2e9e3c1 /kernel | |
parent | 118e4caa37aa437974d9ec2ac65a4c6048cf6291 (diff) | |
download | yosys-c8c3c7af87804a175b3dfc60dce191b03c9741fe.tar.gz yosys-c8c3c7af87804a175b3dfc60dce191b03c9741fe.tar.bz2 yosys-c8c3c7af87804a175b3dfc60dce191b03c9741fe.zip |
Use [[maybe_unused]] instead of YS_ATTRIBUTE(unused).
[[maybe_unused]] is available since C++17, so this commit adds
a polyfill YS_MAYBE_UNUSED. Once we require C++17 we can drop it.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/yosys.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/yosys.h b/kernel/yosys.h index b9b6b24b1..f1646d6bc 100644 --- a/kernel/yosys.h +++ b/kernel/yosys.h @@ -145,6 +145,14 @@ extern Tcl_Obj *Tcl_ObjSetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *p #endif #if __cplusplus >= 201703L +# define YS_MAYBE_UNUSED [[maybe_unused]]; +#elif defined(__GNUC__) || defined(__clang__) +# define YS_MAYBE_UNUSED __attribute__((__unused__)) +#else +# define YS_MAYBE_UNUSED +#endif + +#if __cplusplus >= 201703L # define YS_FALLTHROUGH [[fallthrough]]; #elif defined(__clang__) # define YS_FALLTHROUGH [[clang::fallthrough]]; |