[前][次][番号順一覧][スレッド一覧]

ruby-changes:67848

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Fri, 10 Sep 2021 20:02:40 +0900 (JST)
Subject: [ruby-changes:67848] dddc618d30 (master): suppress GCC's -Wsuggest-attribute=format

https://git.ruby-lang.org/ruby.git/commit/?id=dddc618d30

From dddc618d3076de2c1b27d01f106bf0bf126d4677 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Thu, 9 Sep 2021 14:05:11 +0900
Subject: suppress GCC's -Wsuggest-attribute=format

I was not aware of this because I use clang these days.
---
 compile.c              | 4 ++--
 error.c                | 5 +++++
 include/ruby/missing.h | 2 ++
 internal/error.h       | 3 +++
 vm_core.h              | 1 +
 vm_debug.h             | 1 +
 6 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/compile.c b/compile.c
index 3d1ec62..38a6860 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 https://github.com/ruby/ruby/blob/trunk/compile.c#L353
 
 /* 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 6cd64bc..b589384 100644
--- a/error.c
+++ b/error.c
@@ -108,6 +108,7 @@ err_position_0(char *buf, long len, const char *file, int line) https://github.com/ruby/ruby/blob/trunk/error.c#L108
     }
 }
 
+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) https://github.com/ruby/ruby/blob/trunk/error.c#L345
     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 https://github.com/ruby/ruby/blob/trunk/error.c#L398
     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) https://github.com/ruby/ruby/blob/trunk/error.c#L719
     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) https://github.com/ruby/ruby/blob/trunk/error.c#L783
     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 145c5a1..1e97e29 100644
--- a/include/ruby/missing.h
+++ b/include/ruby/missing.h
@@ -38,6 +38,7 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/missing.h#L38
 #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); https://github.com/ruby/ruby/blob/trunk/include/ruby/missing.h#L212
 #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 9bf3ba3..1160185 100644
--- a/internal/error.h
+++ b/internal/error.h
@@ -43,6 +43,7 @@ extern long rb_backtrace_length_limit; https://github.com/ruby/ruby/blob/trunk/internal/error.h#L43
 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 *); https://github.com/ruby/ruby/blob/trunk/internal/error.h#L115
 # 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); https://github.com/ruby/ruby/blob/trunk/internal/error.h#L126
 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 2962356..58243b1 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 https://github.com/ruby/ruby/blob/trunk/vm_core.h#L1661
 #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 a3631c0..2840e70 100644
--- a/vm_debug.h
+++ b/vm_debug.h
@@ -87,6 +87,7 @@ extern enum ruby_debug_log_mode { https://github.com/ruby/ruby/blob/trunk/vm_debug.h#L87
     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);
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]