aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2021-09-09 14:05:11 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2021-09-10 20:00:06 +0900
commitdddc618d3076de2c1b27d01f106bf0bf126d4677 (patch)
tree57b13edb169ca85ce5eac81dee47147bbbefc35c
parentfd12bc1896bd4a78b9ff376fd685a009254b153f (diff)
downloadruby-dddc618d3076de2c1b27d01f106bf0bf126d4677.tar.gz
suppress GCC's -Wsuggest-attribute=format
I was not aware of this because I use clang these days.
-rw-r--r--compile.c4
-rw-r--r--error.c5
-rw-r--r--include/ruby/missing.h2
-rw-r--r--internal/error.h3
-rw-r--r--vm_core.h1
-rw-r--r--vm_debug.h1
6 files changed, 14 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index 3d1ec62469..38a6860ea0 100644
--- a/compile.c
+++ b/compile.c
@@ -353,9 +353,9 @@ static void iseq_add_setlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, const NOD
/* error */
#if CPDEBUG > 0
-NORETURN(static void append_compile_error(const rb_iseq_t *iseq, int line, const char *fmt, ...));
+RBIMPL_ATTR_NORETURN()
#endif
-
+RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 3, 4)
static void
append_compile_error(const rb_iseq_t *iseq, int line, const char *fmt, ...)
{
diff --git a/error.c b/error.c
index 6cd64bc280..b589384303 100644
--- a/error.c
+++ b/error.c
@@ -108,6 +108,7 @@ err_position_0(char *buf, long len, const char *file, int line)
}
}
+RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 5, 0)
static VALUE
err_vcatf(VALUE str, const char *pre, const char *file, int line,
const char *fmt, va_list args)
@@ -344,6 +345,7 @@ rb_write_warning_str(VALUE str)
rb_warning_warn(rb_mWarning, str);
}
+RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 4, 0)
static VALUE
warn_vsprintf(rb_encoding *enc, const char *file, int line, const char *fmt, va_list args)
{
@@ -396,6 +398,7 @@ rb_category_compile_warn(rb_warning_category_t category, const char *file, int l
rb_warn_category(str, rb_warning_category_to_name(category));
}
+RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 2, 0)
static VALUE
warning_string(rb_encoding *enc, const char *fmt, va_list args)
{
@@ -716,6 +719,7 @@ postscript_dump(FILE *out)
bug_important_message(out, msg, msglen);
}
+RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 2, 0)
static void
bug_report_begin_valist(FILE *out, const char *fmt, va_list args)
{
@@ -779,6 +783,7 @@ die(void)
abort();
}
+RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 1, 0)
void
rb_bug_without_die(const char *fmt, va_list args)
{
diff --git a/include/ruby/missing.h b/include/ruby/missing.h
index 145c5a125c..1e97e294f1 100644
--- a/include/ruby/missing.h
+++ b/include/ruby/missing.h
@@ -38,6 +38,7 @@
#endif
#include "ruby/internal/dllexport.h"
+#include "ruby/internal/attr/format.h"
#ifndef M_PI
# define M_PI 3.14159265358979323846
@@ -211,6 +212,7 @@ RUBY_EXTERN int ruby_close(int);
#endif
#ifndef HAVE_SETPROCTITLE
+RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 1, 2)
RUBY_EXTERN void setproctitle(const char *fmt, ...);
#endif
diff --git a/internal/error.h b/internal/error.h
index 9bf3ba3fa3..11601858f4 100644
--- a/internal/error.h
+++ b/internal/error.h
@@ -43,6 +43,7 @@ extern long rb_backtrace_length_limit;
extern VALUE rb_eEAGAIN;
extern VALUE rb_eEWOULDBLOCK;
extern VALUE rb_eEINPROGRESS;
+RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 3, 0)
void rb_report_bug_valist(VALUE file, int line, const char *fmt, va_list args);
NORETURN(void rb_async_bug_errno(const char *,int));
const char *rb_builtin_type_name(int t);
@@ -114,6 +115,7 @@ void rb_deprecated_method_to_be_removed(const char *);
# define RBIMPL_TODO0(x)
#endif
#define RBIMPL_TODO(message) RBIMPL_TODO0("TODO: " message)
+RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 6, 0)
VALUE rb_syntax_error_append(VALUE, VALUE, int, int, rb_encoding*, const char*, va_list);
PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
@@ -124,6 +126,7 @@ VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method);
VALUE rb_nomethod_err_new(VALUE mesg, VALUE recv, VALUE method, VALUE args, int priv);
VALUE rb_key_err_new(VALUE mesg, VALUE recv, VALUE name);
PRINTF_ARGS(VALUE rb_warning_string(const char *fmt, ...), 1, 2);
+RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 2, 0)
NORETURN(void rb_vraise(VALUE, const char *, va_list));
NORETURN(static inline void rb_raise_cstr(VALUE etype, const char *mesg));
NORETURN(static inline void rb_raise_cstr_i(VALUE etype, VALUE mesg));
diff --git a/vm_core.h b/vm_core.h
index 2962356212..58243b133e 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -1661,6 +1661,7 @@ extern void rb_vmdebug_debug_print_post(const rb_execution_context_t *ec, const
#define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_EC(), (cfp))
void rb_vm_bugreport(const void *);
typedef void (*ruby_sighandler_t)(int);
+RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 4, 5)
NORETURN(void rb_bug_for_fatal_signal(ruby_sighandler_t default_sighandler, int sig, const void *, const char *fmt, ...));
/* functions about thread/vm execution */
diff --git a/vm_debug.h b/vm_debug.h
index a3631c0309..2840e70646 100644
--- a/vm_debug.h
+++ b/vm_debug.h
@@ -87,6 +87,7 @@ extern enum ruby_debug_log_mode {
ruby_debug_log_file = 0x04,
} ruby_debug_log_mode;
+RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 4, 5)
void ruby_debug_log(const char *file, int line, const char *func_name, const char *fmt, ...);
void ruby_debug_log_print(unsigned int n);
bool ruby_debug_log_filter(const char *func_name);