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

@@ -87,25 +87,17 @@ struct Fragment {
Fragment* NewFragment (unsigned char Type, unsigned Size, struct Section* S);
/* Create a new fragment and insert it into the section S */
#if defined(HAVE_INLINE)
INLINE const char* GetFragmentSourceName (const Fragment* F)
static inline const char* GetFragmentSourceName (const Fragment* F)
/* Return the name of the source file for this fragment */
{
return GetSourceNameFromList (&F->LineInfos);
}
#else
# define GetFragmentSourceName(F) GetSourceNameFromList (&(F)->LineInfos)
#endif
#if defined(HAVE_INLINE)
INLINE unsigned GetFragmentSourceLine (const Fragment* F)
static inline unsigned GetFragmentSourceLine (const Fragment* F)
/* Return the source file line for this fragment */
{
return GetSourceLineFromList (&F->LineInfos);
}
#else
# define GetFragmentSourceLine(F) GetSourceLineFromList (&(F)->LineInfos)
#endif

View File

@@ -110,69 +110,43 @@ const LineInfo* GetAsmLineInfo (const Collection* LineInfos);
** and return it. Return NULL if no such line info was found.
*/
#if defined(HAVE_INLINE)
INLINE const FilePos* GetSourcePos (const LineInfo* LI)
static inline const FilePos* GetSourcePos (const LineInfo* LI)
/* Return the source file position from the given line info */
{
return &LI->Pos;
}
#else
# define GetSourcePos(LI) (&(LI)->Pos)
#endif
#if defined(HAVE_INLINE)
INLINE const char* GetSourceName (const LineInfo* LI)
static inline const char* GetSourceName (const LineInfo* LI)
/* Return the name of a source file from the given line info */
{
return GetString (LI->Pos.Name);
}
#else
# define GetSourceName(LI) (GetString ((LI)->Pos.Name))
#endif
#if defined(HAVE_INLINE)
INLINE unsigned GetSourceLine (const LineInfo* LI)
static inline unsigned GetSourceLine (const LineInfo* LI)
/* Return the source file line from the given line info */
{
return LI->Pos.Line;
}
#else
# define GetSourceLine(LI) ((LI)->Pos.Line)
#endif
#if defined(HAVE_INLINE)
INLINE unsigned GetSourceCol (const LineInfo* LI)
static inline unsigned GetSourceCol (const LineInfo* LI)
/* Return the source file column from the given line info */
{
return LI->Pos.Col;
}
#else
# define GetSourceCol(LI) ((LI)->Pos.Col)
#endif
#if defined(HAVE_INLINE)
INLINE const char* GetSourceNameFromList (const Collection* LineInfos)
static inline const char* GetSourceNameFromList (const Collection* LineInfos)
/* Return the name of a source file from a list of line infos */
{
/* The relevant entry is in slot zero */
return GetSourceName (CollConstAt (LineInfos, 0));
}
#else
# define GetSourceNameFromList(LineInfos) \
GetSourceName ((const LineInfo*) CollConstAt ((LineInfos), 0))
#endif
#if defined(HAVE_INLINE)
INLINE unsigned GetSourceLineFromList (const Collection* LineInfos)
static inline unsigned GetSourceLineFromList (const Collection* LineInfos)
/* Return the source file line from a list of line infos */
{
/* The relevant entry is in slot zero */
return GetSourceLine (CollConstAt (LineInfos, 0));
}
#else
# define GetSourceLineFromList(LineInfos) \
GetSourceLine ((const LineInfo*) CollConstAt ((LineInfos), 0))
#endif
unsigned LineInfoCount (void);
/* Return the total number of line infos */

View File

@@ -40,7 +40,6 @@
/* common */
#include "coll.h"
#include "inline.h"
#include "objdefs.h"
@@ -136,15 +135,11 @@ const char* GetObjFileName (const ObjData* O);
** file is NULL.
*/
#if defined(HAVE_INLINE)
INLINE int ObjHasFiles (const ObjData* O)
static inline int ObjHasFiles (const ObjData* O)
/* Return true if the files list does exist */
{
return (O != 0 && CollCount (&O->Files) != 0);
}
#else
# define ObjHasFiles(O) ((O) != 0 && CollCount (&(O)->Files) != 0)
#endif
const struct StrBuf* GetObjString (const ObjData* Obj, unsigned Id);
/* Get a string from an object file checking for an invalid index */

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 InitStrPool (void);
/* Initialize the string pool */

View File

@@ -65,35 +65,23 @@ extern StringPool* TypePool;
#if defined(HAVE_INLINE)
INLINE unsigned GetTypeId (const StrBuf* Type)
static inline unsigned GetTypeId (const StrBuf* Type)
/* Return the id of the given generic type */
{
return SP_Add (TypePool, Type);
}
#else
# define GetTypeId(Type) SP_Add (TypePool, (Type))
#endif
#if defined(HAVE_INLINE)
INLINE const StrBuf* GetType (unsigned Index)
static inline const StrBuf* GetType (unsigned Index)
/* Convert a type index into a type string */
{
return SP_Get (TypePool, Index);
}
#else
# define GetType(Index) SP_Get (TypePool, (Index))
#endif
#if defined(HAVE_INLINE)
INLINE unsigned TypeCount (void)
static inline unsigned TypeCount (void)
/* Return the number of types in the pool */
{
return SP_GetCount (TypePool);
}
#else
# define TypeCount() SP_GetCount (TypePool)
#endif
void PrintDbgTypes (FILE* F);
/* Output the types to a debug info file */