git: c127c61efa4d - main - bhyve: Let BASL compile with raised warnings

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 18 Nov 2022 19:13:05 UTC
The branch main has been updated by markj:

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

commit c127c61efa4d8414be9a7373b50c7f348b6e461e
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-11-18 19:07:20 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-11-18 19:11:48 +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
---
 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 e8724b857381..8c01f16895cd 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;
@@ -279,7 +278,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 aab4a16a63f5..eef252bd1248 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
@@ -20,7 +23,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 {                                                                 \