Skip to content

Commit

Permalink
]GR-19220] Fix rb_warn and rb_warning macros (#1886).
Browse files Browse the repository at this point in the history
PullRequest: truffleruby/1291
  • Loading branch information
aardvark179 committed Jan 21, 2020
2 parents b0d06de + 90a53c9 commit 8fe1125
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ New features:
Bug fixes:

* Fixed `Exception#dup` to copy exception backtrace string array.
* Fixed `rb_warn` and `rb_warning` when used as statements (#1886, @chrisseaton).

Compatibility:

Expand Down
8 changes: 4 additions & 4 deletions lib/cext/include/truffleruby/truffleruby.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@ typedef void *(*gvl_call)(void *);

// Utilities

#define rb_warn(FORMAT, ...) do { \
#define rb_warn(FORMAT, ...) __extension__ ({ \
if (polyglot_as_boolean(polyglot_invoke(RUBY_CEXT, "warn?"))) { \
RUBY_INVOKE(rb_mKernel, "warn", rb_sprintf(FORMAT, ##__VA_ARGS__)); \
} \
} while (0);
})

#define rb_warning(FORMAT, ...) do { \
#define rb_warning(FORMAT, ...) __extension__({ \
if (polyglot_as_boolean(polyglot_invoke(RUBY_CEXT, "warning?"))) { \
RUBY_INVOKE(rb_mKernel, "warn", rb_sprintf(FORMAT, ##__VA_ARGS__)); \
} \
} while (0);
})

#define rb_tr_scan_args_1(ARGC, ARGV, FORMAT, V1) rb_tr_scan_args(ARGC, ARGV, FORMAT, V1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
#define rb_tr_scan_args_2(ARGC, ARGV, FORMAT, V1, V2) rb_tr_scan_args(ARGC, ARGV, FORMAT, V1, V2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
Expand Down

0 comments on commit 8fe1125

Please sign in to comment.