Removed the inline.h module and removed the use of macros instead of "static

inline".
This commit is contained in:
Kugel Fuhr
2025-07-07 11:23:12 +02:00
parent 29f7ab3809
commit 9be9003e9a
37 changed files with 222 additions and 1485 deletions

View File

@@ -41,7 +41,6 @@
/* common */
#include "coll.h"
#include "fragdefs.h"
#include "inline.h"
/* ca65 */
#include "fragment.h"
@@ -99,35 +98,23 @@ Fragment* GenFragment (unsigned char Type, unsigned short Len);
void UseSeg (const SegDef* D);
/* Use the given segment */
#if defined(HAVE_INLINE)
INLINE const SegDef* GetCurrentSegDef (void)
static inline const SegDef* GetCurrentSegDef (void)
/* Get a pointer to the segment defininition of the current segment */
{
return ActiveSeg->Def;
}
#else
# define GetCurrentSegDef() (ActiveSeg->Def)
#endif
#if defined(HAVE_INLINE)
INLINE unsigned GetCurrentSegNum (void)
static inline unsigned GetCurrentSegNum (void)
/* Get the number of the current segment */
{
return ActiveSeg->Num;
}
#else
# define GetCurrentSegNum() (ActiveSeg->Num)
#endif
#if defined(HAVE_INLINE)
INLINE unsigned char GetCurrentSegAddrSize (void)
static inline unsigned char GetCurrentSegAddrSize (void)
/* Get the address size of the current segment */
{
return ActiveSeg->Def->AddrSize;
}
#else
# define GetCurrentSegAddrSize() (ActiveSeg->Def->AddrSize)
#endif
void SegAlign (unsigned long Alignment, int FillVal);
/* Align the PC segment to Alignment. If FillVal is -1, emit fill fragments

View File

@@ -42,7 +42,6 @@
#include "coll.h"
#include "gentype.h"
#include "hashtab.h"
#include "inline.h"
#include "strbuf.h"
@@ -75,15 +74,11 @@ struct Span{
#if defined(HAVE_INLINE)
INLINE unsigned long GetSpanSize (const Span* R)
static inline unsigned long GetSpanSize (const Span* R)
/* Return the span size in bytes */
{
return (R->End - R->Start);
}
#else
# define GetSpanSize(R) ((R)->End - (R)->Start)
#endif
void SetSpanType (Span* S, const StrBuf* Type);
/* Set the generic type of the span to Type */

View File

@@ -63,45 +63,29 @@ extern StringPool* StrPool;
#if defined(HAVE_INLINE)
INLINE unsigned GetStrBufId (const StrBuf* S)
static inline unsigned GetStrBufId (const StrBuf* S)
/* Return the id of the given string buffer */
{
return SP_Add (StrPool, S);
}
#else
# define GetStrBufId(S) SP_Add (StrPool, (S))
#endif
#if defined(HAVE_INLINE)
INLINE unsigned GetStringId (const char* S)
static inline unsigned GetStringId (const char* S)
/* Return the id of the given string */
{
return SP_AddStr (StrPool, S);
}
#else
# define GetStringId(S) SP_AddStr (StrPool, (S))
#endif
#if defined(HAVE_INLINE)
INLINE const StrBuf* GetStrBuf (unsigned Index)
static inline const StrBuf* GetStrBuf (unsigned Index)
/* Convert a string index into a string */
{
return SP_Get (StrPool, Index);
}
#else
# define GetStrBuf(Index) SP_Get (StrPool, (Index))
#endif
#if defined(HAVE_INLINE)
INLINE const char* GetString (unsigned Index)
static inline const char* GetString (unsigned Index)
/* Convert a string index into a string */
{
return SB_GetConstBuf (SP_Get (StrPool, Index));
}
#else
# define GetString(Index) SB_GetConstBuf (SP_Get (StrPool, (Index)))
#endif
void WriteStrPool (void);
/* Write the string pool to the object file */

View File

@@ -42,7 +42,6 @@
#include "cddefs.h"
#include "coll.h"
#include "filepos.h"
#include "inline.h"
#include "strbuf.h"
/* ca65 */
@@ -137,25 +136,17 @@ int SymSearchTree (SymEntry* T, const StrBuf* Name, SymEntry** E);
** inserted on the right side.
*/
#if defined(HAVE_INLINE)
INLINE void SymAddExprRef (SymEntry* Sym, struct ExprNode* Expr)
static inline void SymAddExprRef (SymEntry* Sym, struct ExprNode* Expr)
/* Add an expression reference to this symbol */
{
CollAppend (&Sym->ExprRefs, Expr);
}
#else
#define SymAddExprRef(Sym,Expr) CollAppend (&(Sym)->ExprRefs, Expr)
#endif
#if defined(HAVE_INLINE)
INLINE void SymDelExprRef (SymEntry* Sym, struct ExprNode* Expr)
static inline void SymDelExprRef (SymEntry* Sym, struct ExprNode* Expr)
/* Delete an expression reference to this symbol */
{
CollDeleteItem (&Sym->ExprRefs, Expr);
}
#else
#define SymDelExprRef(Sym,Expr) CollDeleteItem (&(Sym)->ExprRefs, Expr)
#endif
void SymTransferExprRefs (SymEntry* From, SymEntry* To);
/* Transfer all expression references from one symbol to another. */
@@ -199,107 +190,71 @@ void SymImportFromGlobal (SymEntry* S);
** into an import.
*/
#if defined(HAVE_INLINE)
INLINE int SymIsDef (const SymEntry* S)
static inline int SymIsDef (const SymEntry* S)
/* Return true if the given symbol is already defined */
{
return (S->Flags & SF_DEFINED) != 0;
}
#else
# define SymIsDef(S) (((S)->Flags & SF_DEFINED) != 0)
#endif
#if defined(HAVE_INLINE)
INLINE int SymIsRef (const SymEntry* S)
static inline int SymIsRef (const SymEntry* S)
/* Return true if the given symbol has been referenced */
{
return (S->Flags & SF_REFERENCED) != 0;
}
#else
# define SymIsRef(S) (((S)->Flags & SF_REFERENCED) != 0)
#endif
#if defined(HAVE_INLINE)
INLINE int SymIsImport (const SymEntry* S)
static inline int SymIsImport (const SymEntry* S)
/* Return true if the given symbol is marked as import */
{
/* Check the import flag */
return (S->Flags & SF_IMPORT) != 0;
}
#else
# define SymIsImport(S) (((S)->Flags & SF_IMPORT) != 0)
#endif
#if defined(HAVE_INLINE)
INLINE int SymIsExport (const SymEntry* S)
static inline int SymIsExport (const SymEntry* S)
/* Return true if the given symbol is marked as export */
{
/* Check the export flag */
return (S->Flags & SF_EXPORT) != 0;
}
#else
# define SymIsExport(S) (((S)->Flags & SF_EXPORT) != 0)
#endif
#if defined(HAVE_INLINE)
INLINE int SymIsVar (const SymEntry* S)
static inline int SymIsVar (const SymEntry* S)
/* Return true if the given symbol is marked as variable */
{
/* Check the variable flag */
return (S->Flags & SF_VAR) != 0;
}
#else
# define SymIsVar(S) (((S)->Flags & SF_VAR) != 0)
#endif
int SymIsConst (const SymEntry* Sym, long* Val);
/* Return true if the given symbol has a constant value. If Val is not NULL
** and the symbol has a constant value, store it's value there.
*/
#if defined(HAVE_INLINE)
INLINE int SymHasExpr (const SymEntry* S)
static inline int SymHasExpr (const SymEntry* S)
/* Return true if the given symbol has an associated expression */
{
/* Check the expression */
return ((S->Flags & (SF_DEFINED|SF_IMPORT)) == SF_DEFINED);
}
#else
# define SymHasExpr(S) (((S)->Flags & (SF_DEFINED|SF_IMPORT)) == SF_DEFINED)
#endif
#if defined(HAVE_INLINE)
INLINE void SymMarkUser (SymEntry* S)
static inline void SymMarkUser (SymEntry* S)
/* Set a user mark on the specified symbol */
{
/* Set the bit */
S->Flags |= SF_USER;
}
#else
# define SymMarkUser(S) ((S)->Flags |= SF_USER)
#endif
#if defined(HAVE_INLINE)
INLINE void SymUnmarkUser (SymEntry* S)
static inline void SymUnmarkUser (SymEntry* S)
/* Remove a user mark from the specified symbol */
{
/* Reset the bit */
S->Flags &= ~SF_USER;
}
#else
# define SymUnmarkUser(S) ((S)->Flags &= ~SF_USER)
#endif
#if defined(HAVE_INLINE)
INLINE int SymHasUserMark (SymEntry* S)
static inline int SymHasUserMark (SymEntry* S)
/* Return the state of the user mark for the specified symbol */
{
/* Check the bit */
return (S->Flags & SF_USER) != 0;
}
#else
# define SymHasUserMark(S) (((S)->Flags & SF_USER) != 0)
#endif
struct SymTable* GetSymParentScope (SymEntry* S);
/* Get the parent scope of the symbol (not the one it is defined in). Return
@@ -314,27 +269,19 @@ const struct ExprNode* SymResolve (const SymEntry* Sym);
** NULL. Do not call in other contexts!
*/
#if defined(HAVE_INLINE)
INLINE const StrBuf* GetSymName (const SymEntry* S)
static inline const StrBuf* GetSymName (const SymEntry* S)
/* Return the name of the symbol */
{
return GetStrBuf (S->Name);
}
#else
# define GetSymName(S) GetStrBuf ((S)->Name)
#endif
#if defined(HAVE_INLINE)
INLINE unsigned char GetSymAddrSize (const SymEntry* S)
static inline unsigned char GetSymAddrSize (const SymEntry* S)
/* Return the address size of the symbol. Beware: This function will just
** return the AddrSize member, it will not look at the expression!
*/
{
return S->AddrSize;
}
#else
# define GetSymAddrSize(S) ((S)->AddrSize)
#endif
long GetSymVal (SymEntry* Sym);
/* Return the value of a symbol assuming it's constant. FAIL will be called

View File

@@ -42,7 +42,6 @@
/* common */
#include "exprdefs.h"
#include "inline.h"
/* ca65 */
#include "symentry.h"
@@ -135,25 +134,17 @@ SymEntry* SymFindAny (SymTable* Scope, const StrBuf* Name);
** scope.
*/
#if defined(HAVE_INLINE)
INLINE unsigned char GetSymTabType (const SymTable* S)
static inline unsigned char GetSymTabType (const SymTable* S)
/* Return the type of the given symbol table */
{
return S->Type;
}
#else
# define GetSymTabType(S) ((S)->Type)
#endif
#if defined(HAVE_INLINE)
INLINE int SymTabIsClosed (const SymTable* S)
static inline int SymTabIsClosed (const SymTable* S)
/* Return true if the symbol table has been closed */
{
return (S->Flags & ST_CLOSED) != 0;
}
#else
# define SymTabIsClosed(S) (((S)->Flags & ST_CLOSED) != 0)
#endif
void SymCheck (void);
/* Run through all symbols and check for anomalies and errors */

View File

@@ -40,7 +40,6 @@
/* common */
#include "filepos.h"
#include "inline.h"
#include "strbuf.h"
@@ -324,15 +323,11 @@ int TokHasSVal (token_t Tok);
int TokHasIVal (token_t Tok);
/* Return true if the given token has an attached IVal */
#if defined(HAVE_INLINE)
INLINE int TokIsSep (enum token_t T)
static inline int TokIsSep (enum token_t T)
/* Return true if this is a separator token */
{
return (T == TOK_SEP || T == TOK_EOF);
}
#else
# define TokIsSep(T) ((T) == TOK_SEP || (T) == TOK_EOF)
#endif
void CopyToken (Token* Dst, const Token* Src);
/* Copy a token. The current value of Dst.SVal is free'd, so Dst must be