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

This commit is contained in:
mrdudz
2015-09-04 13:40:52 +02:00
18 changed files with 218 additions and 104 deletions

View File

@@ -1418,11 +1418,14 @@ CharAgain:
/* Line continuation? */
if (LineCont) {
NextChar ();
/* Next char should be a LF, if not, will result in an error later */
if (C == '\n') {
/* Handle as white space */
/* Ignore the '\n' */
NextChar ();
C = ' ';
goto Again;
} else {
/* Make it clear what the problem is: */
Error ("EOL expected.");
}
}
break;

View File

@@ -126,19 +126,19 @@ void DumpSymEntry (FILE* F, const SymEntry* E)
/* Print the assembler name if we have one */
if (E->AsmName) {
fprintf (F, " AsmName: %s\n", E->AsmName);
}
}
/* Print the flags */
SymFlags = E->Flags;
fprintf (F, " Flags: ");
fprintf (F, " Flags:");
for (I = 0; I < sizeof (Flags) / sizeof (Flags[0]) && SymFlags != 0; ++I) {
if ((SymFlags & Flags[I].Val) == Flags[I].Val) {
SymFlags &= ~Flags[I].Val;
fprintf (F, "%s ", Flags[I].Name);
fprintf (F, " %s", Flags[I].Name);
}
}
if (SymFlags != 0) {
fprintf (F, "%04X", SymFlags);
fprintf (F, " 0x%05X", SymFlags);
}
fprintf (F, "\n");

View File

@@ -813,6 +813,25 @@ SymEntry* AddGlobalSym (const char* Name, const Type* T, unsigned Flags)
}
}
/* If a static declaration follows a non-static declaration, then
** warn about the conflict. (It will compile a public declaration.)
*/
if ((Flags & SC_EXTERN) == 0 && (Entry->Flags & SC_EXTERN) != 0) {
Warning ("static declaration follows non-static declaration of `%s'.", Name);
}
/* An extern declaration must not change the current linkage. */
if (IsFunc || (Flags & (SC_EXTERN | SC_DEF)) == SC_EXTERN) {
Flags &= ~SC_EXTERN;
}
/* If a public declaration follows a static declaration, then
** warn about the conflict. (It will compile a public declaration.)
*/
if ((Flags & SC_EXTERN) != 0 && (Entry->Flags & SC_EXTERN) == 0) {
Warning ("public declaration follows static declaration of `%s'.", Name);
}
/* Add the new flags */
Entry->Flags |= Flags;

View File

@@ -38,8 +38,8 @@
/* Mode argument for spawn. This value is ignored by the function and only
* provided for DOS/Windows compatibility.
*/
** provided for DOS/Windows compatibility.
*/
#ifndef P_WAIT
#define P_WAIT 0
#endif
@@ -56,10 +56,10 @@ int spawnvp (int Mode attribute ((unused)),
const char* File attribute ((unused)),
char* const argv [])
/* Execute the given program searching and wait til it terminates. The Mode
* argument is ignored (compatibility only). The result of the function is
* the return code of the program. The function will terminate the program
* on errors.
*/
** argument is ignored (compatibility only). The result of the function is
** the return code of the program. The function will terminate the program
** on errors.
*/
{
int Status;
StrBuf Command = AUTO_STRBUF_INITIALIZER;

View File

@@ -48,8 +48,8 @@
/* Mode argument for spawn. This value is ignored by the function and only
* provided for DOS/Windows compatibility.
*/
** provided for DOS/Windows compatibility.
*/
#ifndef P_WAIT
#define P_WAIT 0
#endif
@@ -64,10 +64,10 @@
int spawnvp (int Mode attribute ((unused)), const char* File, char* const argv [])
/* Execute the given program searching and wait til it terminates. The Mode
* argument is ignored (compatibility only). The result of the function is
* the return code of the program. The function will terminate the program
* on errors.
*/
** argument is ignored (compatibility only). The result of the function is
** the return code of the program. The function will terminate the program
** on errors.
*/
{
int Status = 0;
@@ -99,7 +99,7 @@ int spawnvp (int Mode attribute ((unused)), const char* File, char* const argv [
}
/* Only the father goes here, we place a return here regardless of that
* to avoid compiler warnings.
*/
** to avoid compiler warnings.
*/
return WEXITSTATUS (Status);
}

View File

@@ -161,7 +161,7 @@ static void ExpandFile (CmdLine* L, const char* Name)
void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
void InitCmdLine (int* aArgCount, char*** aArgVec, const char* aProgName)
/* Initialize command line parsing. aArgVec is the argument array terminated by
** a NULL pointer (as usual), ArgCount is the number of valid arguments in the
** array. Both arguments are remembered in static storage.
@@ -171,7 +171,7 @@ void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
int I;
/* Get the program name from argv[0] but strip a path */
if (*(aArgVec)[0] == 0) {
if ((*aArgVec)[0] == 0) {
/* Use the default name given */
ProgName = aProgName;
} else {
@@ -190,7 +190,7 @@ void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
** special handling for arguments preceeded by the '@' sign - these are
** actually files containing arguments.
*/
for (I = 0; I < *aArgCount; ++I) {
for (I = 0; I <= *aArgCount; ++I) {
/* Get the next argument */
char* Arg = (*aArgVec)[I];
@@ -210,11 +210,11 @@ void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName)
}
/* Store the new argument list in a safe place... */
ArgCount = L.Count;
ArgCount = L.Count - 1;
ArgVec = L.Vec;
/* ...and pass back the changed data also */
*aArgCount = L.Count;
*aArgCount = L.Count - 1;
*aArgVec = L.Vec;
}

View File

@@ -71,7 +71,7 @@ struct LongOpt {
void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName);
void InitCmdLine (int* aArgCount, char*** aArgVec, const char* aProgName);
/* Initialize command line parsing. aArgVec is the argument array terminated by
** a NULL pointer (as usual), ArgCount is the number of valid arguments in the
** array. Both arguments are remembered in static storage.