git: 79135b4788e2 - stable/13 - bhyve: Let BASL compile with raised warnings

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 26 Jan 2023 20:27:07 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=79135b4788e2d8dfa1981b01e4ffb22be0c54592

commit 79135b4788e2d8dfa1981b01e4ffb22be0c54592
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-11-18 19:07:20 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-01-26 20:07:12 +0000

    bhyve: Let BASL compile with raised warnings
    
    - Make basl_dump() as unused.
    - Avoid arithmetic on a void pointer.
    - Avoid a signed/unsigned comparison with
      BASL_TABLE_CHECKSUM_LEN_FULL_TABLE.
    - Ignore warnings about unused parameters from stuff pulled in by
      acpi.h.  In particular, any prototype wrapped by
      ACPI_DBG_DEPENDENT_RETURN_VOID() will raise such parameters unless
      ACPI_DEBUG_OUTPUT is defined.
    
    Reviewed by:    corvink, jhb
    Differential Revision:  https://reviews.freebsd.org/D37397
    
    (cherry picked from commit c127c61efa4d8414be9a7373b50c7f348b6e461e)
---
 usr.sbin/bhyve/basl.c | 7 +++----
 usr.sbin/bhyve/basl.h | 5 ++++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/usr.sbin/bhyve/basl.c b/usr.sbin/bhyve/basl.c
index 57d13d89e271..e002c3724ef0 100644
--- a/usr.sbin/bhyve/basl.c
+++ b/usr.sbin/bhyve/basl.c
@@ -49,8 +49,7 @@ struct basl_table {
 	uint32_t len;
 	uint32_t off;
 	uint32_t alignment;
-	STAILQ_HEAD(basl_table_checksum_list,
-	    basl_table_checksum) checksums;
+	STAILQ_HEAD(basl_table_checksum_list, basl_table_checksum) checksums;
 	STAILQ_HEAD(basl_table_length_list, basl_table_length) lengths;
 	STAILQ_HEAD(basl_table_pointer_list, basl_table_pointer) pointers;
 };
@@ -110,7 +109,7 @@ basl_dump_table(const struct basl_table *const table, const bool mem)
 	return (0);
 }
 
-static int
+static int __unused
 basl_dump(const bool mem)
 {
 	struct basl_table *table;
@@ -301,7 +300,7 @@ basl_finish_set_length(struct basl_table *const table)
 		assert(length->off < table->len);
 		assert(length->off + length->size <= table->len);
 
-		basl_le_enc(table->data + length->off, table->len,
+		basl_le_enc((uint8_t *)table->data + length->off, table->len,
 		    length->size);
 	}
 
diff --git a/usr.sbin/bhyve/basl.h b/usr.sbin/bhyve/basl.h
index c4d0d9d26c0d..6f7815c13cf6 100644
--- a/usr.sbin/bhyve/basl.h
+++ b/usr.sbin/bhyve/basl.h
@@ -6,7 +6,10 @@
 
 #pragma once
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-parameter"
 #include <contrib/dev/acpica/include/acpi.h>
+#pragma clang diagnostic pop
 
 #define ACPI_GAS_ACCESS_WIDTH_LEGACY 0
 #define ACPI_GAS_ACCESS_WIDTH_UNDEFINED 0
@@ -43,7 +46,7 @@
 #define BASL_TABLE_ALIGNMENT 0x10
 #define BASL_TABLE_ALIGNMENT_FACS 0x40
 
-#define BASL_TABLE_CHECKSUM_LEN_FULL_TABLE (-1)
+#define BASL_TABLE_CHECKSUM_LEN_FULL_TABLE (-1U)
 
 #define BASL_EXEC(x)                                                         \
 	do {                                                                 \