[Git][ghc/ghc][wip/b/missing-prototypes] Add missing void prototypes to rts functions
Bryan R (@chreekat)
gitlab at gitlab.haskell.org
Wed Jun 28 09:56:39 UTC 2023
Bryan R pushed to branch wip/b/missing-prototypes at Glasgow Haskell Compiler / GHC
Commits:
a4ef4e64 by Bryan Richter at 2023-06-28T12:54:36+03:00
Add missing void prototypes to rts functions
See #23561.
- - - - -
29 changed files:
- rts/ExecPage.c
- rts/IPE.c
- rts/Libdw.c
- rts/Linker.c
- rts/ReportMemoryMap.c
- rts/StaticPtrTable.c
- rts/adjustor/LibffiAdjustor.c
- rts/adjustor/NativeAmd64.c
- rts/adjustor/NativeAmd64Mingw.c
- rts/adjustor/NativeIA64.c
- rts/adjustor/NativePowerPC.c
- rts/adjustor/Nativei386.c
- rts/eventlog/EventLog.c
- rts/linker/PEi386.c
- rts/posix/GetTime.c
- rts/sm/BlockAlloc.c
- rts/sm/GC.c
- rts/sm/MarkWeak.c
- rts/sm/NonMoving.c
- rts/sm/NonMovingCensus.c
- rts/sm/NonMovingMark.c
- rts/sm/NonMovingSweep.c
- rts/wasm/GetTime.c
- rts/win32/AsyncMIO.c
- rts/win32/AsyncWinIO.c
- rts/win32/ConsoleHandler.c
- rts/win32/GetTime.c
- rts/win32/OSThreads.c
- rts/win32/WorkQueue.c
Changes:
=====================================
rts/ExecPage.c
=====================================
@@ -9,7 +9,7 @@
#include "sm/OSMem.h"
#include "linker/MMap.h"
-ExecPage *allocateExecPage() {
+ExecPage *allocateExecPage(void) {
ExecPage *page = (ExecPage *) mmapAnonForLinker(getPageSize());
return page;
}
=====================================
rts/IPE.c
=====================================
@@ -173,7 +173,7 @@ InfoProvEnt *lookupIPE(const StgInfoTable *info) {
return lookupHashTable(ipeMap, (StgWord)info);
}
-void updateIpeMap() {
+void updateIpeMap(void) {
// Check if there's any work at all. If not so, we can circumvent locking,
// which decreases performance.
IpeBufferListNode *pending = xchg_ptr((void **) &ipeBufferList, NULL);
=====================================
rts/Libdw.c
=====================================
@@ -75,7 +75,7 @@ void libdwFree(LibdwSession *session) {
}
// Create a libdw session with DWARF information for all loaded modules
-LibdwSession *libdwInit() {
+LibdwSession *libdwInit(void) {
LibdwSession *session = stgCallocBytes(1, sizeof(LibdwSession),
"libdwInit");
// Initialize ELF library
=====================================
rts/Linker.c
=====================================
@@ -1032,7 +1032,7 @@ SymbolAddr* loadSymbol(SymbolName *lbl, RtsSymbolInfo *pinfo) {
}
void
-printLoadedObjects() {
+printLoadedObjects(void) {
ObjectCode* oc;
for (oc = objects; oc; oc = oc->next) {
if (oc->sections != NULL) {
=====================================
rts/ReportMemoryMap.c
=====================================
@@ -25,7 +25,7 @@
#if defined(mingw32_HOST_OS)
-void reportMemoryMap() {
+void reportMemoryMap(void) {
debugBelch("\nMemory map:\n");
uint8_t *addr = NULL;
while (true) {
@@ -74,7 +74,7 @@ void reportMemoryMap() {
#elif defined(darwin_HOST_OS)
-void reportMemoryMap() {
+void reportMemoryMap(void) {
// Inspired by MacFUSE /proc implementation
debugBelch("\nMemory map:\n");
while (true) {
@@ -112,7 +112,7 @@ void reportMemoryMap() {
#else
// Linux et al.
-void reportMemoryMap() {
+void reportMemoryMap(void) {
debugBelch("\nMemory map:\n");
FILE *f = fopen("/proc/self/maps", "r");
if (f == NULL) {
=====================================
rts/StaticPtrTable.c
=====================================
@@ -99,11 +99,11 @@ int hs_spt_keys(StgPtr keys[], int szKeys) {
return 0;
}
-int hs_spt_key_count() {
+int hs_spt_key_count(void) {
return spt ? keyCountHashTable(spt) : 0;
}
-void exitStaticPtrTable() {
+void exitStaticPtrTable(void) {
if (spt) {
freeHashTable(spt, freeSptEntry);
spt = NULL;
=====================================
rts/adjustor/LibffiAdjustor.c
=====================================
@@ -31,7 +31,7 @@ static ffi_status ffi_alloc_prep_closure(ffi_closure **pclosure, ffi_cif *cif,
/* Maps AdjustorExecutable* to AdjustorWritable*. */
static HashTable* allocatedExecs;
-void initAdjustors() {
+void initAdjustors(void) {
allocatedExecs = allocHashTable();
}
=====================================
rts/adjustor/NativeAmd64.c
=====================================
@@ -28,7 +28,7 @@ static struct AdjustorPool *simple_ccall_pool;
DECLARE_ADJUSTOR_TEMPLATE(complex_ccall);
static struct AdjustorPool *complex_ccall_pool;
-void initAdjustors()
+void initAdjustors(void)
{
simple_ccall_pool = new_adjustor_pool_from_template(&simple_ccall_adjustor_template);
complex_ccall_pool = new_adjustor_pool_from_template(&complex_ccall_adjustor_template);
=====================================
rts/adjustor/NativeAmd64Mingw.c
=====================================
@@ -34,7 +34,7 @@ static struct AdjustorPool *complex_float_ccall_pool;
DECLARE_ADJUSTOR_TEMPLATE(complex_nofloat_ccall);
static struct AdjustorPool *complex_nofloat_ccall_pool;
-void initAdjustors()
+void initAdjustors(void)
{
simple_ccall_pool = new_adjustor_pool_from_template(&simple_ccall_adjustor_template);
complex_float_ccall_pool = new_adjustor_pool_from_template(&complex_float_ccall_adjustor_template);
=====================================
rts/adjustor/NativeIA64.c
=====================================
@@ -35,7 +35,7 @@ stgAllocStable(size_t size_in_bytes, StgStablePtr *stable)
return(&(arr->payload));
}
-void initAdjustors() { }
+void initAdjustors(void) { }
void*
createAdjustor(int cconv, StgStablePtr hptr,
=====================================
rts/adjustor/NativePowerPC.c
=====================================
@@ -53,7 +53,7 @@ typedef struct AdjustorStub {
#endif /* !(defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS)) */
#endif /* defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) */
-void initAdjustors() { }
+void initAdjustors(void) { }
void*
createAdjustor(int cconv, StgStablePtr hptr,
=====================================
rts/adjustor/Nativei386.c
=====================================
@@ -92,7 +92,7 @@ static void mk_stdcall_adjustor(uint8_t *code, const void *context, void *user_d
static struct AdjustorPool *stdcall_pool;
#endif
-void initAdjustors() {
+void initAdjustors(void) {
ccall_pool = new_adjustor_pool(sizeof(struct CCallContext), CCALL_ADJUSTOR_LEN, mk_ccall_adjustor, NULL);
#if !defined(darwin_HOST_OS)
stdcall_pool = new_adjustor_pool(sizeof(struct AdjustorContext), STDCALL_ADJUSTOR_LEN, mk_stdcall_adjustor, NULL);
=====================================
rts/eventlog/EventLog.c
=====================================
@@ -359,7 +359,7 @@ get_n_capabilities(void)
}
void
-initEventLogging()
+initEventLogging(void)
{
/*
* Allocate buffer(s) to store events.
@@ -1561,7 +1561,7 @@ void flushLocalEventsBuf(Capability *cap)
// Flush all capabilities' event buffers when we already hold all capabilities.
// Used during forkProcess.
-void flushAllCapsEventsBufs()
+void flushAllCapsEventsBufs(void)
{
if (!event_log_writer) {
return;
=====================================
rts/linker/PEi386.c
=====================================
@@ -433,7 +433,7 @@ const int default_alignment = 8;
the pointer as a redirect. Essentially it's a DATA DLL reference. */
const void* __rts_iob_func = (void*)&__acrt_iob_func;
-void initLinker_PEi386()
+void initLinker_PEi386(void)
{
if (!ghciInsertSymbolTable(WSTR("(GHCi/Ld special symbols)"),
symhash, "__image_base__",
@@ -452,7 +452,7 @@ void initLinker_PEi386()
atexit (exitLinker_PEi386);
}
-void exitLinker_PEi386()
+void exitLinker_PEi386(void)
{
}
=====================================
rts/posix/GetTime.c
=====================================
@@ -45,7 +45,7 @@ static uint64_t timer_scaling_factor_numer = 0;
static uint64_t timer_scaling_factor_denom = 0;
#endif
-void initializeTimer()
+void initializeTimer(void)
{
#if defined(darwin_HOST_OS)
mach_timebase_info_data_t info;
=====================================
rts/sm/BlockAlloc.c
=====================================
@@ -1138,14 +1138,14 @@ static void sortDeferredList(bdescr** head) {
}
}
-void deferMBlockFreeing() {
+void deferMBlockFreeing(void) {
if(defer_mblock_frees) {
barf("MBlock freeing is already deferred");
}
defer_mblock_frees = true;
}
-void commitMBlockFreeing() {
+void commitMBlockFreeing(void) {
if(! defer_mblock_frees) {
barf("MBlock freeing was never deferred");
}
=====================================
rts/sm/GC.c
=====================================
@@ -184,7 +184,7 @@ uint32_t n_gc_threads;
static uint32_t n_gc_idle_threads;
bool work_stealing;
-static bool is_par_gc() {
+static bool is_par_gc(void) {
#if defined(THREADED_RTS)
if(n_gc_threads == 1) { return false; }
ASSERT(n_gc_threads > n_gc_idle_threads);
=====================================
rts/sm/MarkWeak.c
=====================================
@@ -457,7 +457,7 @@ static void checkWeakPtrSanity(StgWeak *hd, StgWeak *tl)
* Traverse the capabilities' local new-weak-pointer lists at the beginning of
* GC and move them to the nursery's weak_ptr_list.
*/
-void collectFreshWeakPtrs()
+void collectFreshWeakPtrs(void)
{
uint32_t i;
// move recently allocated weak_ptr_list to the old list as well
=====================================
rts/sm/NonMoving.c
=====================================
@@ -1338,7 +1338,7 @@ void locate_object(P_ obj)
#endif
}
-void nonmovingPrintSweepList()
+void nonmovingPrintSweepList(void)
{
debugBelch("==== SWEEP LIST =====\n");
int i = 0;
=====================================
rts/sm/NonMovingCensus.c
=====================================
@@ -141,7 +141,7 @@ void nonmovingPrintAllocatorCensus(bool collect_live_words)
}
}
-void nonmovingTraceAllocatorCensus()
+void nonmovingTraceAllocatorCensus(void)
{
#if defined(TRACING)
if (!RtsFlags.GcFlags.useNonmoving && !TRACE_nonmoving_gc)
=====================================
rts/sm/NonMovingMark.c
=====================================
@@ -260,7 +260,7 @@ StgWord nonmoving_write_barrier_enabled = false;
MarkQueue *current_mark_queue = NULL;
/* Initialise update remembered set data structures */
-void nonmovingMarkInit() {
+void nonmovingMarkInit(void) {
#if defined(THREADED_RTS)
initMutex(&upd_rem_set_lock);
initCondition(&upd_rem_set_flushed_cond);
@@ -367,7 +367,7 @@ void nonmovingBeginFlush(Task *task)
/* Wait until a capability has flushed its update remembered set. Returns true
* if all capabilities have flushed.
*/
-bool nonmovingWaitForFlush()
+bool nonmovingWaitForFlush(void)
{
ACQUIRE_LOCK(&upd_rem_set_lock);
debugTrace(DEBUG_nonmoving_gc, "Flush count %d", upd_rem_set_flush_count);
@@ -2062,7 +2062,7 @@ void nonmovingMarkDeadWeaks (struct MarkQueue_ *queue, StgWeak **dead_weaks)
}
// Non-moving heap variant of `tidyThreadList`
-void nonmovingTidyThreads ()
+void nonmovingTidyThreads (void)
{
StgTSO *next;
StgTSO **prev = &nonmoving_old_threads;
=====================================
rts/sm/NonMovingSweep.c
=====================================
@@ -74,7 +74,7 @@ nonmovingSweepSegment(struct NonmovingSegment *seg)
#if defined(DEBUG)
-void nonmovingGcCafs()
+void nonmovingGcCafs(void)
{
uint32_t i = 0;
StgIndStatic *next;
@@ -279,7 +279,7 @@ dirty_BLOCKING_QUEUE:
}
/* N.B. This happens during the pause so we own all capabilities. */
-void nonmovingSweepMutLists()
+void nonmovingSweepMutLists(void)
{
for (uint32_t n = 0; n < getNumCapabilities(); n++) {
Capability *cap = getCapability(n);
@@ -324,7 +324,7 @@ static void freeChain_lock_max(bdescr *bd, int max_dur)
RELEASE_SM_LOCK;
}
-void nonmovingSweepLargeObjects()
+void nonmovingSweepLargeObjects(void)
{
freeChain_lock_max(nonmoving_large_objects, 10000);
nonmoving_large_objects = nonmoving_marked_large_objects;
@@ -333,7 +333,7 @@ void nonmovingSweepLargeObjects()
n_nonmoving_marked_large_blocks = 0;
}
-void nonmovingSweepCompactObjects()
+void nonmovingSweepCompactObjects(void)
{
bdescr *next;
ACQUIRE_SM_LOCK;
@@ -367,7 +367,7 @@ static bool is_alive(StgClosure *p)
}
}
-void nonmovingSweepStableNameTable()
+void nonmovingSweepStableNameTable(void)
{
// See comments in gcStableTables
=====================================
rts/wasm/GetTime.c
=====================================
@@ -15,7 +15,7 @@
#include <time.h>
#include <sys/time.h>
-void initializeTimer()
+void initializeTimer(void)
{
}
=====================================
rts/win32/AsyncMIO.c
=====================================
@@ -150,7 +150,7 @@ addDoProcRequest(void* proc, void* param)
int
-startupAsyncIO()
+startupAsyncIO(void)
{
if (!StartIOManager()) {
return 0;
=====================================
rts/win32/AsyncWinIO.c
=====================================
@@ -435,7 +435,7 @@ static void notifyScheduler(uint32_t num) {
processRemoteCompletion queued.
IO runner thread blocked until processRemoteCompletion has run.
*/
-bool queueIOThread()
+bool queueIOThread(void)
{
bool result = false;
#if !defined(THREADED_RTS)
=====================================
rts/win32/ConsoleHandler.c
=====================================
@@ -332,7 +332,7 @@ rts_ConsoleHandlerDone (int ev USED_IF_NOT_THREADS)
* up as part Ctrl-C delivery.
*/
int
-rts_waitConsoleHandlerCompletion()
+rts_waitConsoleHandlerCompletion(void)
{
/* As long as the worker doesn't need to do a multiple wait,
* let's keep this HANDLE private to this 'module'.
=====================================
rts/win32/GetTime.c
=====================================
@@ -66,7 +66,7 @@ static LARGE_INTEGER qpc_frequency = {.QuadPart = 0};
// Initialize qpc_frequency. This function should be called before any call to
// getMonotonicNSec. If QPC is not supported on this system, qpc_frequency is
// set to 0.
-void initializeTimer()
+void initializeTimer(void)
{
BOOL qpc_supported = QueryPerformanceFrequency(&qpc_frequency);
if (!qpc_supported)
@@ -76,7 +76,7 @@ void initializeTimer()
}
HsWord64
-getMonotonicNSec()
+getMonotonicNSec(void)
{
if (qpc_frequency.QuadPart)
{
=====================================
rts/win32/OSThreads.c
=====================================
@@ -28,14 +28,14 @@ static uint32_t* cpuGroupCumulativeCache = NULL;
static uint8_t* cpuGroupDistCache = NULL;
void
-yieldThread()
+yieldThread(void)
{
SwitchToThread();
return;
}
void
-shutdownThread()
+shutdownThread(void)
{
ExitThread(0);
barf("ExitThread() returned"); // avoid gcc warning
@@ -65,7 +65,7 @@ createOSThread (OSThreadId* pId, const char *name STG_UNUSED,
}
OSThreadId
-osThreadId()
+osThreadId(void)
{
return GetCurrentThreadId();
}
=====================================
rts/win32/WorkQueue.c
=====================================
@@ -40,7 +40,7 @@ newSemaphore(int initCount, int max)
*
*/
WorkQueue*
-NewWorkQueue()
+NewWorkQueue(void)
{
WorkQueue* wq = (WorkQueue*)stgMallocBytes(sizeof(WorkQueue), "NewWorkQueue");
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a4ef4e64432834f7da225154555d1a2955934de9
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a4ef4e64432834f7da225154555d1a2955934de9
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230628/5222b7a3/attachment-0001.html>
More information about the ghc-commits
mailing list