shithub: rgbds

Download patch

ref: 3d8396b86f4d95cb0fd76ac1418c0d92e296b84f
parent: 77546e9c58436a23ebc0d4489af114592ca41390
author: Antonio Niño Díaz <[email protected]>
date: Sat Apr 8 14:10:14 EDT 2017

Remove progname variable

The error message shouldn't specify the name of the binary, that's
supposed to be known by the caller.

Update test reference outputs.

Signed-off-by: Antonio Niño Díaz <[email protected]>

--- a/src/asm/main.c
+++ b/src/asm/main.c
@@ -20,8 +20,6 @@
 int cldefines_size;
 char **cldefines;
 
-char *progname;
-
 clock_t nStartClock, nEndClock;
 SLONG nLineNo;
 ULONG nTotalLines, nPass, nPC, nIFDepth, nErrors;
@@ -300,8 +298,6 @@
 
 	if (argc == 1)
 		usage();
-
-	progname = "rgbasm";
 
 	/* yydebug=1; */
 
--- a/src/extern/err.c
+++ b/src/extern/err.c
@@ -26,11 +26,9 @@
 #include <stdlib.h>
 #include "extern/err.h"
 
-extern char *progname;
-
 void rgbds_vwarn(const char *fmt, va_list ap)
 {
-	fprintf (stderr, "%s: warning", progname);
+	fprintf (stderr, "warning");
 	if (fmt) {
 		fputs (": ", stderr);
 		vfprintf(stderr, fmt, ap);
@@ -41,7 +39,7 @@
 
 void rgbds_vwarnx(const char *fmt, va_list ap)
 {
-	fprintf (stderr, "%s: warning", progname);
+	fprintf (stderr, "warning");
 	if (fmt) {
 		fputs (": ", stderr);
 		vfprintf(stderr, fmt, ap);
@@ -51,7 +49,7 @@
 
 noreturn void rgbds_verr(int status, const char *fmt, va_list ap)
 {
-	fprintf (stderr, "%s: error", progname);
+	fprintf (stderr, "error");
 	if (fmt) {
 		fputs (": ", stderr);
 		vfprintf(stderr, fmt, ap);
@@ -62,7 +60,7 @@
 
 noreturn void rgbds_verrx(int status, const char *fmt, va_list ap)
 {
-	fprintf (stderr, "%s: error", progname);
+	fprintf (stderr, "error");
         if (fmt) {
                 fputs (": ", stderr);
                 vfprintf(stderr, fmt, ap);
--- a/src/fix/main.c
+++ b/src/fix/main.c
@@ -23,8 +23,6 @@
 
 #include "extern/err.h"
 
-char *progname;
-
 static void
 usage(void)
 {
@@ -70,8 +68,6 @@
 	int ramsize;   /* RAM size ID */
 	int version;   /* mask ROM version number */
 	int padvalue;  /* to pad the rom with if it changes size */
-
-	progname = "rgbfix";
 
 	while ((ch = getopt(argc, argv, "Cci:jk:l:m:n:p:sr:t:v")) != -1) {
 		switch (ch) {
--- a/src/gfx/main.c
+++ b/src/gfx/main.c
@@ -19,8 +19,6 @@
 #include <string.h>
 #include "gfx/main.h"
 
-char *progname;
-
 static void
 usage(void)
 {
@@ -40,8 +38,6 @@
 	struct Tilemap tilemap = {0};
 	char *ext;
 	const char *errmsg = "Warning: The PNG's %s setting is not the same as the setting defined on the command line.";
-
-	progname = "rgbgfx";
 
 	if (argc == 1) {
 		usage();
--- a/src/link/main.c
+++ b/src/link/main.c
@@ -24,8 +24,6 @@
 SLONG fillchar = 0;
 char *smartlinkstartsymbol;
 
-char *progname;
-
 /*
  * Print the usagescreen
  *
@@ -53,8 +51,6 @@
 
 	if (argc == 1)
 		usage();
-
-	progname = "rgblink";
 
 	while ((ch = getopt(argc, argv, "l:m:n:o:O:p:s:tw")) != -1) {
 		switch (ch) {
--- a/test/asm/undefined-dot.out
+++ b/test/asm/undefined-dot.out
@@ -1,3 +1,3 @@
 ERROR: undefined-dot.asm(3):
 	'.' not defined
-rgbasm: error: Assembly aborted in pass 2 (1 errors)!
+error: Assembly aborted in pass 2 (1 errors)!
--- a/test/link/romx-tiny-no-t.out
+++ b/test/link/romx-tiny-no-t.out
@@ -1,1 +1,1 @@
-rgblink: error: Unable to place 'r0b' (ROM0 section) anywhere
+error: Unable to place 'r0b' (ROM0 section) anywhere
--- a/test/link/romx-tiny-t.out
+++ b/test/link/romx-tiny-t.out
@@ -1,1 +1,1 @@
-rgblink: error: ROMX sections can't be used with option -t.
+error: ROMX sections can't be used with option -t.
--- a/test/link/vram-fixed-dmg-mode-w.out
+++ b/test/link/vram-fixed-dmg-mode-w.out
@@ -1,1 +1,1 @@
-rgblink: error: VRAM bank 1 can't be used with option -w.
+error: VRAM bank 1 can't be used with option -w.
--- a/test/link/vram-floating-dmg-mode-w.out
+++ b/test/link/vram-floating-dmg-mode-w.out
@@ -1,1 +1,1 @@
-rgblink: error: Unable to place 'v1' (VRAM section) in any bank
+error: Unable to place 'v1' (VRAM section) in any bank
--- a/test/link/wramx-dmg-mode-no-w.out
+++ b/test/link/wramx-dmg-mode-no-w.out
@@ -1,1 +1,1 @@
-rgblink: error: Unable to place 'w0b' (WRAM0 section) anywhere
+error: Unable to place 'w0b' (WRAM0 section) anywhere
--- a/test/link/wramx-dmg-mode-w.out
+++ b/test/link/wramx-dmg-mode-w.out
@@ -1,1 +1,1 @@
-rgblink: error: WRAMX sections can't be used with option -w.
+error: WRAMX sections can't be used with option -w.