From: Miodrag Milanovic Date: Fri, 5 Nov 2021 09:51:58 +0000 (+0100) Subject: Make it work on all X-Git-Tag: yosys-0.11~2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d5de2a0cdb3dcfe553a841db24f273e074d8f49d;p=yosys.git Make it work on all --- diff --git a/kernel/yosys.h b/kernel/yosys.h index 7fe8dc4f4..826e7f4cd 100644 --- a/kernel/yosys.h +++ b/kernel/yosys.h @@ -147,9 +147,7 @@ extern Tcl_Obj *Tcl_ObjSetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *p # define YS_ATTRIBUTE(...) #endif -#if __cplusplus >= 201703L -# define YS_MAYBE_UNUSED [[maybe_unused]] -#elif defined(__GNUC__) || defined(__clang__) +#if defined(__GNUC__) || defined(__clang__) # define YS_MAYBE_UNUSED __attribute__((__unused__)) #else # define YS_MAYBE_UNUSED diff --git a/passes/pmgen/pmgen.py b/passes/pmgen/pmgen.py index c599d31a6..6e2fabeeb 100644 --- a/passes/pmgen/pmgen.py +++ b/passes/pmgen/pmgen.py @@ -679,14 +679,16 @@ with open(outfile, "w") as f: print("#undef subpattern", file=f) print("", file=f) - print("YS_MAYBE_UNUSED rollback_label:;", file=f) + print("rollback_label:", file=f) + print(" YS_MAYBE_UNUSED;", file=f) if len(block["fcode"]): print("#define accept do { accept_cnt++; on_accept(); } while(0)", file=f) print("#define finish do { rollback = -1; goto finish_label; } while(0)", file=f) for line in block["fcode"]: print(" " + line, file=f) - print("YS_MAYBE_UNUSED finish_label:;", file=f) + print("finish_label:", file=f) + print(" YS_MAYBE_UNUSED;", file=f) print("#undef accept", file=f) print("#undef finish", file=f)