Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Correctly spec rb_str_new_cstr as 1.9-only CAPI #1791

Merged
merged 1 commit into from

3 participants

@ryoqun
Collaborator

Currently, rb_str_new_cstr is spec'ed as a function available under both 1.8
CAPI and 1.9 CAPI in spec/ruby/optional/capi/ext/rubyspec.h. This is not true.
As a version guard is correctly used in spec/ruby/optional/capi/string_spec.rb,
it is only declared under 1.9 CAPI, not under 1.8 CAPI.

In 1.8 mode, rb_str_new_cstr specs are only compiled, not run, thanks to the
version guard. So, there is no spec failures. However, this commit suppresses
the following warning from clang:

spec/ruby/optional/capi/ext/string_spec.c:165:12: warning:
  implicit declaration of function 'rb_str_new_cstr' is invalid in C99
    [-Wimplicit-function-declaration]
    return rb_str_new_cstr(NULL);
           ^
1 warning generated.

Also, #undefs aren't needed in spec/ruby/optional/capi/ext/mri.h, because
rb_str_new_cstr is now correctly declared only in 1.9 CAPI.

@ryoqun ryoqun Correctly spec rb_str_new_cstr as 1.9-only CAPI
Currently, rb_str_new_cstr is spec'ed as a function available under both 1.8
CAPI and 1.9 CAPI in spec/ruby/optional/capi/ext/rubyspec.h. This is not true.
As a version guard is correctly used in spec/ruby/optional/capi/string_spec.rb,
it is only declared under 1.9 CAPI, not under 1.8 CAPI.

In 1.8 mode, rb_str_new_cstr specs are only compiled, not run, thanks to the
version guard. So, there is no spec failures. However, this commit suppresses
the following warning from clang:

  spec/ruby/optional/capi/ext/string_spec.c:165:12: warning:
    implicit declaration of function 'rb_str_new_cstr' is invalid in C99
      [-Wimplicit-function-declaration]
      return rb_str_new_cstr(NULL);
             ^
  1 warning generated.

Also, #undefs aren't needed in spec/ruby/optional/capi/ext/mri.h, because
rb_str_new_cstr is now correctly declared only in 1.9 CAPI.
87c49c9
@travisbot

This pull request passes (merged 87c49c9 into 1c079a8).

@dbussink dbussink merged commit 5661603 into rubinius:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 2, 2012
  1. @ryoqun

    Correctly spec rb_str_new_cstr as 1.9-only CAPI

    ryoqun authored
    Currently, rb_str_new_cstr is spec'ed as a function available under both 1.8
    CAPI and 1.9 CAPI in spec/ruby/optional/capi/ext/rubyspec.h. This is not true.
    As a version guard is correctly used in spec/ruby/optional/capi/string_spec.rb,
    it is only declared under 1.9 CAPI, not under 1.8 CAPI.
    
    In 1.8 mode, rb_str_new_cstr specs are only compiled, not run, thanks to the
    version guard. So, there is no spec failures. However, this commit suppresses
    the following warning from clang:
    
      spec/ruby/optional/capi/ext/string_spec.c:165:12: warning:
        implicit declaration of function 'rb_str_new_cstr' is invalid in C99
          [-Wimplicit-function-declaration]
          return rb_str_new_cstr(NULL);
                 ^
      1 warning generated.
    
    Also, #undefs aren't needed in spec/ruby/optional/capi/ext/mri.h, because
    rb_str_new_cstr is now correctly declared only in 1.9 CAPI.
This page is out of date. Refresh to see the latest.
View
2  spec/ruby/optional/capi/ext/mri.h
@@ -18,12 +18,10 @@
#undef HAVE_RBIGNUM_POSITIVE_P
#undef HAVE_RBIGNUM_NEGATIVE_P
#undef HAVE_RB_STR_SET_LEN
-#undef HAVE_RB_STR_NEW_CSTR
#endif
#ifdef RUBY_VERSION_IS_1_8_EX_1_9
#undef HAVE_RB_THREAD_BLOCKING_REGION
-#undef HAVE_RB_STR_NEW_CSTR
#undef HAVE_RB_RATIONAL
#undef HAVE_RB_RATIONAL1
#undef HAVE_RB_RATIONAL2
View
2  spec/ruby/optional/capi/ext/rubyspec.h
@@ -199,6 +199,7 @@
#define HAVE_RB_ENC_TO_INDEX 1
#define HAVE_RB_OBJ_ENCODING 1
+#define HAVE_RB_STR_NEW_CSTR 1
#define HAVE_RB_USASCII_STR_NEW 1
#define HAVE_RB_USASCII_STR_NEW_CSTR 1
#define HAVE_RB_EXTERNAL_STR_NEW 1
@@ -432,7 +433,6 @@
#define HAVE_RB_STR_INTERN 1
#define HAVE_RB_STR_LEN 1
#define HAVE_RB_STR_NEW 1
-#define HAVE_RB_STR_NEW_CSTR 1
#define HAVE_RB_STR_NEW2 1
#define HAVE_RB_STR_NEW3 1
#define HAVE_RB_STR_NEW4 1
Something went wrong with that request. Please try again.