Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ jobs:
run: sudo rm /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb

- name: Initialize CodeQL
uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
uses: github/codeql-action/init@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
with:
languages: ${{ matrix.language }}
trap-caching: false
debug: true

- name: Autobuild
uses: github/codeql-action/autobuild@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
uses: github/codeql-action/autobuild@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
uses: github/codeql-action/analyze@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
with:
category: '/language:${{ matrix.language }}'
upload: False
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
continue-on-error: true

- name: Upload SARIF
uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
uses: github/codeql-action/upload-sarif@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
with:
sarif_file: sarif-results/${{ matrix.language }}.sarif
continue-on-error: true
7 changes: 7 additions & 0 deletions .github/workflows/post_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ jobs:
RUBY_GIT_SYNC_PRIVATE_KEY: ${{ secrets.RUBY_GIT_SYNC_PRIVATE_KEY }}
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/ruby_') }}

- name: Fetch changesets on bugs.ruby-lang.org
run: |
curl "https://bugs.ruby-lang.org/sys/fetch_changesets?key=${REDMINE_SYS_API_KEY}" -s --fail-with-body -w '* status: %{http_code}\n'
env:
REDMINE_SYS_API_KEY: ${{ secrets.REDMINE_SYS_API_KEY }}
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/ruby_') }}

- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 500 # for notify-slack-commits
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion error.c
Original file line number Diff line number Diff line change
Expand Up @@ -2619,7 +2619,7 @@ name_err_mesg_to_str(VALUE obj)
VALUE mesg = ptr->mesg;
if (NIL_P(mesg)) return Qnil;
else {
struct RString s_str, c_str, d_str;
struct RString s_str = {RBASIC_INIT}, c_str = {RBASIC_INIT}, d_str = {RBASIC_INIT};
VALUE c, s, d = 0, args[4], c2;
int state = 0;
rb_encoding *usascii = rb_usascii_encoding();
Expand Down
2 changes: 1 addition & 1 deletion ext/-test-/string/fstring.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ VALUE
bug_s_fstring_fake_str(VALUE self)
{
static const char literal[] = "abcdefghijklmnopqrstuvwxyz";
struct RString fake_str;
struct RString fake_str = {RBASIC_INIT};
return rb_str_to_interned_str(rb_setup_fake_str(&fake_str, literal, sizeof(literal) - 1, 0));
}

Expand Down
2 changes: 2 additions & 0 deletions include/ruby/internal/attr/nonstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
# define RBIMPL_ATTR_NONSTRING() __attribute__((nonstring))
# if RBIMPL_COMPILER_SINCE(GCC, 15, 0, 0)
# define RBIMPL_ATTR_NONSTRING_ARRAY() RBIMPL_ATTR_NONSTRING()
# elif RBIMPL_COMPILER_SINCE(Clang, 21, 0, 0)
# define RBIMPL_ATTR_NONSTRING_ARRAY() RBIMPL_ATTR_NONSTRING()
# else
# define RBIMPL_ATTR_NONSTRING_ARRAY() /* void */
# endif
Expand Down
3 changes: 3 additions & 0 deletions include/ruby/internal/core/rbasic.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ RBasic {
#endif
{
}
# define RBASIC_INIT RBasic()
#else
# define RBASIC_INIT {RBIMPL_VALUE_NULL}
#endif
};

Expand Down
2 changes: 1 addition & 1 deletion include/ruby/internal/core/rstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ rbimpl_rstring_getmem(VALUE str)
}
else {
/* Expecting compilers to optimize this on-stack struct away. */
struct RString retval;
struct RString retval = {RBASIC_INIT};
retval.len = RSTRING_LEN(str);
retval.as.heap.ptr = RSTRING(str)->as.embed.ary;
return retval;
Expand Down
4 changes: 2 additions & 2 deletions load.c
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ rb_require_internal(VALUE fname)
int
ruby_require_internal(const char *fname, unsigned int len)
{
struct RString fake;
struct RString fake = {RBASIC_INIT};
VALUE str = rb_setup_fake_str(&fake, fname, len, 0);
rb_execution_context_t *ec = GET_EC();
int result = require_internal(ec, str, 0, RTEST(ruby_verbose));
Expand Down Expand Up @@ -1476,7 +1476,7 @@ rb_require_string_internal(VALUE fname, bool resurrect)
VALUE
rb_require(const char *fname)
{
struct RString fake;
struct RString fake = {RBASIC_INIT};
VALUE str = rb_setup_fake_str(&fake, fname, strlen(fname), 0);
return rb_require_string_internal(str, true);
}
Expand Down
2 changes: 1 addition & 1 deletion marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ long
ruby_marshal_read_long(const char **buf, long len)
{
long x;
struct RString src;
struct RString src = {RBASIC_INIT};
struct load_arg arg;
memset(&arg, 0, sizeof(arg));
arg.src = rb_setup_fake_str(&src, *buf, len, 0);
Expand Down
12 changes: 6 additions & 6 deletions string.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,14 +655,14 @@ rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encod
VALUE
rb_fstring_new(const char *ptr, long len)
{
struct RString fake_str;
struct RString fake_str = {RBASIC_INIT};
return register_fstring(setup_fake_str(&fake_str, ptr, len, ENCINDEX_US_ASCII), false, false);
}

VALUE
rb_fstring_enc_new(const char *ptr, long len, rb_encoding *enc)
{
struct RString fake_str;
struct RString fake_str = {RBASIC_INIT};
return register_fstring(rb_setup_fake_str(&fake_str, ptr, len, enc), false, false);
}

Expand Down Expand Up @@ -6497,7 +6497,7 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
val = rb_obj_as_string(rb_yield(match0));
}
else {
struct RString fake_str;
struct RString fake_str = {RBASIC_INIT};
VALUE key;
if (mode == FAST_MAP) {
// It is safe to use a fake_str here because we established that it won't escape,
Expand Down Expand Up @@ -12747,7 +12747,7 @@ rb_str_to_interned_str(VALUE str)
VALUE
rb_interned_str(const char *ptr, long len)
{
struct RString fake_str;
struct RString fake_str = {RBASIC_INIT};
return register_fstring(setup_fake_str(&fake_str, ptr, len, ENCINDEX_US_ASCII), true, false);
}

Expand All @@ -12764,7 +12764,7 @@ rb_enc_interned_str(const char *ptr, long len, rb_encoding *enc)
rb_enc_autoload(enc);
}

struct RString fake_str;
struct RString fake_str = {RBASIC_INIT};
return register_fstring(rb_setup_fake_str(&fake_str, ptr, len, enc), true, false);
}

Expand All @@ -12775,7 +12775,7 @@ rb_enc_literal_str(const char *ptr, long len, rb_encoding *enc)
rb_enc_autoload(enc);
}

struct RString fake_str;
struct RString fake_str = {RBASIC_INIT};
return register_fstring(rb_setup_fake_str(&fake_str, ptr, len, enc), true, true);
}

Expand Down
8 changes: 4 additions & 4 deletions symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ lookup_id_str(ID id)
ID
rb_intern3(const char *name, long len, rb_encoding *enc)
{
struct RString fake_str;
struct RString fake_str = {RBASIC_INIT};
VALUE str = rb_setup_fake_str(&fake_str, name, len, enc);
OBJ_FREEZE(str);

Expand Down Expand Up @@ -1222,7 +1222,7 @@ rb_check_symbol(volatile VALUE *namep)
ID
rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc)
{
struct RString fake_str;
struct RString fake_str = {RBASIC_INIT};
const VALUE name = rb_setup_fake_str(&fake_str, ptr, len, enc);

sym_check_asciionly(name, true);
Expand All @@ -1234,7 +1234,7 @@ VALUE
rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc)
{
VALUE sym;
struct RString fake_str;
struct RString fake_str = {RBASIC_INIT};
const VALUE name = rb_setup_fake_str(&fake_str, ptr, len, enc);

sym_check_asciionly(name, true);
Expand All @@ -1258,7 +1258,7 @@ FUNC_MINIMIZED(VALUE rb_sym_intern_ascii_cstr(const char *ptr));
VALUE
rb_sym_intern(const char *ptr, long len, rb_encoding *enc)
{
struct RString fake_str;
struct RString fake_str = {RBASIC_INIT};
const VALUE name = rb_setup_fake_str(&fake_str, ptr, len, enc);
return rb_str_intern(name);
}
Expand Down
4 changes: 2 additions & 2 deletions vm_insnhelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -6428,7 +6428,7 @@ static VALUE
vm_opt_newarray_include_p(rb_execution_context_t *ec, rb_num_t num, const VALUE *ptr, VALUE target)
{
if (BASIC_OP_UNREDEFINED_P(BOP_INCLUDE_P, ARRAY_REDEFINED_OP_FLAG)) {
struct RArray fake_ary;
struct RArray fake_ary = {RBASIC_INIT};
VALUE ary = rb_setup_fake_ary(&fake_ary, ptr, num);
return rb_ary_includes(ary, target);
}
Expand All @@ -6448,7 +6448,7 @@ static VALUE
vm_opt_newarray_pack_buffer(rb_execution_context_t *ec, rb_num_t num, const VALUE *ptr, VALUE fmt, VALUE buffer)
{
if (BASIC_OP_UNREDEFINED_P(BOP_PACK, ARRAY_REDEFINED_OP_FLAG)) {
struct RArray fake_ary;
struct RArray fake_ary = {RBASIC_INIT};
VALUE ary = rb_setup_fake_ary(&fake_ary, ptr, num);
return rb_ec_pack_ary(ec, ary, fmt, (UNDEF_P(buffer) ? Qnil : buffer));
}
Expand Down