Merge branch 'cc65:master' into master
This commit is contained in:
@@ -1391,9 +1391,9 @@ parameter with the <tt/#pragma/.
|
|||||||
in their prototypes).
|
in their prototypes).
|
||||||
|
|
||||||
The identifier is an 8-bit number that's set into <tt/tmp4/. If the identifier
|
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,
|
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
|
this currently implies that only the least significant 8 bits of the bank attribute
|
||||||
can be used.
|
can be used.
|
||||||
|
|
||||||
|
|||||||
@@ -5186,7 +5186,7 @@ the module just loaded. Possible error codes are:
|
|||||||
<item><tt/MLOAD_ERR_MEM/ - Not enough memory
|
<item><tt/MLOAD_ERR_MEM/ - Not enough memory
|
||||||
</itemize>
|
</itemize>
|
||||||
<tag/Notes/<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.
|
relocatable o65 modules for use with this function.
|
||||||
<item>The function is available only as a fastcall function; so, it may be used
|
<item>The function is available only as a fastcall function; so, it may be used
|
||||||
only in the presence of a prototype.
|
only in the presence of a prototype.
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ INLINE CodeLabel* CE_GetLabel (CodeEntry* E, unsigned Index)
|
|||||||
INLINE void CE_ReplaceLabel (CodeEntry* E, CodeLabel* L, unsigned Index)
|
INLINE void CE_ReplaceLabel (CodeEntry* E, CodeLabel* L, unsigned Index)
|
||||||
/* Replace the code label at the specified index with L */
|
/* Replace the code label at the specified index with L */
|
||||||
{
|
{
|
||||||
return CollReplace (&E->Labels, L, Index);
|
CollReplace (&E->Labels, L, Index);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define CE_ReplaceLabel(E, L, Index) CollReplace (&(E)->Labels, (L), (Index))
|
# define CE_ReplaceLabel(E, L, Index) CollReplace (&(E)->Labels, (L), (Index))
|
||||||
|
|||||||
@@ -1447,7 +1447,7 @@ void AdjustEntryIndices (Collection* Indices, int Index, int Change)
|
|||||||
} else if (Index <= *IndexPtr) {
|
} else if (Index <= *IndexPtr) {
|
||||||
/* Has been removed */
|
/* Has been removed */
|
||||||
*IndexPtr = -1;
|
*IndexPtr = -1;
|
||||||
//CollDelete (Indices, I);
|
/*CollDelete (Indices, I);*/
|
||||||
--I;
|
--I;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,9 +156,8 @@ static void Parse (void)
|
|||||||
**
|
**
|
||||||
** This means that "extern int i;" will not get storage allocated.
|
** This means that "extern int i;" will not get storage allocated.
|
||||||
*/
|
*/
|
||||||
if ((Decl.StorageClass & SC_FUNC) != SC_FUNC &&
|
if ((Decl.StorageClass & SC_FUNC) != SC_FUNC &&
|
||||||
(Decl.StorageClass & SC_TYPEMASK) != SC_TYPEDEF &&
|
(Decl.StorageClass & SC_TYPEMASK) != SC_TYPEDEF) {
|
||||||
(Decl.StorageClass & SC_FICTITIOUS) != SC_FICTITIOUS) {
|
|
||||||
if ((Spec.Flags & DS_DEF_STORAGE) != 0 ||
|
if ((Spec.Flags & DS_DEF_STORAGE) != 0 ||
|
||||||
(Decl.StorageClass & (SC_EXTERN|SC_STATIC)) == SC_STATIC ||
|
(Decl.StorageClass & (SC_EXTERN|SC_STATIC)) == SC_STATIC ||
|
||||||
((Decl.StorageClass & SC_EXTERN) != 0 &&
|
((Decl.StorageClass & SC_EXTERN) != 0 &&
|
||||||
|
|||||||
@@ -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 */
|
/* Return a SymEntry pointer from an enum/struct/union type */
|
||||||
{
|
{
|
||||||
/* Only enums, structs or unions have a SymEntry attribute */
|
/* 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 */
|
/* Set the SymEntry pointer for an enum/struct/union type */
|
||||||
{
|
{
|
||||||
/* Only enums, structs or unions have a SymEntry attribute */
|
/* Only enums, structs or unions have a SymEntry attribute */
|
||||||
|
|||||||
@@ -45,6 +45,9 @@
|
|||||||
#include "inline.h"
|
#include "inline.h"
|
||||||
#include "mmodel.h"
|
#include "mmodel.h"
|
||||||
|
|
||||||
|
/* cc65 */
|
||||||
|
#include "funcdesc.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -53,8 +56,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct FuncDesc FuncDesc;
|
struct StrBuf;
|
||||||
typedef struct SymEntry SymEntry;
|
struct SymEntry;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -162,12 +165,12 @@ typedef unsigned long TypeCode;
|
|||||||
/* Type entry */
|
/* Type entry */
|
||||||
typedef struct Type Type;
|
typedef struct Type Type;
|
||||||
struct Type {
|
struct Type {
|
||||||
TypeCode C; /* Code for this entry */
|
TypeCode C; /* Code for this entry */
|
||||||
union {
|
union {
|
||||||
FuncDesc* F; /* Function description pointer */
|
struct FuncDesc* F; /* Function description pointer */
|
||||||
SymEntry* S; /* Enum/struct/union tag symbol entry pointer */
|
struct SymEntry* S; /* Enum/struct/union tag symbol entry pointer */
|
||||||
long L; /* Numeric attribute value */
|
long L; /* Numeric attribute value */
|
||||||
unsigned long U; /* Dito, unsigned */
|
unsigned long U; /* Dito, unsigned */
|
||||||
} A; /* Type attribute if necessary */
|
} 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_void_p[];
|
||||||
extern const Type type_c_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));
|
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.
|
** __fastcall__ calling convention.
|
||||||
** Check fails if the type is not a function or a pointer to function.
|
** Check fails if the type is not a function or a pointer to function.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2080,7 +2080,7 @@ void ParseDecl (const DeclSpec* Spec, Declaration* D, declmode_t Mode)
|
|||||||
|
|
||||||
if (PrevErrorCount != ErrorCount) {
|
if (PrevErrorCount != ErrorCount) {
|
||||||
/* Make the declaration fictitious if is is not parsed correctly */
|
/* 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') {
|
if (Mode == DM_NEED_IDENT && D->Ident[0] == '\0') {
|
||||||
/* Use a fictitious name for the identifier if it is missing */
|
/* Use a fictitious name for the identifier if it is missing */
|
||||||
|
|||||||
@@ -1301,6 +1301,7 @@ static void Primary (ExprDesc* E)
|
|||||||
/* Statement block */
|
/* Statement block */
|
||||||
NextToken ();
|
NextToken ();
|
||||||
Error ("Expression expected");
|
Error ("Expression expected");
|
||||||
|
E->Flags |= E_EVAL_MAYBE_UNUSED;
|
||||||
hie0 (E);
|
hie0 (E);
|
||||||
if (CurTok.Tok == TOK_RCURLY) {
|
if (CurTok.Tok == TOK_RCURLY) {
|
||||||
NextToken ();
|
NextToken ();
|
||||||
@@ -1332,6 +1333,7 @@ static void Primary (ExprDesc* E)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Error ("Expression expected");
|
Error ("Expression expected");
|
||||||
|
E->Flags |= E_EVAL_MAYBE_UNUSED;
|
||||||
NextToken ();
|
NextToken ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -476,8 +476,7 @@ static void ParseOneDecl (const DeclSpec* Spec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If the symbol is not marked as external, it will be defined now */
|
/* If the symbol is not marked as external, it will be defined now */
|
||||||
if ((Decl.StorageClass & SC_FICTITIOUS) == 0 &&
|
if ((Decl.StorageClass & SC_DECL) == 0 &&
|
||||||
(Decl.StorageClass & SC_DECL) == 0 &&
|
|
||||||
(Decl.StorageClass & SC_EXTERN) == 0) {
|
(Decl.StorageClass & SC_EXTERN) == 0) {
|
||||||
Decl.StorageClass |= SC_DEF;
|
Decl.StorageClass |= SC_DEF;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,49 +7,48 @@ unsigned char c;
|
|||||||
int *p;
|
int *p;
|
||||||
|
|
||||||
void f1(void) {
|
void f1(void) {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
int *pa = (int *)0xaaaa;
|
int *pa = (int *)0xaaaa;
|
||||||
int *pb = (int *)0xbbbb;
|
int *pb = (int *)0xbbbb;
|
||||||
|
|
||||||
p = (i == 0) ? pa : pb;
|
p = (i == 0) ? pa : pb;
|
||||||
c = 0x5a;
|
c = 0x5a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct data_t {
|
struct data_t {
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
int *p;
|
int *p;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct data_t data;
|
struct data_t data;
|
||||||
|
|
||||||
void f2(void) {
|
void f2(void) {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
int *pa = (int *)0xcccc;
|
int *pa = (int *)0xcccc;
|
||||||
int *pb = (int *)0xdddd;
|
int *pb = (int *)0xdddd;
|
||||||
struct data_t *po = &data;
|
struct data_t *po = &data;
|
||||||
|
|
||||||
po->p = (i == 0) ? pa : pb;
|
po->p = (i == 0) ? pa : pb;
|
||||||
po->c = 0xa5;
|
po->c = 0xa5;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
f1();
|
f1();
|
||||||
if (c != 0x5a) {
|
if (c != 0x5a) {
|
||||||
ret++;
|
ret++;
|
||||||
}
|
}
|
||||||
printf("c: %hhx\n", c);
|
printf("c: %hhx\n", c);
|
||||||
printf("p: %p\n", p);
|
printf("p: %p\n", p);
|
||||||
f2();
|
f2();
|
||||||
if (data.c != 0xa5) {
|
if (data.c != 0xa5) {
|
||||||
ret++;
|
ret++;
|
||||||
}
|
}
|
||||||
printf("c: %hhx\n", data.c);
|
printf("c: %hhx\n", data.c);
|
||||||
printf("p: %p\n", data.p);
|
printf("p: %p\n", data.p);
|
||||||
|
|
||||||
printf("failures: %d\n", ret);
|
printf("failures: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user