Merge remote-tracking branch 'upstream/master' into a5200

This commit is contained in:
Christian Groessler
2014-03-20 00:24:11 +01:00
542 changed files with 817 additions and 2121 deletions

View File

@@ -69,6 +69,3 @@ void AbEnd (const char* Format, ...)
/* Terminate the program */
exit (EXIT_FAILURE);
}

View File

@@ -58,6 +58,3 @@ void AbEnd (const char* Format, ...) attribute ((format (printf, 1, 2), noreturn
/* End of abend.h */
#endif

View File

@@ -92,6 +92,3 @@ unsigned char AddrSizeFromStr (const char* Str)
/* Not found */
return ADDR_SIZE_INVALID;
}

View File

@@ -72,6 +72,3 @@ unsigned char AddrSizeFromStr (const char* Str);
/* End of addrsize.h */
#endif

View File

@@ -182,6 +182,3 @@ unsigned long AlignCount (unsigned long Addr, unsigned long Alignment)
{
return AlignAddr (Addr, Alignment) - Addr;
}

View File

@@ -83,6 +83,3 @@ unsigned long AlignCount (unsigned long Addr, unsigned long Alignment);
/* End of alignment.h */
#endif

View File

@@ -58,6 +58,3 @@ int AssertAtAsmTime (AssertAction A)
{
return (A & 0x02U) == 0;
}

View File

@@ -71,6 +71,3 @@ int AssertAtAsmTime (AssertAction A);
/* End of assertion.h */
#endif

View File

@@ -55,6 +55,3 @@
/* End of attrib.h */
#endif

View File

@@ -123,6 +123,3 @@ void BitMerge (void* Target, const void* Source, unsigned Size)
*T++ |= *S++;
}
}

View File

@@ -71,6 +71,3 @@ void BitMerge (void* Target, const void* Source, unsigned Size);
/* End of bitops.h */
#endif

View File

@@ -76,6 +76,3 @@
/* End of cddefs.h */
#endif

View File

@@ -147,6 +147,3 @@ int IsQuote (char C)
{
return (C == '"' || C == '\'');
}

View File

@@ -112,6 +112,3 @@ int IsQuote (char C);
/* End of chartype.h */
#endif

View File

@@ -77,6 +77,3 @@ static void DefaultCheckFailed (const char* Msg, const char* Cond,
/* Output a diagnostic and abort */
AbEnd ("%s%s, file `%s', line %u", Msg, Cond, File, Line);
}

View File

@@ -86,7 +86,5 @@ extern void (*CheckFailed) (const char* Msg, const char* Cond,
/* End of check.h */
#endif

View File

@@ -307,7 +307,3 @@ void LongOption (unsigned* ArgNum, const LongOpt* OptTab, unsigned OptCount)
/* Invalid option */
UnknownOption (Opt);
}

View File

@@ -102,6 +102,3 @@ void LongOption (unsigned* ArgNum, const LongOpt* OptTab, unsigned OptCount);
/* End of cmdline.h */
#endif

View File

@@ -504,6 +504,3 @@ void CollSort (Collection* C,
QuickSort (C, 0, C->Count-1, Compare, Data);
}
}

View File

@@ -301,7 +301,3 @@ void CollSort (Collection* C,
/* End of coll.h */
#endif

View File

@@ -134,6 +134,3 @@ cpu_t FindCPU (const char* Name)
/* Not found */
return CPU_UNKNOWN;
}

View File

@@ -102,6 +102,3 @@ cpu_t FindCPU (const char* Name);
/* End of cpu.h */
#endif

View File

@@ -45,6 +45,3 @@
unsigned char Debug = 0; /* Debug mode */

View File

@@ -49,7 +49,5 @@ extern unsigned char Debug; /* Debug mode */
/* End of debugflag.h */
#endif

View File

@@ -232,6 +232,3 @@ void DumpExpr (const ExprNode* Expr, const ExprNode* (*ResolveSym) (const struct
InternalDumpExpr (Expr, ResolveSym);
printf ("\n");
}

View File

@@ -145,6 +145,3 @@ void DumpExpr (const ExprNode* Expr, const ExprNode* (*ResolveSym) (const struct
/* End of exprdefs.h */
#endif

View File

@@ -74,6 +74,3 @@ const FileId* GetFileId (const char* Name, const FileId* Table, unsigned Count)
/* Search for a table entry and return it */
return bsearch (Ext+1, Table, Count, sizeof (FileId), CompareFileId);
}

View File

@@ -74,7 +74,5 @@ const FileId* GetFileId (const char* Name, const FileId* Table, unsigned Count);
/* End of fileid.h */
#endif

View File

@@ -76,6 +76,3 @@ int CompareFilePos (const FilePos* P1, const FilePos* P2)
return 0;
}
}

View File

@@ -77,6 +77,3 @@ int CompareFilePos (const FilePos* P1, const FilePos* P2);
/* End of filepos.h */
#endif

View File

@@ -2,7 +2,7 @@
/* */
/* filestat.c */
/* */
/* Replacement for buggy Microsoft code */
/* Replacement for Windows code */
/* */
/* */
/* */
@@ -46,10 +46,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#if defined(__WATCOMC__) && defined(__NT__)
#define BUGGY_OS 1
#include <errno.h>
#include <windows.h>
#if defined(_WIN32)
# include <errno.h>
# include <windows.h>
#endif
/* common */
@@ -63,7 +62,7 @@
#if defined(BUGGY_OS)
#if defined(_WIN32)
@@ -77,7 +76,7 @@ static time_t FileTimeToUnixTime (const FILETIME* T)
* way to express a number > 32 bit (known to me) but is able to do
* calculations with 64 bit integers, so we need to do it this way.
*/
static const ULARGE_INTEGER Offs = { 0xB6109100UL, 0x00000020UL };
static const ULARGE_INTEGER Offs = { { 0xB6109100UL, 0x00000020UL } };
ULARGE_INTEGER V;
V.LowPart = T->dwLowDateTime;
V.HighPart = T->dwHighDateTime;

View File

@@ -2,7 +2,7 @@
/* */
/* filestat.h */
/* */
/* Replacement for buggy Microsoft code */
/* Replacement for Windows code */
/* */
/* */
/* */
@@ -68,6 +68,3 @@ int FileStat (const char* Path, struct stat* Buf);
/* End of filestat.h */
#endif

View File

@@ -2,7 +2,7 @@
/* */
/* filetime.c */
/* */
/* Replacement for buggy Microsoft code */
/* Replacement for Windows code */
/* */
/* */
/* */
@@ -42,19 +42,13 @@
#if defined(__WATCOMC__) && defined(__NT__)
#define BUGGY_OS 1
#include <errno.h>
#include <windows.h>
#if defined(_WIN32)
# include <errno.h>
# include <windows.h>
#else
#if defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__)
/* The Windows compilers have the file in the wrong directory */
# include <sys/utime.h>
#else
# include <sys/types.h> /* FreeBSD needs this */
# include <sys/types.h> /* FreeBSD needs this */
# include <utime.h>
#endif
#endif
/* common */
@@ -68,7 +62,7 @@
#if defined(BUGGY_OS)
#if defined(_WIN32)
@@ -82,7 +76,7 @@ static FILETIME* UnixTimeToFileTime (time_t T, FILETIME* FT)
* way to express a number > 32 bit (known to me) but is able to do
* calculations with 64 bit integers, so we need to do it this way.
*/
static const ULARGE_INTEGER Offs = { 0xB6109100UL, 0x00000020UL };
static const ULARGE_INTEGER Offs = { { 0xB6109100UL, 0x00000020UL } };
ULARGE_INTEGER V;
V.QuadPart = ((unsigned __int64) T + Offs.QuadPart) * 10000000U;
FT->dwLowDateTime = V.LowPart;
@@ -150,6 +144,3 @@ int SetFileTimes (const char* Path, time_t T)
#endif

View File

@@ -2,7 +2,7 @@
/* */
/* filetime.h */
/* */
/* Replacement for buggy Microsoft code */
/* Replacement for Windows code */
/* */
/* */
/* */
@@ -68,6 +68,3 @@ int SetFileTimes (const char* Path, time_t T);
/* End of filestat.h */
#endif

View File

@@ -104,6 +104,3 @@ FILETYPE GetFileType (const char* Name)
/* Return the result */
return F? F->Id : FILETYPE_UNKNOWN;
}

View File

@@ -71,7 +71,5 @@ FILETYPE GetFileType (const char* Name);
/* End of filetype.h */
#endif

View File

@@ -115,6 +115,3 @@ char* MakeFilename (const char* Origin, const char* Ext)
}
return Out;
}

View File

@@ -64,6 +64,3 @@ char* MakeFilename (const char* Origin, const char* Ext);
/* End of fname.h */
#endif

View File

@@ -236,6 +236,3 @@ Double FP_D_Div (Double Left, Double Right)
D.V = Left.V / Right.V;
return D;
}

View File

@@ -140,8 +140,3 @@ Double FP_D_Div (Double Left, Double Right);
/* End of fp.h */
#endif

View File

@@ -70,6 +70,3 @@
/* End of fragdefs.h */
#endif

View File

@@ -123,6 +123,3 @@ const char* GT_AsString (const StrBuf* Type, StrBuf* String)
/* Return the contents of String */
return SB_GetConstBuf (String);
}

View File

@@ -152,7 +152,3 @@ const char* GT_AsString (const StrBuf* Type, StrBuf* String);
/* End of gentype.h */
#endif

View File

@@ -89,6 +89,3 @@ unsigned HashBuf (const StrBuf* S)
}
return H;
}

View File

@@ -64,6 +64,3 @@ unsigned HashBuf (const StrBuf* S) attribute ((const));
/* End of hashfunc.h */
#endif

View File

@@ -244,6 +244,3 @@ void HT_Walk (HashTable* T, int (*F) (void* Entry, void* Data), void* Data)
}
}
}

View File

@@ -177,6 +177,3 @@ void HT_Walk (HashTable* T, int (*F) (void* Entry, void* Data), void* Data);
/* End of hashtab.h */
#endif

View File

@@ -77,6 +77,3 @@
/* End of hlldbgsyms.h */
#endif

View File

@@ -54,6 +54,3 @@
/* End of inline.h */
#endif

View File

@@ -87,6 +87,3 @@ long IS_Pop (IntStack* S)
PRECONDITION (S->Count > 0);
return S->Stack[--S->Count];
}

View File

@@ -116,7 +116,5 @@ long IS_Pop (IntStack* S);
/* End of intstack.h */
#endif

View File

@@ -62,7 +62,5 @@ typedef unsigned long uintmax_t;
/* End of inttypes.h */
#endif

View File

@@ -67,6 +67,3 @@ struct LibHeader {
/* End of libdefs.h */
#endif

View File

@@ -62,6 +62,3 @@
/* End of lidefs.h */
#endif

View File

@@ -238,6 +238,3 @@ int MatchPattern (const char* Source, const char* Pattern)
/* Do the real thing */
return RecursiveMatch ((const unsigned char*) Source, (const unsigned char*) Pattern);
}

View File

@@ -61,6 +61,3 @@ int MatchPattern (const char* Source, const char* Pattern);
/* End of matchpat.h */
#endif

View File

@@ -124,5 +124,3 @@ void SetMemoryModel (mmodel_t Model)
/* Zeropage is always zeropage */
ZpAddrSize = ADDR_SIZE_ZP;
}

View File

@@ -82,6 +82,3 @@ void SetMemoryModel (mmodel_t Model);
/* End of mmodel.h */
#endif

View File

@@ -92,6 +92,3 @@ struct ObjHeader {
/* End of objdefs.h */
#endif

View File

@@ -72,6 +72,3 @@ struct Option {
/* End of optdefs.h */
#endif

View File

@@ -72,6 +72,3 @@ void Print (FILE* F, unsigned V, const char* Format, ...)
vfprintf (F, Format, ap);
va_end (ap);
}

View File

@@ -70,7 +70,3 @@ void Print (FILE* F, unsigned V, const char* Format, ...)
/* End of print.h */
#endif

View File

@@ -76,6 +76,3 @@ enum {
/* End of scopedefs.h */
#endif

View File

@@ -35,10 +35,12 @@
#include <stdlib.h>
#include <string.h>
#if defined(_WIN32)
# include <windows.h>
#endif
#if defined(_MSC_VER)
/* Microsoft compiler */
# include <io.h>
# pragma warning(disable : 4996)
#else
/* Anyone else */
# include <unistd.h>
@@ -83,7 +85,7 @@ static char* CleanupPath (const char* Path)
static void Add (SearchPath* P, const char* New)
static void Add (SearchPaths* P, const char* New)
/* Cleanup a new search path and add it to the list */
{
/* Add a clean copy of the path to the collection */
@@ -92,7 +94,7 @@ static void Add (SearchPath* P, const char* New)
SearchPath* NewSearchPath (void)
SearchPaths* NewSearchPath (void)
/* Create a new, empty search path list */
{
return NewCollection ();
@@ -100,7 +102,7 @@ SearchPath* NewSearchPath (void)
void AddSearchPath (SearchPath* P, const char* NewPath)
void AddSearchPath (SearchPaths* P, const char* NewPath)
/* Add a new search path to the end of an existing list */
{
/* Allow a NULL path */
@@ -111,7 +113,7 @@ void AddSearchPath (SearchPath* P, const char* NewPath)
void AddSearchPathFromEnv (SearchPath* P, const char* EnvVar)
void AddSearchPathFromEnv (SearchPaths* P, const char* EnvVar)
/* Add a search path from an environment variable to the end of an existing
* list.
*/
@@ -121,7 +123,7 @@ void AddSearchPathFromEnv (SearchPath* P, const char* EnvVar)
void AddSubSearchPathFromEnv (SearchPath* P, const char* EnvVar, const char* SubDir)
void AddSubSearchPathFromEnv (SearchPaths* P, const char* EnvVar, const char* SubDir)
/* Add a search path from an environment variable, adding a subdirectory to
* the environment variable value.
*/
@@ -157,21 +159,20 @@ void AddSubSearchPathFromEnv (SearchPath* P, const char* EnvVar, const char* Sub
void AddSubSearchPathFromWinBin (SearchPath* P, const char* SubDir)
void AddSubSearchPathFromWinBin (SearchPaths* P, const char* SubDir)
{
/* Windows only:
* Add a search path from the running binary, adding a subdirectory to
* the parent directory of the directory containing the binary.
*/
#if defined(_MSC_VER)
#if defined(_WIN32)
char Dir[_MAX_PATH];
char* Ptr;
if (_get_pgmptr (&Ptr) != 0) {
if (GetModuleFileName (NULL, Dir, _MAX_PATH) == 0) {
return;
}
strcpy (Dir, Ptr);
/* Remove binary name */
Ptr = strrchr (Dir, '\\');
@@ -204,7 +205,7 @@ void AddSubSearchPathFromWinBin (SearchPath* P, const char* SubDir)
}
int PushSearchPath (SearchPath* P, const char* NewPath)
int PushSearchPath (SearchPaths* P, const char* NewPath)
/* Add a new search path to the head of an existing search path list, provided
* that it's not already there. If the path is already at the first position,
* return zero, otherwise return a non zero value.
@@ -227,7 +228,7 @@ int PushSearchPath (SearchPath* P, const char* NewPath)
void PopSearchPath (SearchPath* P)
void PopSearchPath (SearchPaths* P)
/* Remove a search path from the head of an existing search path list */
{
/* Remove the path at position 0 */
@@ -237,7 +238,7 @@ void PopSearchPath (SearchPath* P)
char* SearchFile (const SearchPath* P, const char* File)
char* SearchFile (const SearchPaths* P, const char* File)
/* Search for a file in a list of directories. Return a pointer to a malloced
* area that contains the complete path, if found, return 0 otherwise.
*/
@@ -271,6 +272,3 @@ char* SearchFile (const SearchPath* P, const char* File)
SB_Done (&PathName);
return Name;
}

View File

@@ -53,7 +53,7 @@
#define STRINGIZE(arg) _STRINGIZE(arg)
/* A search path is a pointer to the list */
typedef struct Collection SearchPath;
typedef struct Collection SearchPaths;
@@ -63,38 +63,38 @@ typedef struct Collection SearchPath;
SearchPath* NewSearchPath (void);
SearchPaths* NewSearchPath (void);
/* Create a new, empty search path list */
void AddSearchPath (SearchPath* P, const char* NewPath);
void AddSearchPath (SearchPaths* P, const char* NewPath);
/* Add a new search path to the end of an existing list */
void AddSearchPathFromEnv (SearchPath* P, const char* EnvVar);
void AddSearchPathFromEnv (SearchPaths* P, const char* EnvVar);
/* Add a search path from an environment variable to the end of an existing
* list.
*/
void AddSubSearchPathFromEnv (SearchPath* P, const char* EnvVar, const char* SubDir);
void AddSubSearchPathFromEnv (SearchPaths* P, const char* EnvVar, const char* SubDir);
/* Add a search path from an environment variable, adding a subdirectory to
* the environment variable value.
*/
void AddSubSearchPathFromWinBin (SearchPath* P, const char* SubDir);
void AddSubSearchPathFromWinBin (SearchPaths* P, const char* SubDir);
/* Windows only:
* Add a search path from the running binary, adding a subdirectory to
* the parent directory of the directory containing the binary.
*/
int PushSearchPath (SearchPath* P, const char* NewPath);
int PushSearchPath (SearchPaths* P, const char* NewPath);
/* Add a new search path to the head of an existing search path list, provided
* that it's not already there. If the path is already at the first position,
* return zero, otherwise return a non zero value.
*/
void PopSearchPath (SearchPath* P);
void PopSearchPath (SearchPaths* P);
/* Remove a search path from the head of an existing search path list */
char* SearchFile (const SearchPath* P, const char* File);
char* SearchFile (const SearchPaths* P, const char* File);
/* Search for a file in a list of directories. Return a pointer to a malloced
* area that contains the complete path, if found, return 0 otherwise.
*/
@@ -102,7 +102,5 @@ char* SearchFile (const SearchPath* P, const char* File);
/* End of searchpath.h */
#endif

View File

@@ -52,6 +52,3 @@
/* End of segdefs.h */
#endif

View File

@@ -65,6 +65,3 @@ int ValidSegName (const char* Name)
/* Name is ok */
return 1;
}

View File

@@ -68,6 +68,3 @@ int ValidSegName (const char* Name);
/* End of segnames.h */
#endif

View File

@@ -125,6 +125,3 @@ unsigned long shr_l (unsigned long l, unsigned count)
}
return l;
}

View File

@@ -79,6 +79,3 @@ unsigned long shr_l (unsigned long l, unsigned count);
/* End of shift.h */
#endif

View File

@@ -493,6 +493,3 @@ void SB_Printf (StrBuf* S, const char* Format, ...)
SB_VPrintf (S, Format, ap);
va_end (ap);
}

View File

@@ -421,6 +421,3 @@ void SB_Printf (StrBuf* S, const char* Format, ...) attribute ((format (printf,
/* End of strbuf.h */
#endif

View File

@@ -281,6 +281,3 @@ unsigned SP_GetCount (const StringPool* P)
{
return CollCount (&P->Entries);
}

View File

@@ -101,6 +101,3 @@ unsigned SP_GetCount (const StringPool* P);
/* End of strpool.h */
#endif

View File

@@ -80,6 +80,3 @@ void SS_Push (StrStack* S, const char* Val)
CHECK (S->Count < sizeof (S->Stack) / sizeof (S->Stack[0]));
S->Stack[S->Count++] = xstrdup (Val);
}

View File

@@ -100,7 +100,5 @@ void SS_Push (StrStack* S, const char* Val);
/* End of strstack.h */
#endif

View File

@@ -62,6 +62,3 @@ int StrCaseCmp (const char* S1, const char* S2);
/* End of strutil.h */
#endif

View File

@@ -103,6 +103,3 @@
/* End of symdefs.h */
#endif

View File

@@ -234,4 +234,3 @@ const char* GetTargetName (target_t Target)
/* Return the array entry */
return GetTargetProperties (Target)->Name;
}

View File

@@ -119,7 +119,5 @@ const char* GetTargetName (target_t Target);
/* End of target.h */
#endif

View File

@@ -127,8 +127,3 @@ void TgtTranslateSet (unsigned Index, unsigned char C)
CHECK (Index > 0 && Index < sizeof (Tab));
Tab[Index] = C;
}

View File

@@ -75,6 +75,3 @@ void TgtTranslateSet (unsigned Index, unsigned char C);
/* End of tgttrans.h */
#endif

View File

@@ -74,7 +74,5 @@
/* End of va_copy.h */
#endif

View File

@@ -33,8 +33,10 @@
#include "version.h"
/* common */
#include "xsprintf.h"
#include "searchpath.h"
#include "version.h"
@@ -46,9 +48,6 @@
#define VER_MAJOR 2U
#define VER_MINOR 14U
#define VER_PATCH 0U
#define VER_RC 0U
@@ -61,11 +60,11 @@
const char* GetVersionAsString (void)
/* Returns the version number as a string in a static buffer */
{
static char Buf[20];
#if defined(VER_RC) && (VER_RC > 0U)
xsnprintf (Buf, sizeof (Buf), "%u.%u.%u-rc%u", VER_MAJOR, VER_MINOR, VER_PATCH, VER_RC);
static char Buf[60];
#if defined(GIT_SHA)
xsnprintf (Buf, sizeof (Buf), "%u.%u - Git %s", VER_MAJOR, VER_MINOR, STRINGIZE (GIT_SHA));
#else
xsnprintf (Buf, sizeof (Buf), "%u.%u.%u", VER_MAJOR, VER_MINOR, VER_PATCH);
xsnprintf (Buf, sizeof (Buf), "%u.%u", VER_MAJOR, VER_MINOR);
#endif
return Buf;
}
@@ -75,8 +74,5 @@ const char* GetVersionAsString (void)
unsigned GetVersionAsNumber (void)
/* Returns the version number as a combined unsigned for use in a #define */
{
return ((VER_MAJOR * 0x100) + (VER_MINOR * 0x10) + VER_PATCH);
return ((VER_MAJOR * 0x100) + (VER_MINOR * 0x10));
}

View File

@@ -55,7 +55,3 @@ unsigned GetVersionAsNumber (void);
/* End of version.h */
#endif

View File

@@ -125,6 +125,3 @@ void* xdup (const void* Buf, size_t Size)
{
return memcpy (xmalloc (Size), Buf, Size);
}

View File

@@ -68,6 +68,3 @@ void* xdup (const void* Buf, size_t Size);
/* End of xmalloc.h */
#endif

View File

@@ -676,6 +676,3 @@ int xvsprintf (char* Buf, size_t BufSize, const char* Format, va_list ap)
CHECK (Res >= 0 && (unsigned) (Res+1) < BufSize);
return Res;
}

View File

@@ -88,7 +88,3 @@ int xvsprintf (char* Buf, size_t BufSize, const char* Format, va_list ap)
/* End of xsprintf.h */
#endif