1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-10 13:29:50 +00:00

suppress spurious "large alignment" warning when the combined alignment is not larger than any of the explictly requested ones

This commit is contained in:
bbbradsmith 2023-02-21 06:48:46 -05:00
parent d0f17ba602
commit 13f1d37403
3 changed files with 9 additions and 8 deletions

View File

@ -2112,14 +2112,15 @@ Here's a list of all control commands and a description, what they do:
</verb></tscreen> </verb></tscreen>
the assembler will force a segment alignment to the least common multiple of the assembler will force a segment alignment to the least common multiple of
15, 18 and 251 - which is 22590. To protect the user against errors, the 15, 18 and 251 - which is 22590. To protect the user against errors, when the
assembler will issue a warning when the combined alignment exceeds 256. The combined alignment is larger than the explicitly requested alignments,
command line option <tt><ref id="option--large-alignment" and also exceeds 256, the assembler will issue a warning. The command line
name="--large-alignment"></tt> will disable this warning. option <tt><ref id="option--large-alignment" name="--large-alignment"></tt>
will disable this warning.
Please note that with alignments that are a power of two (which were the Please note that with alignments that are a power of two (which were the
only alignments possible in older versions of the assembler), the problem is only alignments possible in older versions of the assembler) will not cause
less severe, because the least common multiple of powers to the same base is a warning, because the least common multiple of powers to the same base is
always the larger one. always the larger one.

View File

@ -306,7 +306,7 @@ void SegAlign (unsigned long Alignment, int FillVal)
ActiveSeg->Align = CombinedAlignment; ActiveSeg->Align = CombinedAlignment;
/* Output a warning for larger alignments if not suppressed */ /* Output a warning for larger alignments if not suppressed */
if (CombinedAlignment >= LARGE_ALIGNMENT && !LargeAlignment) { if (CombinedAlignment >= LARGE_ALIGNMENT && CombinedAlignment > ActiveSeg->Align && CombinedAlignment > Alignment && !LargeAlignment) {
Warning (0, "Combined alignment is suspiciously large (%lu)", Warning (0, "Combined alignment is suspiciously large (%lu)",
CombinedAlignment); CombinedAlignment);
} }

View File

@ -230,7 +230,7 @@ Section* ReadSection (FILE* F, ObjData* O)
"%lu. Last module requiring alignment was '%s'.", "%lu. Last module requiring alignment was '%s'.",
GetString (Name), Alignment, MAX_ALIGNMENT, GetString (Name), Alignment, MAX_ALIGNMENT,
GetObjFileName (O)); GetObjFileName (O));
} else if (Alignment >= LARGE_ALIGNMENT && !LargeAlignment) { } else if (Alignment >= LARGE_ALIGNMENT && Alignment > S->Alignment && Alignment > Sec->Alignment && !LargeAlignment) {
Warning ("Combined alignment for segment '%s' is suspiciously " Warning ("Combined alignment for segment '%s' is suspiciously "
"large (%lu). Last module requiring alignment was '%s'.", "large (%lu). Last module requiring alignment was '%s'.",
GetString (Name), Alignment, GetObjFileName (O)); GetString (Name), Alignment, GetObjFileName (O));