diff options
author | Kjell Winblad <kjellwinblad@gmail.com> | 2019-08-15 16:43:49 +0200 |
---|---|---|
committer | Kjell Winblad <kjellwinblad@gmail.com> | 2019-12-18 10:00:29 +0100 |
commit | d5d89208521cc0d025ed47c6ea8419ec7aadea48 (patch) | |
tree | 56189a7a4680d43574232ab0099c097f421cd641 /erts/emulator/beam/sys.h | |
parent | eb26b2465228324272e4a3df6c517d8c55283939 (diff) | |
download | erlang-d5d89208521cc0d025ed47c6ea8419ec7aadea48.tar.gz |
Make ets:insert/2 and ets:insert_new/2 yield
The `ets:insert/2` and `ets:insert_new/2` functions did not yield even
when they were given long lists and a call to one of the functions did
only consume a single reduction. This commit fixes these problems.
The fix uses the "Yielding C Fun" tool to automatically generate
yieldable versions of C functions.
Diffstat (limited to 'erts/emulator/beam/sys.h')
-rw-r--r-- | erts/emulator/beam/sys.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/erts/emulator/beam/sys.h b/erts/emulator/beam/sys.h index 4350e599d4..2cf4707e23 100644 --- a/erts/emulator/beam/sys.h +++ b/erts/emulator/beam/sys.h @@ -261,6 +261,39 @@ __decl_noreturn void __noreturn erl_assert_error(const char* expr, const char *f #endif /* + * ERTS_GCC_DIAG_ON and ERTS_GCC_DIAG_OFF can be used to temporarly + * disable a gcc or clang warning in a file. + * + * Example: + * GCC_DIAG_OFF(unused-function) + * static int test(){ return 0;} + * GCC_DIAG_ON(unused-function) + * + * These macros were orginally authored by Jonathan Wakely and has + * been modified by Patrick Horgan. + * + * Source: http://dbp-consulting.com/tutorials/SuppressingGCCWarnings.html + * + */ +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 +#define ERTS_GCC_DIAG_STR(s) #s +#define ERTS_GCC_DIAG_JOINSTR(x,y) ERTS_GCC_DIAG_STR(x ## y) +# define ERTS_GCC_DIAG_DO_PRAGMA(x) _Pragma (#x) +# define ERTS_GCC_DIAG_PRAGMA(x) ERTS_GCC_DIAG_DO_PRAGMA(GCC diagnostic x) +# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 +# define ERTS_GCC_DIAG_OFF(x) ERTS_GCC_DIAG_PRAGMA(push) \ + ERTS_GCC_DIAG_PRAGMA(ignored ERTS_GCC_DIAG_JOINSTR(-W,x)) +# define ERTS_GCC_DIAG_ON(x) ERTS_GCC_DIAG_PRAGMA(pop) +# else +# define ERTS_GCC_DIAG_OFF(x) ERTS_GCC_DIAG_PRAGMA(ignored ERTS_GCC_DIAG_JOINSTR(-W,x)) +# define ERTS_GCC_DIAG_ON(x) ERTS_GCC_DIAG_PRAGMA(warning ERTS_GCC_DIAG_JOINSTR(-W,x)) +# endif +#else +# define ERTS_GCC_DIAG_OFF(x) +# define ERTS_GCC_DIAG_ON(x) +#endif + +/* * Compile time assert * (the actual compiler error msg can be a bit confusing) */ |