1
0
mirror of https://github.com/cc65/cc65.git synced 2024-09-30 08:57:49 +00:00

In error or warning messages, output the name of the library if this is

relevant. It's otherwise difficult to know what happens when ar65 is called
from within a makefile or similar.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5695 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2012-06-07 19:59:51 +00:00
parent 4e0cbcf33f
commit 5cf9f585a6
6 changed files with 31 additions and 23 deletions

View File

@ -6,7 +6,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 1998-2011, Ullrich von Bassewitz */ /* (C) 1998-2012, Ullrich von Bassewitz */
/* Roemerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
@ -41,6 +41,7 @@
/* ar65 */ /* ar65 */
#include "error.h" #include "error.h"
#include "library.h"
#include "objdata.h" #include "objdata.h"
#include "exports.h" #include "exports.h"
@ -112,9 +113,9 @@ void ExpInsert (const char* Name, const ObjData* Module)
while (1) { while (1) {
if (strcmp (L->Name, Name) == 0) { if (strcmp (L->Name, Name) == 0) {
/* Duplicate entry */ /* Duplicate entry */
Warning ("External symbol `%s' in module `%s' is duplicated in " Warning ("External symbol `%s' in module `%s', library `%s' "
"module `%s'", "is duplicated in module `%s'",
Name, L->Name, Module->Name); Name, L->Name, LibName, Module->Name);
} }
if (L->Next == 0) { if (L->Next == 0) {
break; break;

View File

@ -6,7 +6,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 1998-2011, Ullrich von Bassewitz */ /* (C) 1998-2012, Ullrich von Bassewitz */
/* Roemerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
@ -60,14 +60,16 @@
/*****************************************************************************/ /*****************************************************************************/
/* Name of the library file */
const char* LibName = 0;
/* File descriptor for the library file */ /* File descriptor for the library file */
FILE* NewLib = 0; FILE* NewLib = 0;
static FILE* Lib = 0; static FILE* Lib = 0;
static const char* LibName = 0;
/* The library header */ /* The library header */
static LibHeader Header = { static LibHeader Header = {
LIB_MAGIC, LIB_MAGIC,
LIB_VERSION, LIB_VERSION,
0, 0,
@ -99,7 +101,7 @@ static void ReadHeader (void)
} }
Header.Flags = Read16 (Lib); Header.Flags = Read16 (Lib);
Header.IndexOffs = Read32 (Lib); Header.IndexOffs = Read32 (Lib);
} }
@ -388,7 +390,7 @@ void LibClose (void)
} }
if (NewLib && fclose (NewLib) != 0) { if (NewLib && fclose (NewLib) != 0) {
Error ("Problem closing temporary library file: %s", strerror (errno)); Error ("Problem closing temporary library file: %s", strerror (errno));
} }
} }

View File

@ -6,10 +6,10 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 1998 Ullrich von Bassewitz */ /* (C) 1998-2012, Ullrich von Bassewitz */
/* Wacholderweg 14 */ /* Roemerstrasse 52 */
/* D-70597 Stuttgart */ /* D-70794 Filderstadt */
/* EMail: uz@musoftware.de */ /* EMail: uz@cc65.org */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* This software is provided 'as-is', without any expressed or implied */
@ -48,6 +48,9 @@
/* Name of the library file */
extern const char* LibName;
/* File descriptor for the new library file */ /* File descriptor for the new library file */
extern FILE* NewLib; extern FILE* NewLib;
@ -73,7 +76,7 @@ unsigned long LibCopyTo (FILE* F, unsigned long Bytes);
void LibCopyFrom (unsigned long Pos, unsigned long Bytes, FILE* F); void LibCopyFrom (unsigned long Pos, unsigned long Bytes, FILE* F);
/* Copy data from the library file into another file */ /* Copy data from the library file into another file */
void LibClose (void); void LibClose (void);
/* Write remaining data, close both files and copy the temp file to the old /* Write remaining data, close both files and copy the temp file to the old
* filename * filename
*/ */

View File

@ -6,12 +6,12 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 1998-2011, Ullrich von Bassewitz */ /* (C) 1998-2012, Ullrich von Bassewitz */
/* Roemerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */ /* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */ /* arising from the use of this software. */
@ -121,7 +121,7 @@ int main (int argc, char* argv [])
case 'V': case 'V':
fprintf (stderr, fprintf (stderr,
"ar65 V%s - (C) Copyright 1998-2011 Ullrich von Bassewitz\n", "ar65 V%s - (C) Copyright 1998-2012 Ullrich von Bassewitz\n",
GetVersionAsString ()); GetVersionAsString ());
break; break;

View File

@ -6,7 +6,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 1998-2011, Ullrich von Bassewitz */ /* (C) 1998-2012, Ullrich von Bassewitz */
/* Roemerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
@ -41,6 +41,7 @@
/* ar65 */ /* ar65 */
#include "error.h" #include "error.h"
#include "library.h"
#include "objdata.h" #include "objdata.h"
@ -107,7 +108,7 @@ void FreeObjData (ObjData* O)
void ClearObjData (ObjData* O) void ClearObjData (ObjData* O)
/* Remove any data stored in O */ /* Remove any data stored in O */
{ {
unsigned I; unsigned I;
xfree (O->Name); xfree (O->Name);
O->Name = 0; O->Name = 0;
for (I = 0; I < CollCount (&O->Strings); ++I) { for (I = 0; I < CollCount (&O->Strings); ++I) {
@ -164,7 +165,7 @@ void DelObjData (const char* Module)
} }
/* Not found! */ /* Not found! */
Warning ("Module `%s' not found in library", Module); Warning ("Module `%s' not found in library `%s'", Module, LibName);
} }

View File

@ -267,7 +267,8 @@ void ObjAdd (const char* Name)
* and the external one. * and the external one.
*/ */
if (difftime ((time_t)O->MTime, StatBuf.st_mtime) > 0.0) { if (difftime ((time_t)O->MTime, StatBuf.st_mtime) > 0.0) {
Warning ("Replacing module `%s' by older version", O->Name); Warning ("Replacing module `%s' by older version in library `%s'",
O->Name, LibName);
} }
/* Free data */ /* Free data */
@ -312,7 +313,7 @@ void ObjExtract (const char* Name)
/* Bail out if the module does not exist */ /* Bail out if the module does not exist */
if (O == 0) { if (O == 0) {
Error ("Module `%s' not found in library", Module); Error ("Module `%s' not found in library `%s'", Module, LibName);
} }
/* Open the output file */ /* Open the output file */