Skip to content

Commit

Permalink
* macOS: fix SYSTEM.* for Clang 15.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg-N-Cher committed Nov 22, 2023
1 parent ef97ae9 commit 97d7bd5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
15 changes: 9 additions & 6 deletions Mod/Lib/Heap.cp
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,15 @@ MODULE Heap;
END FreeModule;


PROCEDURE REGCMD* (m: Module; IN name: ARRAY OF SHORTCHAR; cmd: Command);
VAR c: Cmd;
PROCEDURE REGCMD* (mod: S.PTR; IN name: ARRAY OF SHORTCHAR; cmd: Command);
VAR c: Cmd; m: Module;
BEGIN
ASSERT(LEN(name$) < CmdNameLen, 114);
(* REGCMD is called during module initialization code before that modules
type descriptors have been set up. 'NEW' depends on the Heap modules type
descriptors being ready for use, therefore, just for the commands registered
by the Heap module itself, we must use S.NEW. *)
m := mod;
IF m.name = "Heap" THEN
S.NEW(c, SIZE(CmdDesc))
ELSE
Expand All @@ -180,12 +181,14 @@ MODULE Heap;
c.name := name$; c.cmd := cmd; c.next := m.cmds; m.cmds := c
END REGCMD;

PROCEDURE REGTYP*(m: Module; typ: ADDRESS);
BEGIN S.PUT(typ, m.types); m.types := typ
PROCEDURE REGTYP* (mod: S.PTR; typ: ADDRESS);
VAR m: Module;
BEGIN m := mod; S.PUT(typ, m.types); m.types := typ
END REGTYP;

PROCEDURE INCREF*(m: Module);
BEGIN INC(m.refcnt)
PROCEDURE INCREF* (mod: S.PTR);
VAR m: Module;
BEGIN m := mod; INC(m.refcnt)
END INCREF;


Expand Down
2 changes: 1 addition & 1 deletion Mod/Lib/SYSTEM.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void SYSTEM_INHERIT(SYSTEM_ADRINT *t, SYSTEM_ADRINT *t0)
void SYSTEM_ENUMP(void *adr, SYSTEM_ADRINT n, void (*P)(void*))
{
while (n > 0) {
P((void*)(*((void**)(adr))));
P(*((void**)(adr)));
adr = ((void**)adr) + 1;
n--;
}
Expand Down
8 changes: 4 additions & 4 deletions Mod/Lib/SYSTEM.oh
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,10 @@ static inline REAL __MAXFD (REAL x, REAL y) { return x>y?x:y; }

// Module entry/registration/exit

extern void Heap_REGCMD();
extern SYSTEM_PTR Heap_REGMOD();
extern void Heap_REGTYP();
extern void Heap_INCREF();
extern void Heap_REGCMD (SYSTEM_PTR m, CHAR *name, INTEGER name__len, void (*cmd)(void));
extern SYSTEM_PTR Heap_REGMOD (CHAR *name, INTEGER name__len, void (*enumPtrs)(void(*)(SYSTEM_PTR)));
extern void Heap_REGTYP (SYSTEM_PTR m, SYSTEM_ADRINT typ);
extern void Heap_INCREF (SYSTEM_PTR m);

#define __DEFMOD static void *m; if (m!=0) {return m;}
#define __REGCMD(name, cmd) Heap_REGCMD(m, (CHAR*)name, 24, cmd)
Expand Down
Binary file modified Target/Win32/ofront+.exe
Binary file not shown.

0 comments on commit 97d7bd5

Please sign in to comment.