1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 07:29:33 +00:00

Merge pull request #2003 from bbbradsmith/large_align_false_positive_fix

supress spurious "large alignment" warnings
This commit is contained in:
Bob Andrews 2023-02-24 16:32:41 +01:00 committed by GitHub
commit e105f6049d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View File

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

View File

@ -306,7 +306,7 @@ void SegAlign (unsigned long Alignment, int FillVal)
ActiveSeg->Align = CombinedAlignment;
/* 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)",
CombinedAlignment);
}

View File

@ -230,7 +230,7 @@ Section* ReadSection (FILE* F, ObjData* O)
"%lu. Last module requiring alignment was '%s'.",
GetString (Name), Alignment, MAX_ALIGNMENT,
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 "
"large (%lu). Last module requiring alignment was '%s'.",
GetString (Name), Alignment, GetObjFileName (O));