mirror of
https://github.com/cc65/cc65.git
synced 2025-08-10 04:25:21 +00:00
Enabled to output errors and warnings about tentative definitions.
This commit is contained in:
@@ -415,9 +415,36 @@ void Compile (const char* FileName)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
/* Used for emitting externals */
|
||||||
|
SymEntry* Entry;
|
||||||
|
|
||||||
/* Ok, start the ball rolling... */
|
/* Ok, start the ball rolling... */
|
||||||
Parse ();
|
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) {
|
if (Debug) {
|
||||||
@@ -431,18 +458,12 @@ void Compile (const char* FileName)
|
|||||||
|
|
||||||
|
|
||||||
void FinishCompile (void)
|
void FinishCompile (void)
|
||||||
/* Emit literals, externals, debug info, do cleanup and optimizations */
|
/* Emit literals, debug info, do cleanup and optimizations */
|
||||||
{
|
{
|
||||||
SymEntry* Entry;
|
SymEntry* Entry;
|
||||||
|
|
||||||
/* Reset the BSS segment name to its default; so that the below strcmp()
|
/* Walk over all global symbols and do clean-up and optimizations for
|
||||||
** will work as expected, at the beginning of the list of variables
|
** functions.
|
||||||
*/
|
|
||||||
SetSegName (SEG_BSS, SEGNAME_BSS);
|
|
||||||
|
|
||||||
/* Walk over all global symbols:
|
|
||||||
** - for functions, do clean-up and optimizations
|
|
||||||
** - generate code for uninitialized global variables
|
|
||||||
*/
|
*/
|
||||||
for (Entry = GetGlobalSymTab ()->SymHead; Entry; Entry = Entry->NextSym) {
|
for (Entry = GetGlobalSymTab ()->SymHead; Entry; Entry = Entry->NextSym) {
|
||||||
if (SymIsOutputFunc (Entry)) {
|
if (SymIsOutputFunc (Entry)) {
|
||||||
@@ -450,19 +471,6 @@ void FinishCompile (void)
|
|||||||
MoveLiteralPool (Entry->V.F.LitPool);
|
MoveLiteralPool (Entry->V.F.LitPool);
|
||||||
CS_MergeLabels (Entry->V.F.Seg->Code);
|
CS_MergeLabels (Entry->V.F.Seg->Code);
|
||||||
RunOpt (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. */
|
/* Top level compile routine. Will setup things and call the parser. */
|
||||||
|
|
||||||
void FinishCompile (void);
|
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 */
|
/* Create the output file if we didn't had any errors */
|
||||||
if (PreprocessOnly == 0 && (ErrorCount == 0 || Debug)) {
|
if (PreprocessOnly == 0 && (ErrorCount == 0 || Debug)) {
|
||||||
|
|
||||||
/* Emit literals, externals, do cleanup and optimizations */
|
/* Emit literals, do cleanup and optimizations */
|
||||||
FinishCompile ();
|
FinishCompile ();
|
||||||
|
|
||||||
/* Open the file */
|
/* Open the file */
|
||||||
|
Reference in New Issue
Block a user