1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-01 13:41:34 +00:00

Merge branch 'master' into wrapped-call

This commit is contained in:
Bob Andrews 2021-05-11 14:16:25 +02:00 committed by GitHub
commit 82ee502f57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.
<tag><tt/unreachable-code/</tag>
Warn about unreachable code in cases of comparing constants, etc.
<tag><tt/unused-func/</tag>
Warn about unused functions.
<tag><tt/unused-label/</tag>
Warn about unused labels.
<tag><tt/unused-param/</tag>

View File

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

View File

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

View File

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

View File

@ -78,6 +78,7 @@ IntStack WarnUnreachableCode= INTSTACK(1); /* - unreachable code */
IntStack WarnUnusedLabel = INTSTACK(1); /* - unused labels */
IntStack WarnUnusedParam = INTSTACK(1); /* - unused parameters */
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 */
typedef struct WarnMapEntry WarnMapEntry;
@ -97,6 +98,7 @@ static WarnMapEntry WarnMap[] = {
{ &WarnStructParam, "struct-param" },
{ &WarnUnknownPragma, "unknown-pragma" },
{ &WarnUnreachableCode, "unreachable-code" },
{ &WarnUnusedFunc, "unused-func" },
{ &WarnUnusedLabel, "unused-label" },
{ &WarnUnusedParam, "unused-param" },
{ &WarnUnusedVar, "unused-var" },

View File

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

View File

@ -173,6 +173,10 @@ static void CheckSymTable (SymTable* Tab)
if (IS_Get (&WarnUnusedParam)) {
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 {
if (IS_Get (&WarnUnusedVar)) {
Warning ("Variable '%s' is defined but never used", Entry->Name);