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

ruby-changes:66092

From: Nobuyoshi <ko1@a...>
Date: Fri, 7 May 2021 00:13:43 +0900 (JST)
Subject: [ruby-changes:66092] 0bbab1e515 (master): Protoized old pre-ANSI K&R style declarations and definitions

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

From 0bbab1e5151c3396ebe544d09cad997cd9cb5e3b Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 7 May 2021 00:04:36 +0900
Subject: Protoized old pre-ANSI K&R style declarations and definitions

---
 dln.c                        | 16 ++++++++--------
 eval_jump.c                  |  2 +-
 gc.c                         |  4 ++--
 hash.c                       |  2 +-
 include/ruby/thread_native.h |  2 +-
 internal/gc.h                |  2 +-
 thread_pthread.h             |  2 +-
 vm_insnhelper.c              |  4 ++--
 vm_method.c                  |  2 +-
 vsnprintf.c                  |  6 ++++--
 10 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/dln.c b/dln.c
index b050898..ac09430 100644
--- a/dln.c
+++ b/dln.c
@@ -312,7 +312,7 @@ dln_load(const char *file) https://github.com/ruby/ruby/blob/trunk/dln.c#L312
     HINSTANCE handle;
     WCHAR *winfile;
     char message[1024];
-    void (*init_fct)();
+    void (*init_fct)(void);
     char *buf;
 
     /* Load the file as an object one */
@@ -341,7 +341,7 @@ dln_load(const char *file) https://github.com/ruby/ruby/blob/trunk/dln.c#L341
     }
 #endif
 
-    if ((init_fct = (void(*)())GetProcAddress(handle, buf)) == NULL) {
+    if ((init_fct = (void(*)(void))GetProcAddress(handle, buf)) == NULL) {
 	dln_loaderror("%s - %s\n%s", dln_strerror(), buf, file);
     }
 
@@ -358,7 +358,7 @@ dln_load(const char *file) https://github.com/ruby/ruby/blob/trunk/dln.c#L358
 #define DLN_DEFINED
     {
 	void *handle;
-	void (*init_fct)();
+	void (*init_fct)(void);
 
 #ifndef RTLD_LAZY
 # define RTLD_LAZY 1
@@ -393,7 +393,7 @@ dln_load(const char *file) https://github.com/ruby/ruby/blob/trunk/dln.c#L393
 	}
 # endif
 
-	init_fct = (void(*)())(VALUE)dlsym(handle, buf);
+	init_fct = (void(*)(void))(VALUE)dlsym(handle, buf);
 	if (init_fct == NULL) {
 	    const size_t errlen = strlen(error = dln_strerror()) + 1;
 	    error = memcpy(ALLOCA_N(char, errlen), error, errlen);
@@ -412,7 +412,7 @@ dln_load(const char *file) https://github.com/ruby/ruby/blob/trunk/dln.c#L412
     {
 	shl_t lib = NULL;
 	int flags;
-	void (*init_fct)();
+	void (*init_fct)(void);
 
 	flags = BIND_DEFERRED;
 	lib = shl_load(file, flags, 0);
@@ -436,9 +436,9 @@ dln_load(const char *file) https://github.com/ruby/ruby/blob/trunk/dln.c#L436
 #if defined(_AIX)
 #define DLN_DEFINED
     {
-	void (*init_fct)();
+	void (*init_fct)(void);
 
-	init_fct = (void(*)())load((char*)file, 1, 0);
+	init_fct = (void(*)(void))load((char*)file, 1, 0);
 	if (init_fct == NULL) {
 	    aix_loaderror(file);
 	}
@@ -467,7 +467,7 @@ dln_load(const char *file) https://github.com/ruby/ruby/blob/trunk/dln.c#L467
 	/* "file" is module file name .
 	   "buf" is pointer to initial function name with "_" . */
 
-	void (*init_fct)();
+	void (*init_fct)(void);
 
 
 	dyld_result = NSCreateObjectFileImageFromFile(file, &obj_file);
diff --git a/eval_jump.c b/eval_jump.c
index 75d4ad0..2ea73b0 100644
--- a/eval_jump.c
+++ b/eval_jump.c
@@ -48,7 +48,7 @@ rb_f_at_exit(VALUE _) https://github.com/ruby/ruby/blob/trunk/eval_jump.c#L48
 }
 
 struct end_proc_data {
-    void (*func) ();
+    void (*func) (VALUE);
     VALUE data;
     struct end_proc_data *next;
 };
diff --git a/gc.c b/gc.c
index cdc8f4f..3adc526 100644
--- a/gc.c
+++ b/gc.c
@@ -2382,7 +2382,7 @@ rvargc_find_region(size_t size, rb_ractor_t *cr, RVALUE *freelist) https://github.com/ruby/ruby/blob/trunk/gc.c#L2382
 #endif
 
 int
-rb_slot_size()
+rb_slot_size(void)
 {
     return sizeof(RVALUE);
 }
@@ -4592,7 +4592,7 @@ obj_memsize_of(VALUE obj, int use_all_types) https://github.com/ruby/ruby/blob/trunk/gc.c#L4592
       case T_HASH:
         if (RHASH_AR_TABLE_P(obj)) {
             if (RHASH_AR_TABLE(obj) != NULL) {
-                size_t rb_hash_ar_table_size();
+                size_t rb_hash_ar_table_size(void);
                 size += rb_hash_ar_table_size();
             }
 	}
diff --git a/hash.c b/hash.c
index ce0e72a..9b98739 100644
--- a/hash.c
+++ b/hash.c
@@ -4820,7 +4820,7 @@ extern char **environ; https://github.com/ruby/ruby/blob/trunk/hash.c#L4820
 #endif
 
 static inline rb_encoding *
-env_encoding()
+env_encoding(void)
 {
 #ifdef _WIN32
     return rb_utf8_encoding();
diff --git a/include/ruby/thread_native.h b/include/ruby/thread_native.h
index 7e08c2e..343c02c 100644
--- a/include/ruby/thread_native.h
+++ b/include/ruby/thread_native.h
@@ -47,7 +47,7 @@ typedef pthread_cond_t rb_nativethread_cond_t; https://github.com/ruby/ruby/blob/trunk/include/ruby/thread_native.h#L47
 
 RUBY_SYMBOL_EXPORT_BEGIN
 
-rb_nativethread_id_t rb_nativethread_self();
+rb_nativethread_id_t rb_nativethread_self(void);
 
 void rb_nativethread_lock_initialize(rb_nativethread_lock_t *lock);
 void rb_nativethread_lock_destroy(rb_nativethread_lock_t *lock);
diff --git a/internal/gc.h b/internal/gc.h
index cd87264..86a2512 100644
--- a/internal/gc.h
+++ b/internal/gc.h
@@ -114,7 +114,7 @@ void rb_gc_mark_vm_stack_values(long n, const VALUE *values); https://github.com/ruby/ruby/blob/trunk/internal/gc.h#L114
 void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2));
 void *ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_RETURNS_NONNULL RUBY_ATTR_ALLOC_SIZE((2, 3));
 void ruby_sized_xfree(void *x, size_t size);
-int rb_slot_size();
+int rb_slot_size(void);
 RUBY_SYMBOL_EXPORT_END
 
 MJIT_SYMBOL_EXPORT_BEGIN
diff --git a/thread_pthread.h b/thread_pthread.h
index 8b7583d..2ac3540 100644
--- a/thread_pthread.h
+++ b/thread_pthread.h
@@ -102,7 +102,7 @@ RUBY_SYMBOL_EXPORT_BEGIN https://github.com/ruby/ruby/blob/trunk/thread_pthread.h#L102
 #ifdef RB_THREAD_LOCAL_SPECIFIER
   #ifdef __APPLE__
     // on Darwin, TLS can not be accessed across .so
-    struct rb_execution_context_struct *rb_current_ec();
+    struct rb_execution_context_struct *rb_current_ec(void);
     void rb_current_ec_set(struct rb_execution_context_struct *);
   #else
     RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct *ruby_current_ec;
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 840bd49..171b0f4 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1857,7 +1857,7 @@ vm_search_method(VALUE cd_owner, struct rb_call_data *cd, VALUE recv) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1857
 }
 
 static inline int
-check_cfunc(const rb_callable_method_entry_t *me, VALUE (*func)())
+check_cfunc(const rb_callable_method_entry_t *me, VALUE (*func)(ANYARGS))
 {
     if (! me) {
         return false;
@@ -1876,7 +1876,7 @@ check_cfunc(const rb_callable_method_entry_t *me, VALUE (*func)()) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1876
 }
 
 static inline int
-vm_method_cfunc_is(const rb_iseq_t *iseq, CALL_DATA cd, VALUE recv, VALUE (*func)())
+vm_method_cfunc_is(const rb_iseq_t *iseq, CALL_DATA cd, VALUE recv, VALUE (*func)(ANYARGS))
 {
     VM_ASSERT(iseq != NULL);
     const struct rb_callcache *cc = vm_search_method((VALUE)iseq, cd, recv);
diff --git a/vm_method.c b/vm_method.c
index ffb290d..be0c1ef 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -416,7 +416,7 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/vm_method.c#L416
 }
 
 static void
-setup_method_cfunc_struct(rb_method_cfunc_t *cfunc, VALUE (*func)(), int argc)
+setup_method_cfunc_struct(rb_method_cfunc_t *cfunc, VALUE (*func)(ANYARGS), int argc)
 {
     cfunc->func = func;
     cfunc->argc = argc;
diff --git a/vsnprintf.c b/vsnprintf.c
index 90c827f..8bfa0c1 100644
--- a/vsnprintf.c
+++ b/vsnprintf.c
@@ -166,6 +166,8 @@ struct __sbuf { https://github.com/ruby/ruby/blob/trunk/vsnprintf.c#L166
  *
  * NB: see WARNING above before changing the layout of this structure!
  */
+struct __suio;
+
 typedef	struct __sFILE {
 	unsigned char *_p;	/* current position in (some) buffer */
 #if 0
@@ -178,8 +180,8 @@ typedef	struct __sFILE { https://github.com/ruby/ruby/blob/trunk/vsnprintf.c#L180
 #if 0
 	size_t	_lbfsize;	/* 0 or -_bf._size, for inline putc */
 #endif
-	int	(*vwrite)(/* struct __sFILE*, struct __suio * */);
-	const char *(*vextra)(/* struct __sFILE*, size_t, void*, long*, int */);
+	int	(*vwrite)(struct __sFILE*, struct __suio *);
+	const char *(*vextra)(struct __sFILE*, size_t, void*, long*, int);
 } FILE;
 
 
-- 
cgit v1.1


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

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