The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #11764 from MisterDA/missing-prototypes

Don't use old-style unprototyped C functions

authored by

Xavier Leroy and committed by
GitHub
026ce3af 7756d4b6

+57 -64
+3
Changes
··· 21 21 - #11691, #11706: use __asm__ instead of asm for strict ISO C conformance 22 22 (Xavier Leroy, report by Gregg Reynolds , review by Sadiq Jaffer) 23 23 24 + - #11764: add prototypes to old-style C function definitions and declarations 25 + (Antonin Décimo, review by Xavier Leroy) 26 + 24 27 ### Code generation and optimizations: 25 28 26 29 - #8998, #11321, #11430: change mangling of OCaml long identifiers
+2 -2
otherlibs/systhreads/st_stubs.c
··· 223 223 224 224 CAMLprim value caml_thread_cleanup(value unit); 225 225 226 - static void reset_active() 226 + static void reset_active(void) 227 227 { 228 228 Active_thread = NULL; 229 229 /* If no other OCaml thread remains, ask the tick thread to stop ··· 550 550 return 0; 551 551 } 552 552 553 - static int create_tick_thread() 553 + static int create_tick_thread(void) 554 554 { 555 555 int err; 556 556 #ifdef POSIX_SIGNALS
+1 -2
otherlibs/unix/bind_win32.c
··· 17 17 #include "unixsupport.h" 18 18 #include "socketaddr.h" 19 19 20 - CAMLprim value caml_unix_bind(socket, address) 21 - value socket, address; 20 + CAMLprim value caml_unix_bind(value socket, value address) 22 21 { 23 22 int ret; 24 23 union sock_addr_union addr;
+1 -2
otherlibs/unix/connect_win32.c
··· 18 18 #include "unixsupport.h" 19 19 #include "socketaddr.h" 20 20 21 - CAMLprim value caml_unix_connect(socket, address) 22 - value socket, address; 21 + CAMLprim value caml_unix_connect(value socket, value address) 23 22 { 24 23 SOCKET s = Socket_val(socket); 25 24 union sock_addr_union addr;
+1 -1
otherlibs/unix/fork.c
··· 28 28 } 29 29 30 30 /* Post-fork tasks to be carried out in the child */ 31 - void caml_atfork_child() { 31 + void caml_atfork_child(void) { 32 32 caml_runtime_events_post_fork(); 33 33 CAML_EV_LIFECYCLE(EV_FORK_CHILD, 0); 34 34 }
+1 -2
otherlibs/unix/listen_win32.c
··· 16 16 #include <caml/mlvalues.h> 17 17 #include "unixsupport.h" 18 18 19 - CAMLprim value caml_unix_listen(sock, backlog) 20 - value sock, backlog; 19 + CAMLprim value caml_unix_listen(value sock, value backlog) 21 20 { 22 21 if (listen(Socket_val(sock), Int_val(backlog)) == -1) { 23 22 caml_win32_maperr(WSAGetLastError());
+2 -4
otherlibs/unix/nonblock.c
··· 17 17 #include <caml/signals.h> 18 18 #include "unixsupport.h" 19 19 20 - CAMLprim value caml_unix_set_nonblock(socket) 21 - value socket; 20 + CAMLprim value caml_unix_set_nonblock(value socket) 22 21 { 23 22 u_long non_block = 1; 24 23 ··· 30 29 return Val_unit; 31 30 } 32 31 33 - CAMLprim value caml_unix_clear_nonblock(socket) 34 - value socket; 32 + CAMLprim value caml_unix_clear_nonblock(value socket) 35 33 { 36 34 u_long non_block = 0; 37 35
+1 -2
otherlibs/unix/shutdown_win32.c
··· 20 20 0, 1, 2 21 21 }; 22 22 23 - CAMLprim value caml_unix_shutdown(sock, cmd) 24 - value sock, cmd; 23 + CAMLprim value caml_unix_shutdown(value sock, value cmd) 25 24 { 26 25 if (shutdown(Socket_val(sock), 27 26 shutdown_command_table[Int_val(cmd)]) == -1) {
+1 -2
otherlibs/unix/sleep_win32.c
··· 17 17 #include <caml/signals.h> 18 18 #include "unixsupport.h" 19 19 20 - CAMLprim value caml_unix_sleep(t) 21 - value t; 20 + CAMLprim value caml_unix_sleep(value t) 22 21 { 23 22 double d = Double_val(t); 24 23 caml_enter_blocking_section();
+2 -4
otherlibs/unix/startup.c
··· 22 22 23 23 value caml_win32_process_id; 24 24 25 - CAMLprim value caml_unix_startup(unit) 26 - value unit; 25 + CAMLprim value caml_unix_startup(value unit) 27 26 { 28 27 WSADATA wsaData; 29 28 int i; ··· 40 39 return Val_unit; 41 40 } 42 41 43 - CAMLprim value caml_unix_cleanup(unit) 44 - value unit; 42 + CAMLprim value caml_unix_cleanup(value unit) 45 43 { 46 44 caml_win32_worker_cleanup(); 47 45
+1 -2
otherlibs/unix/system.c
··· 24 24 #include <process.h> 25 25 #include <stdio.h> 26 26 27 - CAMLprim value caml_unix_system(cmd) 28 - value cmd; 27 + CAMLprim value caml_unix_system(value cmd) 29 28 { 30 29 int ret; 31 30 value st;
+1 -1
runtime/afl.c
··· 67 67 caml_fatal_error("writing to afl-fuzz"); 68 68 } 69 69 70 - static uint32_t afl_read() 70 + static uint32_t afl_read(void) 71 71 { 72 72 uint32_t msg; 73 73 if (read(FORKSRV_FD_READ, &msg, 4) != 4)
+1 -1
runtime/caml/platform.h
··· 33 33 34 34 /* Hint for busy-waiting loops */ 35 35 36 - Caml_inline void cpu_relax() { 36 + Caml_inline void cpu_relax(void) { 37 37 #ifdef __GNUC__ 38 38 #if defined(__x86_64__) || defined(__i386__) 39 39 __asm__ volatile("pause" ::: "memory");
+8 -8
runtime/caml/runtime_events.h
··· 145 145 /* Starts runtime_events. Needs to be called before 146 146 [caml_runtime_events_create_cursor]. Needs the runtime lock held to call and 147 147 will trigger a stop-the-world pause. Returns Val_unit. */ 148 - CAMLextern value caml_runtime_events_start(); 148 + CAMLextern value caml_runtime_events_start(void); 149 149 150 150 /* Pauses runtime_events if not currently paused otherwise does nothing. 151 151 No new events (other than the pause itself) will be written to the ring 152 152 buffer by this domain immediately and all other domains soon. Needs the 153 153 runtime lock held to call as a pause event is written during this call. 154 154 Returns Val_unit. */ 155 - CAMLextern value caml_runtime_events_pause(); 155 + CAMLextern value caml_runtime_events_pause(void); 156 156 157 157 /* Resumes runtime_events if currently paused otherwise does nothing. New events 158 158 (as well as a resume event) will be written to this domain immediately and 159 159 all other domains soon. Needs the runtime lock held to call as a resume event 160 160 is written during this call. Returns Val_unit. */ 161 - CAMLextern value caml_runtime_events_resume(); 161 + CAMLextern value caml_runtime_events_resume(void); 162 162 163 163 #ifdef CAML_INTERNALS 164 164 ··· 208 208 209 209 /* Set up runtime_events (and check if we need to start it immediately). 210 210 Called from startup* */ 211 - void caml_runtime_events_init(); 211 + void caml_runtime_events_init(void); 212 212 213 213 /* Destroy all allocated runtime_events structures and clear up the ring. 214 214 Called from [caml_sys_exit] */ 215 - void caml_runtime_events_destroy(); 215 + void caml_runtime_events_destroy(void); 216 216 217 217 /* Handle safely re-initialising the runtime_events structures 218 218 in a forked child */ 219 - void caml_runtime_events_post_fork(); 219 + void caml_runtime_events_post_fork(void); 220 220 221 221 /* Returns the location of the runtime_events for the current process if started 222 222 or NULL otherwise */ 223 - CAMLextern char_os* caml_runtime_events_current_location(); 223 + CAMLextern char_os* caml_runtime_events_current_location(void); 224 224 225 225 /* Functions for putting runtime data on to the runtime_events */ 226 226 void caml_ev_begin(ev_runtime_phase phase); ··· 234 234 function. Until then the buckets are just updated until flushed. 235 235 */ 236 236 void caml_ev_alloc(uint64_t sz); 237 - void caml_ev_alloc_flush(); 237 + void caml_ev_alloc_flush(void); 238 238 239 239 #endif /* CAML_INTERNALS */ 240 240
+2 -2
runtime/caml/signals.h
··· 74 74 value caml_process_pending_actions_with_root_exn (value extra_root); 75 75 76 76 void caml_init_signal_handling(void); 77 - void caml_init_signals(); 78 - void caml_terminate_signals(); 77 + void caml_init_signals(void); 78 + void caml_terminate_signals(void); 79 79 CAMLextern void * caml_init_signal_stack(void); 80 80 CAMLextern void caml_free_signal_stack(void *); 81 81
+6 -6
runtime/domain.c
··· 274 274 stw_domains.domains[stw_domains.participating_domains] = dom; 275 275 } 276 276 277 - static dom_internal* next_free_domain() { 277 + static dom_internal* next_free_domain(void) { 278 278 if (stw_domains.participating_domains == Max_domains) 279 279 return NULL; 280 280 ··· 411 411 domain, so they need no synchronization. 412 412 */ 413 413 414 - Caml_inline void check_minor_heap() { 414 + Caml_inline void check_minor_heap(void) { 415 415 caml_domain_state* domain_state = Caml_state; 416 416 CAMLassert(domain_state->young_ptr == domain_state->young_end); 417 417 ··· 433 433 && domain_state->young_end <= (value*)domain_self->minor_heap_area_end)); 434 434 } 435 435 436 - static void free_minor_heap() { 436 + static void free_minor_heap(void) { 437 437 caml_domain_state* domain_state = Caml_state; 438 438 439 439 caml_gc_log ("trying to free old minor heap: %" ··· 712 712 713 713 /* minor heap initialization and resizing */ 714 714 715 - static void reserve_minor_heaps() { 715 + static void reserve_minor_heaps(void) { 716 716 void* heaps_base; 717 717 uintnat minor_heap_reservation_bsize; 718 718 uintnat minor_heap_max_bsz; ··· 749 749 } 750 750 } 751 751 752 - static void unreserve_minor_heaps() { 752 + static void unreserve_minor_heaps(void) { 753 753 uintnat size; 754 754 755 755 caml_gc_log("unreserve_minor_heaps"); ··· 1046 1046 CAMLexport _Atomic caml_timing_hook caml_domain_terminated_hook = 1047 1047 (caml_timing_hook)NULL; 1048 1048 1049 - static void domain_terminate(); 1049 + static void domain_terminate(void); 1050 1050 1051 1051 static void* domain_thread_func(void* v) 1052 1052 {
+1 -1
runtime/fail_nat.c
··· 194 194 /* We use a pre-allocated exception because we can't 195 195 do a GC before the exception is raised (lack of stack descriptors 196 196 for the ccall to [caml_array_bound_error]). */ 197 - static value array_bound_exn() 197 + static value array_bound_exn(void) 198 198 { 199 199 static atomic_uintnat exn_cache = ATOMIC_UINTNAT_INIT(0); 200 200 const value* exn = (const value*)atomic_load_acq(&exn_cache);
+1 -1
runtime/fix_code.c
··· 159 159 160 160 #else 161 161 162 - int* caml_init_opcode_nargs() 162 + int* caml_init_opcode_nargs(void) 163 163 { 164 164 return NULL; 165 165 }
+5 -5
runtime/major_gc.c
··· 112 112 * the lock. */ 113 113 static caml_plat_mutex ephe_lock = CAML_PLAT_MUTEX_INITIALIZER; 114 114 115 - static void ephe_next_cycle () 115 + static void ephe_next_cycle (void) 116 116 { 117 117 caml_plat_lock(&ephe_lock); 118 118 atomic_fetch_add(&ephe_cycle_info.ephe_cycle, +1); ··· 360 360 return mean; 361 361 } 362 362 363 - static void update_major_slice_work() { 363 + static void update_major_slice_work(void) { 364 364 double p, dp, heap_words; 365 365 intnat computed_work; 366 366 caml_domain_state *dom_st = Caml_state; ··· 1128 1128 CAML_EV_END(EV_MAJOR_GC_CYCLE_DOMAINS); 1129 1129 } 1130 1130 1131 - static int is_complete_phase_sweep_and_mark_main () 1131 + static int is_complete_phase_sweep_and_mark_main (void) 1132 1132 { 1133 1133 return 1134 1134 caml_gc_phase == Phase_sweep_and_mark_main && ··· 1142 1142 /* All orphaned ephemerons have been adopted */ 1143 1143 } 1144 1144 1145 - static int is_complete_phase_mark_final () 1145 + static int is_complete_phase_mark_final (void) 1146 1146 { 1147 1147 return 1148 1148 caml_gc_phase == Phase_mark_final && ··· 1157 1157 /* All orphaned ephemerons have been adopted */ 1158 1158 } 1159 1159 1160 - static int is_complete_phase_sweep_ephe () 1160 + static int is_complete_phase_sweep_ephe (void) 1161 1161 { 1162 1162 return 1163 1163 caml_gc_phase == Phase_sweep_ephe &&
+1 -1
runtime/parsing.c
··· 137 137 } 138 138 } 139 139 140 - static int trace() 140 + static int trace(void) 141 141 { 142 142 return caml_params->parser_trace || Caml_state->parser_trace; 143 143 }
+11 -11
runtime/runtime_events.c
··· 114 114 int event_id, int event_length, uint64_t *content, 115 115 int word_offset); 116 116 117 - static void runtime_events_create_raw(); 117 + static void runtime_events_create_raw(void); 118 118 119 - void caml_runtime_events_init() { 119 + void caml_runtime_events_init(void) { 120 120 runtime_events_path = caml_secure_getenv(T("OCAML_RUNTIME_EVENTS_DIR")); 121 121 122 122 if (runtime_events_path) { ··· 178 178 } 179 179 180 180 181 - void caml_runtime_events_post_fork() { 181 + void caml_runtime_events_post_fork(void) { 182 182 /* We are here in the child process after a call to fork (which can only 183 183 happen when there is a single domain) and no mutator code that can spawn a 184 184 new domain can have run yet. Let's be double sure. */ ··· 199 199 200 200 /* Return the current location for the ring buffers of this process. This is 201 201 used in the consumer to read the ring buffers of the current process */ 202 - char_os* caml_runtime_events_current_location() { 202 + char_os* caml_runtime_events_current_location(void) { 203 203 if( atomic_load_acq(&runtime_events_enabled) ) { 204 204 return current_ring_loc; 205 205 } else { ··· 209 209 210 210 /* Write a lifecycle event and then trigger a stop the world to tear down the 211 211 ring buffers */ 212 - void caml_runtime_events_destroy() { 212 + void caml_runtime_events_destroy(void) { 213 213 if (atomic_load_acq(&runtime_events_enabled)) { 214 214 write_to_ring(EV_RUNTIME, EV_LIFECYCLE, EV_RING_STOP, 0, NULL, 0); 215 215 ··· 227 227 /* Create the initial runtime_events ring buffers. This must be called from 228 228 within a stop-the-world section if we cannot be sure there is only a single 229 229 domain running. */ 230 - static void runtime_events_create_raw() { 230 + static void runtime_events_create_raw(void) { 231 231 /* Don't initialise runtime_events twice */ 232 232 if (!atomic_load_acq(&runtime_events_enabled)) { 233 233 int ret, ring_headers_length; ··· 376 376 caml_global_barrier(); 377 377 } 378 378 379 - CAMLprim value caml_runtime_events_start() { 379 + CAMLprim value caml_runtime_events_start(void) { 380 380 while (!atomic_load_acq(&runtime_events_enabled)) { 381 381 caml_try_run_on_all_domains(&stw_create_runtime_events, NULL, NULL); 382 382 } ··· 384 384 return Val_unit; 385 385 } 386 386 387 - CAMLprim value caml_runtime_events_pause() { 387 + CAMLprim value caml_runtime_events_pause(void) { 388 388 if (!atomic_load_acq(&runtime_events_enabled)) return Val_unit; 389 389 390 390 uintnat not_paused = 0; ··· 396 396 return Val_unit; 397 397 } 398 398 399 - CAMLprim value caml_runtime_events_resume() { 399 + CAMLprim value caml_runtime_events_resume(void) { 400 400 if (!atomic_load_acq(&runtime_events_enabled)) return Val_unit; 401 401 402 402 uintnat paused = 1; ··· 515 515 516 516 /* Functions for putting runtime data on to the runtime_events */ 517 517 518 - static inline int ring_is_active() { 518 + static inline int ring_is_active(void) { 519 519 return 520 520 atomic_load_explicit(&runtime_events_enabled, memory_order_relaxed) 521 521 && !atomic_load_explicit(&runtime_events_paused, memory_order_relaxed); ··· 565 565 } 566 566 } 567 567 568 - void caml_ev_alloc_flush() { 568 + void caml_ev_alloc_flush(void) { 569 569 int i; 570 570 571 571 if ( !ring_is_active() )
+2 -2
testsuite/tests/asmgen/main.c
··· 20 20 21 21 /* This stub isn't needed for msvc32, since it's already in asmgen_i386nt.asm */ 22 22 #if !defined(_MSC_VER) || !defined(_M_IX86) 23 - void caml_call_gc() 23 + void caml_call_gc(void) 24 24 { 25 25 26 26 } 27 - void caml_call_realloc_stack() 27 + void caml_call_realloc_stack(void) 28 28 { 29 29 30 30 };
+1 -1
testsuite/tests/asmgen/mainarith.c
··· 22 22 #include <caml/config.h> 23 23 #define FMT ARCH_INTNAT_PRINTF_FORMAT 24 24 25 - void caml_call_poll() 25 + void caml_call_poll(void) 26 26 { 27 27 } 28 28