Skip to content

Commit 0252b56

Browse files
committed
plusplus: fix issue with module initialization functioon
internal functions for module initialization .mod_init and .fn_init has no location in source file, therefore location pointer is NULL
1 parent 1e85860 commit 0252b56

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

bld/plusplus/c/fnbody.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,15 @@ void FunctionBodyStartup( // COMMON START-UP FOR ALL COMPILED FUNCTIONS
17331733
doFnStartup( func, f, NULL, &func->locn->tl, flags );
17341734
}
17351735

1736+
void FunctionBodyStartupNoloc( // START-UP FOR INTERNAL FUNCTIONS
1737+
SYMBOL func, // - function being compiled
1738+
FUNCTION_DATA *f, // - function data for current function
1739+
enum special_func flags ) // - extra flags
1740+
{
1741+
initFunctionData( func, f );
1742+
doFnStartup( func, f, NULL, NULL, flags );
1743+
}
1744+
17361745
static void flushToDepth1( FUNCTION_DATA *f )
17371746
{
17381747
depth_t depth;

bld/plusplus/c/module.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Open Watcom Project
44
*
5-
* Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
5+
* Copyright (c) 2002-2026 The Open Watcom Contributors. All Rights Reserved.
66
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
77
*
88
* ========================================================================
@@ -205,7 +205,7 @@ void ModuleInitInit( // START MODULE-INITIALIZATION FUNCTION
205205
module_init_func = module_init;
206206
SetCurrScope(GetFileScope());
207207
ScopeBeginFunction( module_init );
208-
FunctionBodyStartup( module_init, &module_fd, FUNC_NULL );
208+
FunctionBodyStartupNoloc( module_init, &module_fd, FUNC_NULL );
209209
module_fd.retn_opt = false;
210210
module_init_scope = GetCurrScope();
211211
ScopeKeep( module_init_scope );

bld/plusplus/h/fnbody.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* Open Watcom Project
44
*
5-
* Copyright (c) 2024 The Open Watcom Contributors. All Rights Reserved.
5+
* Copyright (c) 2024-2026 The Open Watcom Contributors. All Rights Reserved.
66
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
77
*
88
* ========================================================================
@@ -153,6 +153,7 @@ extern void FunctionBodyDeadCode( void );
153153
extern INIT_VAR *FunctionBodyGetInit( FUNCTION_DATA * );
154154
extern void FunctionBodyShutdown( SYMBOL, FUNCTION_DATA * );
155155
extern void FunctionBodyStartup( SYMBOL, FUNCTION_DATA *, enum special_func );
156+
extern void FunctionBodyStartupNoloc( SYMBOL, FUNCTION_DATA *, enum special_func );
156157
extern void FunctionBodyDefargShutdown( FUNCTION_DATA * );
157158
extern void FunctionBodyDefargStartup( SYMBOL, FUNCTION_DATA * );
158159
extern PTREE FunctionCalled( PTREE, SYMBOL );

0 commit comments

Comments
 (0)