Merge branch 'cc65:master' into master

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

View File

@@ -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.

View File

@@ -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.

View File

@@ -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))

View File

@@ -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;
} }
} }

View File

@@ -157,8 +157,7 @@ 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 &&

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 */ /* 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 */

View File

@@ -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;
@@ -164,8 +167,8 @@ 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.
*/ */

View File

@@ -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 */

View File

@@ -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 ();
} }
} }

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 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;
} }

View File

@@ -52,4 +52,3 @@ int main(void) {
printf("failures: %d\n", ret); printf("failures: %d\n", ret);
return ret; return ret;
} }