Suppress gcc 15 unterminated-string-initialization warnings
This commit is contained in:
parent
545aafa2a2
commit
b42afa1dbc
@ -9992,6 +9992,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
|
||||
@ -10613,6 +10614,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
|
||||
@ -16937,6 +16939,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
|
||||
@ -17705,6 +17708,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
|
||||
@ -18170,6 +18174,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
|
||||
|
@ -7016,6 +7016,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 = {
|
||||
@ -436,7 +437,7 @@ rb_cp50221_encoder = {
|
||||
|
||||
/* JIS0201 to JIS0208 conversion table */
|
||||
enum {tbl0208_num = 0xDF - 0xA1 + 1};
|
||||
static const char tbl0208[tbl0208_num][2] = {
|
||||
RBIMPL_ATTR_NONSTRING() static const char tbl0208[tbl0208_num][2] = {
|
||||
"\x21\x23", "\x21\x56", "\x21\x57", "\x21\x22",
|
||||
"\x21\x26", "\x25\x72", "\x25\x21", "\x25\x23",
|
||||
"\x25\x25", "\x25\x27", "\x25\x29", "\x25\x63",
|
||||
|
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 */
|
@ -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)
|
||||
@ -1515,7 +1516,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;
|
||||
|
3
regenc.h
3
regenc.h
@ -118,6 +118,9 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
short int len;
|
||||
#if defined(__has_attribute) && __has_attribute(nonstring)
|
||||
__attribute__((nonstring))
|
||||
#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
|
||||
@ -976,7 +977,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
@ -46,6 +46,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
|
||||
@ -11971,7 +11972,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)
|
||||
|
||||
|
3
symbol.c
3
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
|
||||
@ -171,7 +172,7 @@ rb_id_attrset(ID id)
|
||||
|
||||
/* make new symbol and ID */
|
||||
if (!(str = lookup_id_str(id))) {
|
||||
static const char id_types[][8] = {
|
||||
RBIMPL_ATTR_NONSTRING() static const char id_types[][8] = {
|
||||
"local",
|
||||
"instance",
|
||||
"invalid",
|
||||
|
@ -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
|
||||
|
@ -88,6 +88,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"
|
||||
|
||||
@ -107,12 +108,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user