Commit b3fa771
Rob Percival
Fixes format-security error when compiling ruby_193_compatible.h
When compiling the extension for Ruby 1.9 on a system that treats format-security warnings as errors (i.e. the Makefile generated for the extension contains "-Werror=format-security"), compilation would fail with the following error:
```
compiling atomic_boolean.c
In file included from atomic_boolean.c:5:0:
ruby_193_compatible.h: In function 'rb_error_arity':
ruby_193_compatible.h:20:3: warning: passing argument 2 of 'rb_raise' makes pointer from integer without a cast [enabled by
default]
rb_raise(rb_eTypeError, err_mess);
^
In file included from /usr/include/ruby-1.9.1/ruby.h:32:0,
from atomic_boolean.c:1:
/usr/include/ruby-1.9.1/ruby/ruby.h:1172:27: note: expected 'const char *' but argument is of type 'VALUE'
PRINTF_ARGS(NORETURN(void rb_raise(VALUE, const char*, ...)), 2, 3);
^
/usr/include/ruby-1.9.1/ruby/ruby.h:42:3: note: in definition of macro 'PRINTF_ARGS'
decl __attribute__((format(printf, string_index, first_to_check)))
^
/usr/include/ruby-1.9.1/ruby/ruby.h:1172:13: note: in expansion of macro 'NORETURN'
PRINTF_ARGS(NORETURN(void rb_raise(VALUE, const char*, ...)), 2, 3);
^
In file included from atomic_boolean.c:5:0:
ruby_193_compatible.h:20:3: error: format not a string literal and no format arguments [-Werror=format-security]
rb_raise(rb_eTypeError, err_mess);
^
cc1: some warnings being treated as errors
make: *** [atomic_boolean.o] Error 1
```
This updates these functions to work more like the original copies (found in the Ruby 2.0+ source code), which avoids this compilation error.1 parent 0d044be commit b3fa771
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
0 commit comments