ruby-changes:67960
From: Nobuyoshi <ko1@a...>
Date: Mon, 13 Sep 2021 00:51:23 +0900 (JST)
Subject: [ruby-changes:67960] c7dce12eb9 (master): [ruby/openssl] Suppress printf format warnings
https://git.ruby-lang.org/ruby.git/commit/?id=c7dce12eb9 From c7dce12eb9e07f6ae35fc767760b862c10317e11 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 12 Sep 2021 00:44:18 +0900 Subject: [ruby/openssl] Suppress printf format warnings * Add `printf` format attribute to `ossl_raise`. * Fix a format specifier in `config_load_bio`. * Use `ASSUME` for the unreachable condition. https://github.com/ruby/openssl/commit/41da2955db --- ext/openssl/ossl.c | 2 ++ ext/openssl/ossl.h | 2 +- ext/openssl/ossl_config.c | 2 +- ext/openssl/ossl_pkey_ec.c | 6 ++++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c index cf070ef..91cb54b 100644 --- a/ext/openssl/ossl.c +++ b/ext/openssl/ossl.c @@ -265,6 +265,8 @@ ossl_to_der_if_possible(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl.c#L265 return obj; } +PRINTF_ARGS(static VALUE ossl_make_error(VALUE exc, const char *fmt, va_list args), 2, 0); + /* * Errors */ diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h index 577eb6d..07d789e 100644 --- a/ext/openssl/ossl.h +++ b/ext/openssl/ossl.h @@ -120,7 +120,7 @@ int ossl_pem_passwd_cb(char *, int, int, void *); https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl.h#L120 /* * ERRor messages */ -NORETURN(void ossl_raise(VALUE, const char *, ...)); +PRINTF_ARGS(NORETURN(void ossl_raise(VALUE, const char *, ...)), 2, 3); /* Clear OpenSSL error queue. If dOSSL is set, rb_warn() them. */ void ossl_clear_error(void); diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c index 21c327b..0bac027 100644 --- a/ext/openssl/ossl_config.c +++ b/ext/openssl/ossl_config.c @@ -60,7 +60,7 @@ config_load_bio(CONF *conf, BIO *bio) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_config.c#L60 if (eline <= 0) ossl_raise(eConfigError, "wrong config format"); else - ossl_raise(eConfigError, "error in line %d", eline); + ossl_raise(eConfigError, "error in line %ld", eline); } BIO_free(bio); diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c index 9b461cb..26c627f 100644 --- a/ext/openssl/ossl_pkey_ec.c +++ b/ext/openssl/ossl_pkey_ec.c @@ -596,8 +596,10 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_pkey_ec.c#L596 ossl_raise(rb_eArgError, "wrong number of arguments"); } - if (group == NULL) - ossl_raise(eEC_GROUP, ""); +#if !defined(LIKELY) && !defined(RB_LIKELY) +#define LIKELY(x) (x) +#endif + ASSUME(group); RTYPEDDATA_DATA(self) = group; return self; -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/