[PATCH] Bluetooth: hci-core: fix "declaration does not declare anything" error

David Marlin <[email protected]>
Newsgroups org.kernel.vger.linux-bluetooth
Message-ID <[email protected]>
A recent build attempt, using gcc-14.4 on RHEL-10, produced the
following errors:

In file included from ./include/net/bluetooth/hci_core.h:35,
                 from net/bluetooth/hci_core.c:39:
./include/net/bluetooth/hci.h:1476:34: error: declaration does not
declare anything [-Werror]
  1476 |         struct hci_std_codecs_hdr;
       |                                  ^
./include/net/bluetooth/hci.h:1477:17: error: flexible array member in a
struct with no named members
  1477 |         __u8    codec[];
       |                 ^~~~~

./include/net/bluetooth/hci.h:1516:37: error: declaration does not
declare anything [-Werror]
  1516 |         struct hci_std_codecs_v2_hdr;
       |                                     ^
./include/net/bluetooth/hci.h:1517:33: error: flexible array member in a
struct with no named members
  1517 |         struct hci_std_codec_v2 codec[];
       |                                 ^~~~~

cc1: all warnings being treated as errors

Adding a variable name (e.g., 'num') to each of the above struct definitions
avoids the error without changing the layout of the struct.

Fixes: a0cff16d0f6e ("Bluetooth: hci.h: Avoid a couple -Wflex-array-member-not-at-end warnings")

Reviewed-by: Bastien Nocera <[email protected]>
Signed-off-by: David Marlin <[email protected]>
---
 include/net/bluetooth/hci.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 1641d879dbda..5ccc4545e380 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -1472,7 +1472,7 @@ struct hci_std_codecs_hdr {
 } __packed;
 
 struct hci_std_codecs {
-	struct hci_std_codecs_hdr;
+	struct hci_std_codecs_hdr num;
 	__u8	codec[];
 } __packed;
 
@@ -1512,7 +1512,7 @@ struct hci_std_codecs_v2_hdr {
 } __packed;
 
 struct hci_std_codecs_v2 {
-	struct hci_std_codecs_v2_hdr;
+	struct hci_std_codecs_v2_hdr num;
 	struct hci_std_codec_v2 codec[];
 } __packed;
 
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.