Skip to content

Commit

Permalink
protoize no-arguments functions
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Sep 30, 2014
1 parent cf5450b commit 28b9f11
Show file tree
Hide file tree
Showing 63 changed files with 104 additions and 99 deletions.
2 changes: 1 addition & 1 deletion dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -2248,7 +2248,7 @@ dir_s_home(int argc, VALUE *argv, VALUE obj)
*
*/
VALUE
rb_file_directory_p()
rb_file_directory_p(void)
{
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ rb_mod_prepend(int argc, VALUE *argv, VALUE module)
}

static VALUE
hidden_identity_hash_new()
hidden_identity_hash_new(void)
{
VALUE hash = rb_hash_new();

Expand Down
4 changes: 2 additions & 2 deletions ext/digest/md5/md5.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
*/
#include <string.h>
int
main()
main(void)
{
static const char *const test[7*2] = {
"", "d41d8cd98f00b204e9800998ecf8427e",
Expand Down Expand Up @@ -102,7 +102,7 @@ main()
#ifdef COMPUTE_T_VALUES
#include <math.h>
int
main()
main(void)
{
int i;
for (i = 1; i <= 64; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion ext/digest/md5/md5init.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static const rb_digest_metadata_t md5 = {
* RFC1321.
*/
void
Init_md5()
Init_md5(void)
{
VALUE mDigest, cDigest_Base, cDigest_MD5;

Expand Down
2 changes: 1 addition & 1 deletion ext/digest/rmd160/rmd160init.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static const rb_digest_metadata_t rmd160 = {
* Bosselaers, and Bart Preneel.
*/
void
Init_rmd160()
Init_rmd160(void)
{
VALUE mDigest, cDigest_Base, cDigest_RMD160;

Expand Down
2 changes: 1 addition & 1 deletion ext/digest/sha1/sha1init.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static const rb_digest_metadata_t sha1 = {
* Technology), described in FIPS PUB 180-1.
*/
void
Init_sha1()
Init_sha1(void)
{
VALUE mDigest, cDigest_Base, cDigest_SHA1;

Expand Down
2 changes: 1 addition & 1 deletion ext/digest/sha2/sha2init.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ FOREACH_BITLEN(DEFINE_ALGO_METADATA)
* Standards and Technology), described in FIPS PUB 180-2.
*/
void
Init_sha2()
Init_sha2(void)
{
VALUE mDigest, cDigest_Base;
ID id_metadata;
Expand Down
11 changes: 8 additions & 3 deletions ext/dl/callback/mkcallback.rb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,15 @@ def foreach_proc_entry
def gencallback(ty, calltype, proc_entry, argc, n)
dltype = DLTYPE[ty]
ret = dltype[:conv]
if argc == 0
args = "void"
else
args = (0...argc).collect{|i| "DLSTACK_TYPE stack#{i}"}.join(", ")
end
src = <<-EOS
#{calltype == STDCALL ? "\n#ifdef FUNC_STDCALL" : ""}
static #{dltype[:type]}
FUNC_#{calltype.upcase}(#{func_name(ty,argc,n,calltype)})(#{(0...argc).collect{|i| "DLSTACK_TYPE stack#{i}"}.join(", ")})
FUNC_#{calltype.upcase}(#{func_name(ty,argc,n,calltype)})(#{args})
{
VALUE #{ret ? "ret, " : ""}cb#{argc > 0 ? ", args[#{argc}]" : ""};
#{
Expand Down Expand Up @@ -177,7 +182,7 @@ def gen_callback_file(ty)
yield body
body << <<-EOS
void
#{initname}()
#{initname}(void)
{
#{gen_push_proc_ary(ty, "rb_DLCdeclCallbackProcs")}
#{gen_push_addr_ary(ty, "rb_DLCdeclCallbackAddrs", CDECL)}
Expand All @@ -201,7 +206,7 @@ def gen_callback_file(ty)
end
end
}
$out << "void #{initname}();\n"
$out << "void #{initname}(void);\n"
callbacks << [filename, body]
end

Expand Down
2 changes: 1 addition & 1 deletion ext/fcntl/fcntl.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pack up your own arguments to pass as args for locking functions, etc.
*
*/
void
Init_fcntl()
Init_fcntl(void)
{
VALUE mFcntl = rb_define_module("Fcntl");
#ifdef F_DUPFD
Expand Down
2 changes: 1 addition & 1 deletion ext/fiddle/closure.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ to_i(VALUE self)
}

void
Init_fiddle_closure()
Init_fiddle_closure(void)
{
#if 0
mFiddle = rb_define_module("Fiddle"); /* let rdoc know about mFiddle */
Expand Down
2 changes: 1 addition & 1 deletion ext/io/wait/wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ io_wait_writable(int argc, VALUE *argv, VALUE io)
*/

void
Init_wait()
Init_wait(void)
{
rb_define_method(rb_cIO, "nread", io_nread, 0);
rb_define_method(rb_cIO, "ready?", io_ready_p, 0);
Expand Down
8 changes: 4 additions & 4 deletions ext/nkf/nkf-utf8/nkf.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ nkf_enc_find(const char *name)

#ifdef DEFAULT_CODE_LOCALE
static const char*
nkf_locale_charmap()
nkf_locale_charmap(void)
{
#ifdef HAVE_LANGINFO_H
return nl_langinfo(CODESET);
Expand Down Expand Up @@ -802,7 +802,7 @@ nkf_locale_charmap()
}

static nkf_encoding*
nkf_locale_encoding()
nkf_locale_encoding(void)
{
nkf_encoding *enc = 0;
const char *encname = nkf_locale_charmap();
Expand All @@ -813,13 +813,13 @@ nkf_locale_encoding()
#endif /* DEFAULT_CODE_LOCALE */

static nkf_encoding*
nkf_utf8_encoding()
nkf_utf8_encoding(void)
{
return &nkf_encoding_table[UTF_8];
}

static nkf_encoding*
nkf_default_encoding()
nkf_default_encoding(void)
{
nkf_encoding *enc = 0;
#ifdef DEFAULT_CODE_LOCALE
Expand Down
2 changes: 1 addition & 1 deletion ext/nkf/nkf.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
*/

void
Init_nkf()
Init_nkf(void)
{
VALUE mNKF = rb_define_module("NKF");

Expand Down
4 changes: 2 additions & 2 deletions ext/openssl/ossl.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ ossl_exc_new(VALUE exc, const char *fmt, ...)
* Any errors you see here are probably due to a bug in ruby's OpenSSL implementation.
*/
VALUE
ossl_get_errors()
ossl_get_errors(void)
{
VALUE ary;
long e;
Expand Down Expand Up @@ -1034,7 +1034,7 @@ static void Init_ossl_locks(void)
*
*/
void
Init_openssl()
Init_openssl(void)
{
/*
* Init timezone info
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/ossl_asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@ OSSL_ASN1_IMPL_FACTORY_METHOD(Set)
OSSL_ASN1_IMPL_FACTORY_METHOD(EndOfContent)

void
Init_ossl_asn1()
Init_ossl_asn1(void)
{
VALUE ary;
int i;
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/ossl_bn.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ ossl_bn_is_prime_fasttest(int argc, VALUE *argv, VALUE self)
* (NOTE: ordering of methods is the same as in 'man bn')
*/
void
Init_ossl_bn()
Init_ossl_bn(void)
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/ossl_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ GetConfigPtr(VALUE obj)
* INIT
*/
void
Init_ossl_config()
Init_ossl_config(void)
{
char *default_config_file;
eConfigError = rb_define_class_under(mOSSL, "ConfigError", eOSSLError);
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/ossl_digest.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ ossl_digest_block_length(VALUE self)
* INIT
*/
void
Init_ossl_digest()
Init_ossl_digest(void)
{
rb_require("digest");

Expand Down
4 changes: 2 additions & 2 deletions ext/openssl/ossl_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ ossl_engine_inspect(VALUE self)
#define DefEngineConst(x) rb_define_const(cEngine, #x, INT2NUM(ENGINE_##x))

void
Init_ossl_engine()
Init_ossl_engine(void)
{
cEngine = rb_define_class_under(mOSSL, "Engine", rb_cObject);
eEngineError = rb_define_class_under(cEngine, "EngineError", eOSSLError);
Expand Down Expand Up @@ -578,7 +578,7 @@ Init_ossl_engine()
}
#else
void
Init_ossl_engine()
Init_ossl_engine(void)
{
}
#endif
4 changes: 2 additions & 2 deletions ext/openssl/ossl_hmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ ossl_hmac_s_hexdigest(VALUE klass, VALUE digest, VALUE key, VALUE data)
* INIT
*/
void
Init_ossl_hmac()
Init_ossl_hmac(void)
{
#if 0
/* :nodoc: */
Expand Down Expand Up @@ -357,7 +357,7 @@ Init_ossl_hmac()
#else /* NO_HMAC */
# warning >>> OpenSSL is compiled without HMAC support <<<
void
Init_ossl_hmac()
Init_ossl_hmac(void)
{
rb_warning("HMAC is not available: OpenSSL is compiled without HMAC.");
}
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/ossl_ns_spki.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ ossl_spki_verify(VALUE self, VALUE key)
*/

void
Init_ossl_ns_spki()
Init_ossl_ns_spki(void)
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
Expand Down
4 changes: 2 additions & 2 deletions ext/openssl/ossl_ocsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ ossl_ocspcid_get_serial(VALUE self)
}

void
Init_ossl_ocsp()
Init_ossl_ocsp(void)
{
/*
* OpenSSL::OCSP implements Online Certificate Status Protocol requests
Expand Down Expand Up @@ -1182,7 +1182,7 @@ Init_ossl_ocsp()

#else /* ! OSSL_OCSP_ENABLED */
void
Init_ossl_ocsp()
Init_ossl_ocsp(void)
{
}
#endif
2 changes: 1 addition & 1 deletion ext/openssl/ossl_pkcs12.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ ossl_pkcs12_to_der(VALUE self)
}

void
Init_ossl_pkcs12()
Init_ossl_pkcs12(void)
{
/*
* Defines a file format commonly used to store private keys with
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/ossl_pkcs5.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ossl_pkcs5_pbkdf2_hmac_sha1(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALU
#endif

void
Init_ossl_pkcs5()
Init_ossl_pkcs5(void)
{
/*
* Password-based Encryption
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/ossl_pkcs7.c
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ ossl_pkcs7ri_get_enc_key(VALUE self)
* INIT
*/
void
Init_ossl_pkcs7()
Init_ossl_pkcs7(void)
{
cPKCS7 = rb_define_class_under(mOSSL, "PKCS7", rb_cObject);
ePKCS7Error = rb_define_class_under(cPKCS7, "PKCS7Error", eOSSLError);
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/ossl_pkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ ossl_pkey_verify(VALUE self, VALUE digest, VALUE sig, VALUE data)
* INIT
*/
void
Init_ossl_pkey()
Init_ossl_pkey(void)
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
Expand Down
4 changes: 2 additions & 2 deletions ext/openssl/ossl_pkey_dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ ossl_create_dh(unsigned char *p, size_t plen, unsigned char *g, size_t glen)
* INIT
*/
void
Init_ossl_dh()
Init_ossl_dh(void)
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL and mPKey */
Expand Down Expand Up @@ -660,7 +660,7 @@ Init_ossl_dh()

#else /* defined NO_DH */
void
Init_ossl_dh()
Init_ossl_dh(void)
{
}
#endif /* NO_DH */
4 changes: 2 additions & 2 deletions ext/openssl/ossl_pkey_dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ OSSL_PKEY_BN(dsa, priv_key)
* INIT
*/
void
Init_ossl_dsa()
Init_ossl_dsa(void)
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL and mPKey */
Expand Down Expand Up @@ -617,7 +617,7 @@ Init_ossl_dsa()

#else /* defined NO_DSA */
void
Init_ossl_dsa()
Init_ossl_dsa(void)
{
}
#endif /* NO_DSA */
4 changes: 2 additions & 2 deletions ext/openssl/ossl_pkey_rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ OSSL_PKEY_BN(rsa, iqmp)
#define DefRSAConst(x) rb_define_const(cRSA, #x,INT2FIX(RSA_##x))

void
Init_ossl_rsa()
Init_ossl_rsa(void)
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL and mPKey */
Expand Down Expand Up @@ -694,7 +694,7 @@ Init_ossl_rsa()

#else /* defined NO_RSA */
void
Init_ossl_rsa()
Init_ossl_rsa(void)
{
}
#endif /* NO_RSA */
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/ossl_rand.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ ossl_rand_status(VALUE self)
* INIT
*/
void
Init_ossl_rand()
Init_ossl_rand(void)
{
#if 0
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
Expand Down
Loading

0 comments on commit 28b9f11

Please sign in to comment.