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

Merge branch 'cc65:master' into master

This commit is contained in:
polluks2 2021-05-14 22:14:21 +02:00
commit 930dc7efc2
13 changed files with 47 additions and 50 deletions

View File

@ -1391,9 +1391,9 @@ parameter with the <tt/#pragma/.
in their prototypes).
The identifier is an 8-bit number that's set into <tt/tmp4/. If the identifier
is "bank", then a <tt><url url="ca65.html#.BANK" name=".bank"></tt> operator will be used
is "bank", then ca65's <tt><url url="ca65.html#.BANK" name=".bank"></tt> function will be used
to determine the number from the bank attribute defined in the linker config,
see <htmlurl url="ld65.html#MEMORY" name="Other MEMORY area attributes">. Note that
see <url url="ld65.html#MEMORY" name="Other MEMORY area attributes">. Note that
this currently implies that only the least significant 8 bits of the bank attribute
can be used.

View File

@ -5186,7 +5186,7 @@ the module just loaded. Possible error codes are:
<item><tt/MLOAD_ERR_MEM/ - Not enough memory
</itemize>
<tag/Notes/<itemize>
<item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
<item>The <url url="ld65.html" name="ld65 linker"> is needed to create
relocatable o65 modules for use with this function.
<item>The function is available only as a fastcall function; so, it may be used
only in the presence of a prototype.

View File

@ -21,7 +21,7 @@ __syschdir:
; Get name
jsr popax
stx tmp1
ldy tmp1

View File

@ -184,7 +184,7 @@ INLINE CodeLabel* CE_GetLabel (CodeEntry* E, unsigned Index)
INLINE void CE_ReplaceLabel (CodeEntry* E, CodeLabel* L, unsigned Index)
/* Replace the code label at the specified index with L */
{
return CollReplace (&E->Labels, L, Index);
CollReplace (&E->Labels, L, Index);
}
#else
# define CE_ReplaceLabel(E, L, Index) CollReplace (&(E)->Labels, (L), (Index))

View File

@ -1447,7 +1447,7 @@ void AdjustEntryIndices (Collection* Indices, int Index, int Change)
} else if (Index <= *IndexPtr) {
/* Has been removed */
*IndexPtr = -1;
//CollDelete (Indices, I);
/*CollDelete (Indices, I);*/
--I;
}
}

View File

@ -156,9 +156,8 @@ static void Parse (void)
**
** This means that "extern int i;" will not get storage allocated.
*/
if ((Decl.StorageClass & SC_FUNC) != SC_FUNC &&
(Decl.StorageClass & SC_TYPEMASK) != SC_TYPEDEF &&
(Decl.StorageClass & SC_FICTITIOUS) != SC_FICTITIOUS) {
if ((Decl.StorageClass & SC_FUNC) != SC_FUNC &&
(Decl.StorageClass & SC_TYPEMASK) != SC_TYPEDEF) {
if ((Spec.Flags & DS_DEF_STORAGE) != 0 ||
(Decl.StorageClass & (SC_EXTERN|SC_STATIC)) == SC_STATIC ||
((Decl.StorageClass & SC_EXTERN) != 0 &&

View File

@ -1242,7 +1242,7 @@ const Type* GetBaseElementType (const Type* T)
SymEntry* GetESUSymEntry (const Type* T)
struct SymEntry* GetESUSymEntry (const Type* T)
/* Return a SymEntry pointer from an enum/struct/union type */
{
/* Only enums, structs or unions have a SymEntry attribute */
@ -1254,7 +1254,7 @@ SymEntry* GetESUSymEntry (const Type* T)
void SetESUSymEntry (Type* T, SymEntry* S)
void SetESUSymEntry (Type* T, struct SymEntry* S)
/* Set the SymEntry pointer for an enum/struct/union type */
{
/* Only enums, structs or unions have a SymEntry attribute */

View File

@ -45,6 +45,9 @@
#include "inline.h"
#include "mmodel.h"
/* cc65 */
#include "funcdesc.h"
/*****************************************************************************/
@ -53,8 +56,8 @@
typedef struct FuncDesc FuncDesc;
typedef struct SymEntry SymEntry;
struct StrBuf;
struct SymEntry;
@ -162,12 +165,12 @@ typedef unsigned long TypeCode;
/* Type entry */
typedef struct Type Type;
struct Type {
TypeCode C; /* Code for this entry */
TypeCode C; /* Code for this entry */
union {
FuncDesc* F; /* Function description pointer */
SymEntry* S; /* Enum/struct/union tag symbol entry pointer */
long L; /* Numeric attribute value */
unsigned long U; /* Dito, unsigned */
struct FuncDesc* F; /* Function description pointer */
struct SymEntry* S; /* Enum/struct/union tag symbol entry pointer */
long L; /* Numeric attribute value */
unsigned long U; /* Dito, unsigned */
} A; /* Type attribute if necessary */
};
@ -221,11 +224,6 @@ extern const Type type_c_char_p[];
extern const Type type_void_p[];
extern const Type type_c_void_p[];
/* Forward for the SymEntry struct */
struct SymEntry;
/* Forward for the StrBuf struct */
struct StrBuf;
/*****************************************************************************/
@ -849,7 +847,7 @@ int IsVariadicFunc (const Type* T) attribute ((const));
*/
int IsFastcallFunc (const Type* T) attribute ((const));
/* Return true if this is a function type or pointer to function type by
/* Return true if this is a function type or pointer to function type with
** __fastcall__ calling convention.
** Check fails if the type is not a function or a pointer to function.
*/

View File

@ -2080,7 +2080,7 @@ void ParseDecl (const DeclSpec* Spec, Declaration* D, declmode_t Mode)
if (PrevErrorCount != ErrorCount) {
/* Make the declaration fictitious if is is not parsed correctly */
D->StorageClass |= SC_DECL | SC_FICTITIOUS;
D->StorageClass |= SC_FICTITIOUS;
if (Mode == DM_NEED_IDENT && D->Ident[0] == '\0') {
/* Use a fictitious name for the identifier if it is missing */

View File

@ -1301,6 +1301,7 @@ static void Primary (ExprDesc* E)
/* Statement block */
NextToken ();
Error ("Expression expected");
E->Flags |= E_EVAL_MAYBE_UNUSED;
hie0 (E);
if (CurTok.Tok == TOK_RCURLY) {
NextToken ();
@ -1332,6 +1333,7 @@ static void Primary (ExprDesc* E)
}
} else {
Error ("Expression expected");
E->Flags |= E_EVAL_MAYBE_UNUSED;
NextToken ();
}
}

View File

@ -476,8 +476,7 @@ static void ParseOneDecl (const DeclSpec* Spec)
}
/* If the symbol is not marked as external, it will be defined now */
if ((Decl.StorageClass & SC_FICTITIOUS) == 0 &&
(Decl.StorageClass & SC_DECL) == 0 &&
if ((Decl.StorageClass & SC_DECL) == 0 &&
(Decl.StorageClass & SC_EXTERN) == 0) {
Decl.StorageClass |= SC_DEF;
}

View File

@ -7,49 +7,48 @@ unsigned char c;
int *p;
void f1(void) {
int i = 1;
int *pa = (int *)0xaaaa;
int *pb = (int *)0xbbbb;
int i = 1;
int *pa = (int *)0xaaaa;
int *pb = (int *)0xbbbb;
p = (i == 0) ? pa : pb;
c = 0x5a;
p = (i == 0) ? pa : pb;
c = 0x5a;
}
struct data_t {
unsigned char c;
int *p;
unsigned char c;
int *p;
};
struct data_t data;
void f2(void) {
int i = 1;
int *pa = (int *)0xcccc;
int *pb = (int *)0xdddd;
struct data_t *po = &data;
po->p = (i == 0) ? pa : pb;
po->c = 0xa5;
int i = 1;
int *pa = (int *)0xcccc;
int *pb = (int *)0xdddd;
struct data_t *po = &data;
po->p = (i == 0) ? pa : pb;
po->c = 0xa5;
}
int ret = 0;
int main(void) {
f1();
f1();
if (c != 0x5a) {
ret++;
}
printf("c: %hhx\n", c);
printf("p: %p\n", p);
f2();
printf("c: %hhx\n", c);
printf("p: %p\n", p);
f2();
if (data.c != 0xa5) {
ret++;
}
printf("c: %hhx\n", data.c);
printf("p: %p\n", data.p);
printf("c: %hhx\n", data.c);
printf("p: %p\n", data.p);
printf("failures: %d\n", ret);
printf("failures: %d\n", ret);
return ret;
}

View File

@ -15,7 +15,7 @@ int main(void)
S b = {1, 4};
S m[1] = {{6, 3}};
S *p = &a;
(&a)->a += b.a;
p->b += b.b;
m->a += b.a;