mirror of
https://github.com/cc65/cc65.git
synced 2025-01-19 02:33:19 +00:00
Enabled to output errors and warnings about tentative definitions.
This commit is contained in:
parent
f59d6b8f6a
commit
fdd120db49
@ -415,9 +415,36 @@ void Compile (const char* FileName)
|
||||
|
||||
} else {
|
||||
|
||||
/* Used for emitting externals */
|
||||
SymEntry* Entry;
|
||||
|
||||
/* Ok, start the ball rolling... */
|
||||
Parse ();
|
||||
|
||||
/* Reset the BSS segment name to its default; so that the below strcmp()
|
||||
** will work as expected, at the beginning of the list of variables
|
||||
*/
|
||||
SetSegName (SEG_BSS, SEGNAME_BSS);
|
||||
|
||||
/* Walk over all global symbols and generate code for uninitialized
|
||||
** global variables.
|
||||
*/
|
||||
for (Entry = GetGlobalSymTab ()->SymHead; Entry; Entry = Entry->NextSym) {
|
||||
if ((Entry->Flags & (SC_STORAGE | SC_DEF | SC_STATIC)) == (SC_STORAGE | SC_STATIC)) {
|
||||
/* Assembly definition of uninitialized global variable */
|
||||
|
||||
/* Set the segment name only when it changes */
|
||||
if (strcmp (GetSegName (SEG_BSS), Entry->V.BssName) != 0) {
|
||||
SetSegName (SEG_BSS, Entry->V.BssName);
|
||||
g_segname (SEG_BSS);
|
||||
}
|
||||
g_usebss ();
|
||||
g_defgloblabel (Entry->Name);
|
||||
g_res (SizeOf (Entry->Type));
|
||||
/* Mark as defined; so that it will be exported, not imported */
|
||||
Entry->Flags |= SC_DEF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Debug) {
|
||||
@ -431,18 +458,12 @@ void Compile (const char* FileName)
|
||||
|
||||
|
||||
void FinishCompile (void)
|
||||
/* Emit literals, externals, debug info, do cleanup and optimizations */
|
||||
/* Emit literals, debug info, do cleanup and optimizations */
|
||||
{
|
||||
SymEntry* Entry;
|
||||
|
||||
/* Reset the BSS segment name to its default; so that the below strcmp()
|
||||
** will work as expected, at the beginning of the list of variables
|
||||
*/
|
||||
SetSegName (SEG_BSS, SEGNAME_BSS);
|
||||
|
||||
/* Walk over all global symbols:
|
||||
** - for functions, do clean-up and optimizations
|
||||
** - generate code for uninitialized global variables
|
||||
/* Walk over all global symbols and do clean-up and optimizations for
|
||||
** functions.
|
||||
*/
|
||||
for (Entry = GetGlobalSymTab ()->SymHead; Entry; Entry = Entry->NextSym) {
|
||||
if (SymIsOutputFunc (Entry)) {
|
||||
@ -450,19 +471,6 @@ void FinishCompile (void)
|
||||
MoveLiteralPool (Entry->V.F.LitPool);
|
||||
CS_MergeLabels (Entry->V.F.Seg->Code);
|
||||
RunOpt (Entry->V.F.Seg->Code);
|
||||
} else if ((Entry->Flags & (SC_STORAGE | SC_DEF | SC_STATIC)) == (SC_STORAGE | SC_STATIC)) {
|
||||
/* Assembly definition of uninitialized global variable */
|
||||
|
||||
/* Set the segment name only when it changes */
|
||||
if (strcmp (GetSegName (SEG_BSS), Entry->V.BssName) != 0) {
|
||||
SetSegName (SEG_BSS, Entry->V.BssName);
|
||||
g_segname (SEG_BSS);
|
||||
}
|
||||
g_usebss ();
|
||||
g_defgloblabel (Entry->Name);
|
||||
g_res (SizeOf (Entry->Type));
|
||||
/* Mark as defined; so that it will be exported, not imported */
|
||||
Entry->Flags |= SC_DEF;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ void Compile (const char* FileName);
|
||||
/* Top level compile routine. Will setup things and call the parser. */
|
||||
|
||||
void FinishCompile (void);
|
||||
/* Emit literals, externals, do cleanup and optimizations */
|
||||
/* Emit literals, debug info, do cleanup and optimizations */
|
||||
|
||||
|
||||
|
||||
|
@ -1069,7 +1069,7 @@ int main (int argc, char* argv[])
|
||||
/* Create the output file if we didn't had any errors */
|
||||
if (PreprocessOnly == 0 && (ErrorCount == 0 || Debug)) {
|
||||
|
||||
/* Emit literals, externals, do cleanup and optimizations */
|
||||
/* Emit literals, do cleanup and optimizations */
|
||||
FinishCompile ();
|
||||
|
||||
/* Open the file */
|
||||
|
Loading…
x
Reference in New Issue
Block a user