mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
merge revision(s) b42afa1dbc
, 67b91e7807
, f1f0cc14cc
, 543e3a1896
, ed2806117a
, 46e4c86737
: [Backport #21497]
Suppress gcc 15 unterminated-string-initialization warnings Drop an ignored attribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC 13.3.0 (Ubuntu 24.04) emits the following warning: ../symbol.c: In function ‘rb_id_attrset’: ../symbol.c:175:9: warning: ‘nonstring’ attribute ignored on objects of type ‘const char[][8]’ [-Wattributes] 175 | RBIMPL_ATTR_NONSTRING() static const char id_types[][8] = { | ^~~~~~~~~~~~~~~~~~~~~ Separate `__has_attribute` from `defined(__has_attribute)` Fix Visual C warnings: ``` regenc.h(121): warning C4067: unexpected tokens following preprocessor directive - expected a newline ``` Cast up `int` instruction code to `VALUE` Fix Visual C warnings: ``` iseq.c(3793): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size iseq.c(3794): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size ``` Do not let files depend on a phony target Detect `clock_gettime` and `clock_getres` for winpthreads
This commit is contained in:
parent
1e37f34eaa
commit
407f6c9d05
15 changed files with 68 additions and 11 deletions
10
common.mk
10
common.mk
|
@ -836,7 +836,10 @@ clean-platform distclean-platform realclean-platform:
|
|||
|
||||
RUBYSPEC_CAPIEXT = spec/ruby/optional/capi/ext
|
||||
RUBYSPEC_CAPIEXT_SRCDIR = $(srcdir)/$(RUBYSPEC_CAPIEXT)
|
||||
RUBYSPEC_CAPIEXT_DEPS = $(RUBYSPEC_CAPIEXT_SRCDIR)/rubyspec.h $(RUBY_H_INCLUDES) $(LIBRUBY) build-ext
|
||||
RUBYSPEC_CAPIEXT_DEPS = $(RUBYSPEC_CAPIEXT_SRCDIR)/rubyspec.h $(RUBY_H_INCLUDES) $(LIBRUBY)
|
||||
|
||||
rubyspec-capiext: build-ext $(DOT_WAIT)
|
||||
# make-dependent rules should be included after this and built after build-ext.
|
||||
|
||||
clean-spec: PHONY
|
||||
-$(Q) $(RM) $(RUBYSPEC_CAPIEXT)/*.$(OBJEXT) $(RUBYSPEC_CAPIEXT)/*.$(DLEXT)
|
||||
|
@ -9526,6 +9529,7 @@ marshal.$(OBJEXT): {$(VPATH)}internal/attr/nodiscard.h
|
|||
marshal.$(OBJEXT): {$(VPATH)}internal/attr/noexcept.h
|
||||
marshal.$(OBJEXT): {$(VPATH)}internal/attr/noinline.h
|
||||
marshal.$(OBJEXT): {$(VPATH)}internal/attr/nonnull.h
|
||||
marshal.$(OBJEXT): {$(VPATH)}internal/attr/nonstring.h
|
||||
marshal.$(OBJEXT): {$(VPATH)}internal/attr/noreturn.h
|
||||
marshal.$(OBJEXT): {$(VPATH)}internal/attr/packed_struct.h
|
||||
marshal.$(OBJEXT): {$(VPATH)}internal/attr/pure.h
|
||||
|
@ -10135,6 +10139,7 @@ miniinit.$(OBJEXT): {$(VPATH)}internal/attr/nodiscard.h
|
|||
miniinit.$(OBJEXT): {$(VPATH)}internal/attr/noexcept.h
|
||||
miniinit.$(OBJEXT): {$(VPATH)}internal/attr/noinline.h
|
||||
miniinit.$(OBJEXT): {$(VPATH)}internal/attr/nonnull.h
|
||||
miniinit.$(OBJEXT): {$(VPATH)}internal/attr/nonstring.h
|
||||
miniinit.$(OBJEXT): {$(VPATH)}internal/attr/noreturn.h
|
||||
miniinit.$(OBJEXT): {$(VPATH)}internal/attr/packed_struct.h
|
||||
miniinit.$(OBJEXT): {$(VPATH)}internal/attr/pure.h
|
||||
|
@ -16472,6 +16477,7 @@ signal.$(OBJEXT): {$(VPATH)}internal/attr/nodiscard.h
|
|||
signal.$(OBJEXT): {$(VPATH)}internal/attr/noexcept.h
|
||||
signal.$(OBJEXT): {$(VPATH)}internal/attr/noinline.h
|
||||
signal.$(OBJEXT): {$(VPATH)}internal/attr/nonnull.h
|
||||
signal.$(OBJEXT): {$(VPATH)}internal/attr/nonstring.h
|
||||
signal.$(OBJEXT): {$(VPATH)}internal/attr/noreturn.h
|
||||
signal.$(OBJEXT): {$(VPATH)}internal/attr/packed_struct.h
|
||||
signal.$(OBJEXT): {$(VPATH)}internal/attr/pure.h
|
||||
|
@ -17231,6 +17237,7 @@ string.$(OBJEXT): {$(VPATH)}internal/attr/nodiscard.h
|
|||
string.$(OBJEXT): {$(VPATH)}internal/attr/noexcept.h
|
||||
string.$(OBJEXT): {$(VPATH)}internal/attr/noinline.h
|
||||
string.$(OBJEXT): {$(VPATH)}internal/attr/nonnull.h
|
||||
string.$(OBJEXT): {$(VPATH)}internal/attr/nonstring.h
|
||||
string.$(OBJEXT): {$(VPATH)}internal/attr/noreturn.h
|
||||
string.$(OBJEXT): {$(VPATH)}internal/attr/packed_struct.h
|
||||
string.$(OBJEXT): {$(VPATH)}internal/attr/pure.h
|
||||
|
@ -17689,6 +17696,7 @@ symbol.$(OBJEXT): {$(VPATH)}internal/attr/nodiscard.h
|
|||
symbol.$(OBJEXT): {$(VPATH)}internal/attr/noexcept.h
|
||||
symbol.$(OBJEXT): {$(VPATH)}internal/attr/noinline.h
|
||||
symbol.$(OBJEXT): {$(VPATH)}internal/attr/nonnull.h
|
||||
symbol.$(OBJEXT): {$(VPATH)}internal/attr/nonstring.h
|
||||
symbol.$(OBJEXT): {$(VPATH)}internal/attr/noreturn.h
|
||||
symbol.$(OBJEXT): {$(VPATH)}internal/attr/packed_struct.h
|
||||
symbol.$(OBJEXT): {$(VPATH)}internal/attr/pure.h
|
||||
|
|
|
@ -500,7 +500,8 @@ update-deps:
|
|||
|
||||
# order-only-prerequisites doesn't work for $(RUBYSPEC_CAPIEXT)
|
||||
# because the same named directory exists in the source tree.
|
||||
$(RUBYSPEC_CAPIEXT)/%.$(DLEXT): $(srcdir)/$(RUBYSPEC_CAPIEXT)/%.c $(RUBYSPEC_CAPIEXT_DEPS)
|
||||
$(RUBYSPEC_CAPIEXT)/%.$(DLEXT): $(srcdir)/$(RUBYSPEC_CAPIEXT)/%.c $(RUBYSPEC_CAPIEXT_DEPS) \
|
||||
| build-ext
|
||||
$(ECHO) building $@
|
||||
$(Q) $(MAKEDIRS) $(@D)
|
||||
$(Q) $(DLDSHARED) -L. $(XDLDFLAGS) $(XLDFLAGS) $(LDFLAGS) $(INCFLAGS) $(CPPFLAGS) $(OUTFLAG)$@ $< $(LIBRUBYARG)
|
||||
|
|
|
@ -6972,6 +6972,7 @@ enc/trans/iso2022.$(OBJEXT): internal/attr/nodiscard.h
|
|||
enc/trans/iso2022.$(OBJEXT): internal/attr/noexcept.h
|
||||
enc/trans/iso2022.$(OBJEXT): internal/attr/noinline.h
|
||||
enc/trans/iso2022.$(OBJEXT): internal/attr/nonnull.h
|
||||
enc/trans/iso2022.$(OBJEXT): internal/attr/nonstring.h
|
||||
enc/trans/iso2022.$(OBJEXT): internal/attr/noreturn.h
|
||||
enc/trans/iso2022.$(OBJEXT): internal/attr/packed_struct.h
|
||||
enc/trans/iso2022.$(OBJEXT): internal/attr/pure.h
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "transcode_data.h"
|
||||
#include "ruby/internal/attr/nonstring.h"
|
||||
|
||||
<%
|
||||
map = {
|
||||
|
@ -443,7 +444,7 @@ rb_cp50221_encoder = {
|
|||
iso2022jp_encoder_reset_sequence_size, finish_iso2022jp_encoder
|
||||
};
|
||||
|
||||
static const char *tbl0208 =
|
||||
RBIMPL_ATTR_NONSTRING() static const char *tbl0208 =
|
||||
"\x21\x23\x21\x56\x21\x57\x21\x22\x21\x26\x25\x72\x25\x21\x25\x23" \
|
||||
"\x25\x25\x25\x27\x25\x29\x25\x63\x25\x65\x25\x67\x25\x43\x21\x3C" \
|
||||
"\x25\x22\x25\x24\x25\x26\x25\x28\x25\x2A\x25\x2B\x25\x2D\x25\x2F" \
|
||||
|
|
32
include/ruby/internal/attr/nonstring.h
Normal file
32
include/ruby/internal/attr/nonstring.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef RBIMPL_ATTR_NONSTRING_H /*-*-C++-*-vi:se ft=cpp:*/
|
||||
#define RBIMPL_ATTR_NONSTRING_H
|
||||
/**
|
||||
* @file
|
||||
* @author Ruby developers <ruby-core@ruby-lang.org>
|
||||
* @copyright This file is a part of the programming language Ruby.
|
||||
* Permission is hereby granted, to either redistribute and/or
|
||||
* modify this file, provided that the conditions mentioned in the
|
||||
* file COPYING are met. Consult the file for details.
|
||||
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
|
||||
* implementation details. Don't take them as canon. They could
|
||||
* rapidly appear then vanish. The name (path) of this header file
|
||||
* is also an implementation detail. Do not expect it to persist
|
||||
* at the place it is now. Developers are free to move it anywhere
|
||||
* anytime at will.
|
||||
* @note To ruby-core: remember that this header can be possibly
|
||||
* recursively included from extension libraries written in C++.
|
||||
* Do not expect for instance `__VA_ARGS__` is always available.
|
||||
* We assume C99 for ruby itself but we don't assume languages of
|
||||
* extension libraries. They could be written in C++98.
|
||||
* @brief Defines #RBIMPL_ATTR_NONSTRING.
|
||||
*/
|
||||
#include "ruby/internal/has/attribute.h"
|
||||
|
||||
/** Wraps (or simulates) `__attribute__((nonstring))` */
|
||||
#if RBIMPL_HAS_ATTRIBUTE(nonstring)
|
||||
# define RBIMPL_ATTR_NONSTRING() __attribute__((nonstring))
|
||||
#else
|
||||
# define RBIMPL_ATTR_NONSTRING() /* void */
|
||||
#endif
|
||||
|
||||
#endif /* RBIMPL_ATTR_NONSTRING_H */
|
2
iseq.c
2
iseq.c
|
@ -3484,7 +3484,7 @@ rb_vm_encoded_insn_data_table_init(void)
|
|||
const void * const *table = rb_vm_get_insns_address_table();
|
||||
#define INSN_CODE(insn) ((VALUE)table[insn])
|
||||
#else
|
||||
#define INSN_CODE(insn) (insn)
|
||||
#define INSN_CODE(insn) ((VALUE)(insn))
|
||||
#endif
|
||||
st_data_t insn;
|
||||
encoded_insn_data = st_init_numtable_with_size(VM_INSTRUCTION_SIZE / 2);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "ruby/util.h"
|
||||
#include "builtin.h"
|
||||
#include "shape.h"
|
||||
#include "ruby/internal/attr/nonstring.h"
|
||||
|
||||
#define BITSPERSHORT (2*CHAR_BIT)
|
||||
#define SHORTMASK ((1<<BITSPERSHORT)-1)
|
||||
|
@ -1541,7 +1542,7 @@ name_equal(const char *name, size_t nlen, const char *p, long l)
|
|||
static int
|
||||
sym2encidx(VALUE sym, VALUE val)
|
||||
{
|
||||
static const char name_encoding[8] = "encoding";
|
||||
RBIMPL_ATTR_NONSTRING() static const char name_encoding[8] = "encoding";
|
||||
const char *p;
|
||||
long l;
|
||||
if (rb_enc_get_index(sym) != ENCINDEX_US_ASCII) return -1;
|
||||
|
|
5
regenc.h
5
regenc.h
|
@ -118,6 +118,11 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
short int len;
|
||||
#if defined(__has_attribute)
|
||||
# if __has_attribute(nonstring)
|
||||
__attribute__((nonstring))
|
||||
# endif
|
||||
#endif
|
||||
const UChar name[6];
|
||||
int ctype;
|
||||
} PosixBracketEntryType;
|
||||
|
|
3
signal.c
3
signal.c
|
@ -45,6 +45,7 @@
|
|||
#include "ruby_atomic.h"
|
||||
#include "vm_core.h"
|
||||
#include "ractor_core.h"
|
||||
#include "ruby/internal/attr/nonstring.h"
|
||||
|
||||
#ifdef NEED_RUBY_ATOMIC_OPS
|
||||
rb_atomic_t
|
||||
|
@ -968,7 +969,7 @@ check_reserved_signal_(const char *name, size_t name_len, int signo)
|
|||
if (prev) {
|
||||
ssize_t RB_UNUSED_VAR(err);
|
||||
static const int stderr_fd = 2;
|
||||
#define NOZ(name, str) name[sizeof(str)-1] = str
|
||||
#define NOZ(name, str) RBIMPL_ATTR_NONSTRING() name[sizeof(str)-1] = str
|
||||
static const char NOZ(msg1, " received in ");
|
||||
static const char NOZ(msg2, " handler\n");
|
||||
|
||||
|
|
|
@ -140,6 +140,9 @@ xor64_to(uint64_t *v, const uint64_t s)
|
|||
#endif
|
||||
|
||||
static const union {
|
||||
#if defined(__has_attribute) && __has_attribute(nonstring)
|
||||
__attribute__((nonstring))
|
||||
#endif
|
||||
char bin[32];
|
||||
uint64_t u64[4];
|
||||
} sip_init_state_bin = {"uespemos""modnarod""arenegyl""setybdet"};
|
||||
|
|
3
string.c
3
string.c
|
@ -44,6 +44,7 @@
|
|||
#include "ruby/util.h"
|
||||
#include "ruby_assert.h"
|
||||
#include "vm_sync.h"
|
||||
#include "ruby/internal/attr/nonstring.h"
|
||||
|
||||
#if defined HAVE_CRYPT_R
|
||||
# if defined HAVE_CRYPT_H
|
||||
|
@ -11123,7 +11124,7 @@ enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl, int cr)
|
|||
encidx = rb_enc_to_index(enc);
|
||||
|
||||
#define DEFAULT_REPLACE_CHAR(str) do { \
|
||||
static const char replace[sizeof(str)-1] = str; \
|
||||
RBIMPL_ATTR_NONSTRING() static const char replace[sizeof(str)-1] = str; \
|
||||
rep = replace; replen = (int)sizeof(replace); \
|
||||
} while (0)
|
||||
|
||||
|
|
1
symbol.c
1
symbol.c
|
@ -22,6 +22,7 @@
|
|||
#include "symbol.h"
|
||||
#include "vm_sync.h"
|
||||
#include "builtin.h"
|
||||
#include "ruby/internal/attr/nonstring.h"
|
||||
|
||||
#if defined(USE_SYMBOL_GC) && !(USE_SYMBOL_GC+0)
|
||||
# undef USE_SYMBOL_GC
|
||||
|
|
|
@ -22,7 +22,8 @@ ops = ids[:token_op].uniq {|id, op, token| token && op}
|
|||
|
||||
static const struct {
|
||||
unsigned short token;
|
||||
const char name[3], term;
|
||||
RBIMPL_ATTR_NONSTRING() const char name[3];
|
||||
const char term;
|
||||
} op_tbl[] = {
|
||||
% ops.each do |_id, op, token|
|
||||
% next unless token
|
||||
|
|
|
@ -93,6 +93,7 @@ Prelude.new(output, ARGV, vpath).instance_eval do
|
|||
#include "internal/ruby_parser.h"
|
||||
#include "internal/warnings.h"
|
||||
#include "iseq.h"
|
||||
#include "ruby/internal/attr/nonstring.h"
|
||||
#include "ruby/ruby.h"
|
||||
#include "vm_core.h"
|
||||
|
||||
|
@ -112,12 +113,12 @@ static const struct {
|
|||
% size += line.size
|
||||
% next
|
||||
% end
|
||||
char L<%=beg%><%=%>[<%=size%><%=%>]; /* <%=beg+1%>..<%=n%> */
|
||||
RBIMPL_ATTR_NONSTRING() char L<%=beg%><%=%>[<%=size%><%=%>]; /* <%=beg+1%>..<%=n%> */
|
||||
% size = line.size
|
||||
% beg = n
|
||||
% }
|
||||
% if size > 0
|
||||
char L<%=beg%><%=%>[<%=size%><%=%>]; /* <%=beg+1%>..<%=lines.size+1%> */
|
||||
RBIMPL_ATTR_NONSTRING() char L<%=beg%><%=%>[<%=size%><%=%>]; /* <%=beg+1%>..<%=lines.size+1%> */
|
||||
% end
|
||||
} prelude_code<%=i%><%=%> = {
|
||||
% size = 0
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||
#define RUBY_VERSION_TEENY 8
|
||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||
#define RUBY_PATCHLEVEL 166
|
||||
#define RUBY_PATCHLEVEL 167
|
||||
|
||||
#include "ruby/version.h"
|
||||
#include "ruby/internal/abi.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue