Merge branch 'master' into wrapped-call

This commit is contained in:
Bob Andrews
2021-05-11 14:16:25 +02:00
committed by GitHub
7 changed files with 26 additions and 9 deletions

View File

@@ -563,6 +563,8 @@ Here is a description of all the command line options:
Warn about #pragmas that aren't recognized by cc65. Warn about #pragmas that aren't recognized by cc65.
<tag><tt/unreachable-code/</tag> <tag><tt/unreachable-code/</tag>
Warn about unreachable code in cases of comparing constants, etc. Warn about unreachable code in cases of comparing constants, etc.
<tag><tt/unused-func/</tag>
Warn about unused functions.
<tag><tt/unused-label/</tag> <tag><tt/unused-label/</tag>
Warn about unused labels. Warn about unused labels.
<tag><tt/unused-param/</tag> <tag><tt/unused-param/</tag>

View File

@@ -98,11 +98,11 @@ extern struct _timezone {
# define CLOCKS_PER_SEC 50 # define CLOCKS_PER_SEC 50
#elif defined(__PCE__) #elif defined(__PCE__)
# define CLOCKS_PER_SEC 60 # define CLOCKS_PER_SEC 60
#elif defined(__GAMATE__) #elif defined(__GAMATE__)
# define CLOCKS_PER_SEC 135 /* FIXME */ # define CLOCKS_PER_SEC 135 /* FIXME */
#elif defined(__GEOS__) #elif defined(__GEOS__)
# define CLOCKS_PER_SEC 1 # define CLOCKS_PER_SEC 1
#else #elif defined(__ATARI__) || defined (__LYNX__)
/* Read the clock rate at runtime */ /* Read the clock rate at runtime */
clock_t _clocks_per_sec (void); clock_t _clocks_per_sec (void);
# define CLOCKS_PER_SEC _clocks_per_sec() # define CLOCKS_PER_SEC _clocks_per_sec()

View File

@@ -32,10 +32,8 @@ Y2K3 STA $0732,X
LDA #$60 ; Store RTS opcode @ end LDA #$60 ; Store RTS opcode @ end
STA $0750 STA $0750
JSR $0600 ; Show title screen JSR $0600 ; Show title screen
LDY #$00 ; Clear RAM from $0600-$3FFF LDY #<$0600 ; Clear RAM from $0600-$3FFF
STY $80 STY $80
LDA #$06 LDA #>$0600
STA $81 STA $81
JSR CLRRAM JMP CLRRAM
RTS

View File

@@ -5,17 +5,27 @@
; the usage of only ptr2 here! Keep in mind when appling changes ; the usage of only ptr2 here! Keep in mind when appling changes
; and check the other implementations too! ; and check the other implementations too!
; ;
; int strlen (const char* s); ; size_t __fastcall__ strlen (const char* s);
; ;
.export _strlen .export _strlen
.importzp ptr2 .importzp ptr2
.macpack cpu
_strlen: _strlen:
sta ptr2 ; Save s sta ptr2 ; Save s
stx ptr2+1 stx ptr2+1
.if (.cpu .bitand ::CPU_ISET_HUC6280)
clx
cly
.else
ldx #0 ; YX used as counter ldx #0 ; YX used as counter
.if (.cpu .bitand ::CPU_ISET_65816)
txy
.else
ldy #0 ldy #0
.endif
.endif
L1: lda (ptr2),y L1: lda (ptr2),y
beq L9 beq L9

View File

@@ -78,6 +78,7 @@ IntStack WarnUnreachableCode= INTSTACK(1); /* - unreachable code */
IntStack WarnUnusedLabel = INTSTACK(1); /* - unused labels */ IntStack WarnUnusedLabel = INTSTACK(1); /* - unused labels */
IntStack WarnUnusedParam = INTSTACK(1); /* - unused parameters */ IntStack WarnUnusedParam = INTSTACK(1); /* - unused parameters */
IntStack WarnUnusedVar = INTSTACK(1); /* - unused variables */ IntStack WarnUnusedVar = INTSTACK(1); /* - unused variables */
IntStack WarnUnusedFunc = INTSTACK(1); /* - unused functions */
/* Map the name of a warning to the intstack that holds its state */ /* Map the name of a warning to the intstack that holds its state */
typedef struct WarnMapEntry WarnMapEntry; typedef struct WarnMapEntry WarnMapEntry;
@@ -97,6 +98,7 @@ static WarnMapEntry WarnMap[] = {
{ &WarnStructParam, "struct-param" }, { &WarnStructParam, "struct-param" },
{ &WarnUnknownPragma, "unknown-pragma" }, { &WarnUnknownPragma, "unknown-pragma" },
{ &WarnUnreachableCode, "unreachable-code" }, { &WarnUnreachableCode, "unreachable-code" },
{ &WarnUnusedFunc, "unused-func" },
{ &WarnUnusedLabel, "unused-label" }, { &WarnUnusedLabel, "unused-label" },
{ &WarnUnusedParam, "unused-param" }, { &WarnUnusedParam, "unused-param" },
{ &WarnUnusedVar, "unused-var" }, { &WarnUnusedVar, "unused-var" },

View File

@@ -75,6 +75,7 @@ extern IntStack WarnUnreachableCode; /* - unreachable code */
extern IntStack WarnUnusedLabel; /* - unused labels */ extern IntStack WarnUnusedLabel; /* - unused labels */
extern IntStack WarnUnusedParam; /* - unused parameters */ extern IntStack WarnUnusedParam; /* - unused parameters */
extern IntStack WarnUnusedVar; /* - unused variables */ extern IntStack WarnUnusedVar; /* - unused variables */
extern IntStack WarnUnusedFunc; /* - unused functions */
/* Forward */ /* Forward */
struct StrBuf; struct StrBuf;

View File

@@ -173,6 +173,10 @@ static void CheckSymTable (SymTable* Tab)
if (IS_Get (&WarnUnusedParam)) { if (IS_Get (&WarnUnusedParam)) {
Warning ("Parameter '%s' is never used", Entry->Name); Warning ("Parameter '%s' is never used", Entry->Name);
} }
} else if (Flags & SC_FUNC) {
if (IS_Get (&WarnUnusedFunc)) {
Warning ("Function '%s' is defined but never used", Entry->Name);
}
} else { } else {
if (IS_Get (&WarnUnusedVar)) { if (IS_Get (&WarnUnusedVar)) {
Warning ("Variable '%s' is defined but never used", Entry->Name); Warning ("Variable '%s' is defined but never used", Entry->Name);