shithub: rgbds

Download patch

ref: 240fca0861d6924403b39ba8c2752a67137fb45a
parent: f996186fae53fa87b1f7a8b3373d91211601d21d
author: James Larrowe <larrowe.semaj11@gmail.com>
date: Tue Jun 23 19:25:46 EDT 2020

Fix Clang warning in linkdefs

This one's really stupid; printing an int with %hhu gives a warning
even though a regular unsigned char is promoted to an int before
printing anyway. Silence it so the build with Clang works.

This is a regression introduced in 5c24de3

--- a/include/linkdefs.h
+++ b/include/linkdefs.h
@@ -12,8 +12,8 @@
 #include <stdbool.h>
 #include <stdint.h>
 
-#define RGBDS_OBJECT_VERSION_STRING "RGB%1hhu"
-#define RGBDS_OBJECT_VERSION_NUMBER 9
+#define RGBDS_OBJECT_VERSION_STRING "RGB%1u"
+#define RGBDS_OBJECT_VERSION_NUMBER 9U
 #define RGBDS_OBJECT_REV 4U
 
 enum AssertionType {
--- a/src/link/object.c
+++ b/src/link/object.c
@@ -400,7 +400,7 @@
 		err(1, "Could not open file %s", fileName);
 
 	/* Begin by reading the magic bytes and version number */
-	uint8_t versionNumber;
+	unsigned versionNumber;
 	int matchedElems = fscanf(file, RGBDS_OBJECT_VERSION_STRING,
 				  &versionNumber);
 
@@ -407,11 +407,11 @@
 	if (matchedElems != 1)
 		errx(1, "\"%s\" is not a RGBDS object file", fileName);
 
-	verbosePrint("Reading object file %s, version %hhu\n",
+	verbosePrint("Reading object file %s, version %u\n",
 		     fileName, versionNumber);
 
 	if (versionNumber != RGBDS_OBJECT_VERSION_NUMBER)
-		errx(1, "\"%s\" is an incompatible version %hhu object file",
+		errx(1, "\"%s\" is an incompatible version %u object file",
 		     fileName, versionNumber);
 
 	uint32_t revNum;