linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5] lib/vsprintf: Add support for generic FourCCs by extending %p4cc
@ 2025-02-28 16:29 Aditya Garg
  2025-02-28 16:41 ` Aditya Garg
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Aditya Garg @ 2025-02-28 16:29 UTC (permalink / raw)
  To: Petr Mladek, Steven Rostedt, andriy.shevchenko@linux.intel.com,
	Rasmus Villemoes, senozhatsky@chromium.org, Jonathan Corbet,
	Andrew Morton, apw@canonical.com, joe@perches.com,
	dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com
  Cc: linux-doc@vger.kernel.org, Linux Kernel Mailing List,
	Hector Martin, Sven Peter, Janne Grunau, Alyssa Rosenzweig,
	Asahi Linux Mailing List

From: Hector Martin <marcan@marcan.st>

%p4cc is designed for DRM/V4L2 FourCCs with their specific quirks, but
it's useful to be able to print generic 4-character codes formatted as
an integer. Extend it to add format specifiers for printing generic
32-bit FourCCs with various endian semantics:

%p4ch	Host-endian
%p4cn	Reverse-endian
%p4cl   Little-endian
%p4cb	Big-endian

The endianness determines how bytes are interpreted as a u32, and the
FourCC is then always printed MSByte-first (this is the opposite of
V4L/DRM FourCCs). This covers most practical cases, e.g. %p4cn would
allow printing LSByte-first FourCCs stored in host endian order
(other than the hex form being in character order, not the integer
value).

Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
v2 ->
- Add this patch to appletbdrm patchset

v3 ->
- Make array static

v4 ->
- Fix code error
- Fix sparse warnings
- Make this patch separate from drm

v5 ->
- Improve documentation
- Use better logic to assign value of val
- Use 'n' instead of 'r' for reverse endian
- Use ARRAY_SIZE() instead of hardcoding 1

 Documentation/core-api/printk-formats.rst | 32 +++++++++++++++++++
 lib/test_printf.c                         | 39 +++++++++++++++++++----
 lib/vsprintf.c                            | 35 ++++++++++++++++----
 scripts/checkpatch.pl                     |  2 +-
 4 files changed, 94 insertions(+), 14 deletions(-)

diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
index ecccc0473..14853295a 100644
--- a/Documentation/core-api/printk-formats.rst
+++ b/Documentation/core-api/printk-formats.rst
@@ -648,6 +648,38 @@ Examples::
 	%p4cc	Y10  little-endian (0x20303159)
 	%p4cc	NV12 big-endian (0xb231564e)
 
+Generic FourCC code
+-------------------
+
+::
+	%p4c[hnlb]	gP00 (0x67503030)
+
+Print a generic FourCC code, as both ASCII characters and its numerical
+value as hexadecimal.
+
+The generic FourCC code is always printed in the big-endian format,
+the most significant byte first. This is the opposite of V4L/DRM FourCCs.
+
+The additional ``h``, ``n``, ``l``, and ``b`` specifiers define what
+endianness is used to load the stored bytes. The data might be interpreted
+using the host-endian, reverse-host-endian, little-endian, or big-endian.
+
+Passed by reference.
+
+Examples for a little-endian machine, given &(u32)0x67503030::
+
+	%p4ch	gP00 (0x67503030)
+	%p4cn	00Pg (0x30305067)
+	%p4cl	gP00 (0x67503030)
+	%p4cb	00Pg (0x30305067)
+
+Examples for a big-endian machine, given &(u32)0x67503030::
+
+	%p4ch	gP00 (0x67503030)
+	%p4cn	00Pg (0x30305067)
+	%p4cl	00Pg (0x30305067)
+	%p4cb	gP00 (0x67503030)
+
 Rust
 ----
 
diff --git a/lib/test_printf.c b/lib/test_printf.c
index 59dbe4f9a..80d9fd374 100644
--- a/lib/test_printf.c
+++ b/lib/test_printf.c
@@ -776,21 +776,46 @@ static void __init fwnode_pointer(void)
 	software_node_unregister_node_group(group);
 }
 
+struct fourcc_struct {
+	u32 code;
+	const char *str;
+};
+
+static void __init fourcc_pointer_test(const struct fourcc_struct *fc, size_t n,
+				       const char *fmt)
+{
+	size_t i;
+
+	for (i = 0; i < n; i++)
+		test(fc[i].str, fmt, &fc[i].code);
+}
+
 static void __init fourcc_pointer(void)
 {
-	struct {
-		u32 code;
-		char *str;
-	} const try[] = {
+	static const struct fourcc_struct try_cc[] = {
 		{ 0x3231564e, "NV12 little-endian (0x3231564e)", },
 		{ 0xb231564e, "NV12 big-endian (0xb231564e)", },
 		{ 0x10111213, ".... little-endian (0x10111213)", },
 		{ 0x20303159, "Y10  little-endian (0x20303159)", },
 	};
-	unsigned int i;
+	static const struct fourcc_struct try_ch = {
+		{ 0x41424344, "ABCD (0x41424344)", },
+	};
+	static const struct fourcc_struct try_cn = {
+		{ 0x41424344, "DCBA (0x44434241)", },
+	};
+	static const struct fourcc_struct try_cl = {
+		{ le32_to_cpu(0x41424344), "ABCD (0x41424344)", },
+	};
+	static const struct fourcc_struct try_cb = {
+		{ be32_to_cpu(0x41424344), "ABCD (0x41424344)", },
+	};
 
-	for (i = 0; i < ARRAY_SIZE(try); i++)
-		test(try[i].str, "%p4cc", &try[i].code);
+	fourcc_pointer_test(try_cc, ARRAY_SIZE(try_cc), "%p4cc");
+	fourcc_pointer_test(try_ch, ARRAY_SIZE(try_ch), "%p4ch");
+	fourcc_pointer_test(try_cn, ARRAY_SIZE(try_cn), "%p4cn");
+	fourcc_pointer_test(try_cl, ARRAY_SIZE(try_cl), "%p4cl");
+	fourcc_pointer_test(try_cb, ARRAY_SIZE(try_cb), "%p4cb");
 }
 
 static void __init
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 56fe96319..56511a994 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1781,27 +1781,50 @@ char *fourcc_string(char *buf, char *end, const u32 *fourcc,
 	char output[sizeof("0123 little-endian (0x01234567)")];
 	char *p = output;
 	unsigned int i;
+	bool pixel_fmt = false;
 	u32 orig, val;
 
-	if (fmt[1] != 'c' || fmt[2] != 'c')
+	if (fmt[1] != 'c')
 		return error_string(buf, end, "(%p4?)", spec);
 
 	if (check_pointer(&buf, end, fourcc, spec))
 		return buf;
 
 	orig = get_unaligned(fourcc);
-	val = orig & ~BIT(31);
+	switch (fmt[2]) {
+	case 'h':
+		break;
+	case 'n':
+		orig = swab32(orig);
+		break;
+	case 'l':
+		orig = (__force u32)cpu_to_le32(orig);
+		break;
+	case 'b':
+		orig = (__force u32)cpu_to_be32(orig);
+		break;
+	case 'c':
+		/* Pixel formats are printed LSB-first */
+		pixel_fmt = true;
+		break;
+	default:
+		return error_string(buf, end, "(%p4?)", spec);
+	}
+
+	val = pixel_fmt ? swab32(orig & ~BIT(31)) : orig;
 
 	for (i = 0; i < sizeof(u32); i++) {
-		unsigned char c = val >> (i * 8);
+		unsigned char c = val >> ((3 - i) * 8);
 
 		/* Print non-control ASCII characters as-is, dot otherwise */
 		*p++ = isascii(c) && isprint(c) ? c : '.';
 	}
 
-	*p++ = ' ';
-	strcpy(p, orig & BIT(31) ? "big-endian" : "little-endian");
-	p += strlen(p);
+	if (pixel_fmt) {
+		*p++ = ' ';
+		strcpy(p, orig & BIT(31) ? "big-endian" : "little-endian");
+		p += strlen(p);
+	}
 
 	*p++ = ' ';
 	*p++ = '(';
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 7b28ad331..5595a0898 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6904,7 +6904,7 @@ sub process {
 					    ($extension eq "f" &&
 					     defined $qualifier && $qualifier !~ /^w/) ||
 					    ($extension eq "4" &&
-					     defined $qualifier && $qualifier !~ /^cc/)) {
+					     defined $qualifier && $qualifier !~ /^c[hnlbc]/)) {
 						$bad_specifier = $specifier;
 						last;
 					}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v5] lib/vsprintf: Add support for generic FourCCs by extending %p4cc
  2025-02-28 16:29 [PATCH v5] lib/vsprintf: Add support for generic FourCCs by extending %p4cc Aditya Garg
@ 2025-02-28 16:41 ` Aditya Garg
  2025-02-28 18:47 ` Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Aditya Garg @ 2025-02-28 16:41 UTC (permalink / raw)
  To: Petr Mladek, Steven Rostedt, andriy.shevchenko@linux.intel.com,
	Rasmus Villemoes, senozhatsky@chromium.org, Jonathan Corbet,
	Andrew Morton, apw@canonical.com, joe@perches.com,
	dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com
  Cc: linux-doc@vger.kernel.org, Linux Kernel Mailing List,
	Hector Martin, Sven Peter, Janne Grunau, Alyssa Rosenzweig,
	Asahi Linux Mailing List



> On 28 Feb 2025, at 9:59 PM, Aditya Garg <gargaditya08@live.com> wrote:
> 
> From: Hector Martin <marcan@marcan.st>
> 
> %p4cc is designed for DRM/V4L2 FourCCs with their specific quirks, but
> it's useful to be able to print generic 4-character codes formatted as
> an integer. Extend it to add format specifiers for printing generic
> 32-bit FourCCs with various endian semantics:
> 
> %p4ch Host-endian
> %p4cn Reverse-endian
> %p4cl   Little-endian
> %p4cb Big-endian
> 
> The endianness determines how bytes are interpreted as a u32, and the
> FourCC is then always printed MSByte-first (this is the opposite of
> V4L/DRM FourCCs). This covers most practical cases, e.g. %p4cn would
> allow printing LSByte-first FourCCs stored in host endian order
> (other than the hex form being in character order, not the integer
> value).
> 
> Signed-off-by: Hector Martin <marcan@marcan.st>
> Signed-off-by: Aditya Garg <gargaditya08@live.com>
> ---
> v2 ->
> - Add this patch to appletbdrm patchset
> 
> v3 ->
> - Make array static
> 
> v4 ->
> - Fix code error
> - Fix sparse warnings
> - Make this patch separate from drm
> 
> v5 ->
> - Improve documentation
> - Use better logic to assign value of val
> - Use 'n' instead of 'r' for reverse endian
> - Use ARRAY_SIZE() instead of hardcoding 1
> 
> Documentation/core-api/printk-formats.rst | 32 +++++++++++++++++++
> lib/test_printf.c                         | 39 +++++++++++++++++++----
> lib/vsprintf.c                            | 35 ++++++++++++++++----
> scripts/checkpatch.pl                     |  2 +-
> 4 files changed, 94 insertions(+), 14 deletions(-)
> 
> diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
> index ecccc0473..14853295a 100644
> --- a/Documentation/core-api/printk-formats.rst
> +++ b/Documentation/core-api/printk-formats.rst
> @@ -648,6 +648,38 @@ Examples::
> %p4cc Y10  little-endian (0x20303159)
> %p4cc NV12 big-endian (0xb231564e)
> 
> +Generic FourCC code
> +-------------------
> +
> +::
> + %p4c[hnlb] gP00 (0x67503030)
> +
> +Print a generic FourCC code, as both ASCII characters and its numerical
> +value as hexadecimal.
> +
> +The generic FourCC code is always printed in the big-endian format,
> +the most significant byte first. This is the opposite of V4L/DRM FourCCs.
> +
> +The additional ``h``, ``n``, ``l``, and ``b`` specifiers define what
> +endianness is used to load the stored bytes. The data might be interpreted
> +using the host-endian, reverse-host-endian, little-endian, or big-endian.
> +
> +Passed by reference.
> +
> +Examples for a little-endian machine, given &(u32)0x67503030::
> +
> + %p4ch gP00 (0x67503030)
> + %p4cn 00Pg (0x30305067)
> + %p4cl gP00 (0x67503030)
> + %p4cb 00Pg (0x30305067)
> +
> +Examples for a big-endian machine, given &(u32)0x67503030::
> +
> + %p4ch gP00 (0x67503030)
> + %p4cn 00Pg (0x30305067)
> + %p4cl 00Pg (0x30305067)
> + %p4cb gP00 (0x67503030)
> +
> Rust
> ----
> 
> diff --git a/lib/test_printf.c b/lib/test_printf.c
> index 59dbe4f9a..80d9fd374 100644
> --- a/lib/test_printf.c
> +++ b/lib/test_printf.c
> @@ -776,21 +776,46 @@ static void __init fwnode_pointer(void)
> software_node_unregister_node_group(group);
> }
> 
> +struct fourcc_struct {
> + u32 code;
> + const char *str;
> +};
> +
> +static void __init fourcc_pointer_test(const struct fourcc_struct *fc, size_t n,
> +       const char *fmt)
> +{
> + size_t i;
> +
> + for (i = 0; i < n; i++)
> + test(fc[i].str, fmt, &fc[i].code);
> +}
> +
> static void __init fourcc_pointer(void)
> {
> - struct {
> - u32 code;
> - char *str;
> - } const try[] = {
> + static const struct fourcc_struct try_cc[] = {
> { 0x3231564e, "NV12 little-endian (0x3231564e)", },
> { 0xb231564e, "NV12 big-endian (0xb231564e)", },
> { 0x10111213, ".... little-endian (0x10111213)", },
> { 0x20303159, "Y10  little-endian (0x20303159)", },
> };
> - unsigned int i;
> + static const struct fourcc_struct try_ch = {
> + { 0x41424344, "ABCD (0x41424344)", },
> + };
> + static const struct fourcc_struct try_cn = {
> + { 0x41424344, "DCBA (0x44434241)", },
> + };
> + static const struct fourcc_struct try_cl = {
> + { le32_to_cpu(0x41424344), "ABCD (0x41424344)", },
> + };
> + static const struct fourcc_struct try_cb = {
> + { be32_to_cpu(0x41424344), "ABCD (0x41424344)", },

Ugh, how did the [] get ruined here now. Pretty sure I added them. Anyways, I’ll wait for a review in case more changes are needed as well.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v5] lib/vsprintf: Add support for generic FourCCs by extending %p4cc
  2025-02-28 16:29 [PATCH v5] lib/vsprintf: Add support for generic FourCCs by extending %p4cc Aditya Garg
  2025-02-28 16:41 ` Aditya Garg
@ 2025-02-28 18:47 ` Andy Shevchenko
  2025-03-01 17:35 ` kernel test robot
  2025-03-01 18:07 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2025-02-28 18:47 UTC (permalink / raw)
  To: Aditya Garg
  Cc: Petr Mladek, Steven Rostedt, Rasmus Villemoes,
	senozhatsky@chromium.org, Jonathan Corbet, Andrew Morton,
	apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com,
	lukas.bulwahn@gmail.com, linux-doc@vger.kernel.org,
	Linux Kernel Mailing List, Hector Martin, Sven Peter,
	Janne Grunau, Alyssa Rosenzweig, Asahi Linux Mailing List

On Fri, Feb 28, 2025 at 04:29:12PM +0000, Aditya Garg wrote:
> From: Hector Martin <marcan@marcan.st>
> 
> %p4cc is designed for DRM/V4L2 FourCCs with their specific quirks, but
> it's useful to be able to print generic 4-character codes formatted as
> an integer. Extend it to add format specifiers for printing generic
> 32-bit FourCCs with various endian semantics:

> %p4ch	Host-endian
> %p4cn	Reverse-endian

Call them Host order, Network order as they are very established endianesses.


> %p4cl   Little-endian

You have extra spaces here

> %p4cb	Big-endian
> 
> The endianness determines how bytes are interpreted as a u32, and the
> FourCC is then always printed MSByte-first (this is the opposite of
> V4L/DRM FourCCs). This covers most practical cases, e.g. %p4cn would
> allow printing LSByte-first FourCCs stored in host endian order
> (other than the hex form being in character order, not the integer
> value).

...

> +Generic FourCC code
> +-------------------
> +
> +::
> +	%p4c[hnlb]	gP00 (0x67503030)
> +
> +Print a generic FourCC code, as both ASCII characters and its numerical
> +value as hexadecimal.
> +
> +The generic FourCC code is always printed in the big-endian format,
> +the most significant byte first. This is the opposite of V4L/DRM FourCCs.
> +
> +The additional ``h``, ``n``, ``l``, and ``b`` specifiers define what
> +endianness is used to load the stored bytes. The data might be interpreted
> +using the host-endian, reverse-host-endian, little-endian, or big-endian.

host order, network order

> +Passed by reference.
> +
> +Examples for a little-endian machine, given &(u32)0x67503030::
> +
> +	%p4ch	gP00 (0x67503030)
> +	%p4cn	00Pg (0x30305067)
> +	%p4cl	gP00 (0x67503030)
> +	%p4cb	00Pg (0x30305067)
> +
> +Examples for a big-endian machine, given &(u32)0x67503030::
> +
> +	%p4ch	gP00 (0x67503030)
> +	%p4cn	00Pg (0x30305067)
> +	%p4cl	00Pg (0x30305067)
> +	%p4cb	gP00 (0x67503030)


For the reference on the terms:
https://www.ibm.com/docs/ja/zvm/7.2?topic=domains-network-byte-order-host-byte-order

Otherwise LGTM. With the above addressed, FWIW,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v5] lib/vsprintf: Add support for generic FourCCs by extending %p4cc
  2025-02-28 16:29 [PATCH v5] lib/vsprintf: Add support for generic FourCCs by extending %p4cc Aditya Garg
  2025-02-28 16:41 ` Aditya Garg
  2025-02-28 18:47 ` Andy Shevchenko
@ 2025-03-01 17:35 ` kernel test robot
  2025-03-01 18:07 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2025-03-01 17:35 UTC (permalink / raw)
  To: Aditya Garg, Petr Mladek, Steven Rostedt,
	andriy.shevchenko@linux.intel.com, Rasmus Villemoes,
	senozhatsky@chromium.org, Jonathan Corbet, Andrew Morton,
	apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com,
	lukas.bulwahn@gmail.com
  Cc: oe-kbuild-all, Linux Memory Management List,
	linux-doc@vger.kernel.org, Linux Kernel Mailing List,
	Hector Martin, Sven Peter, Janne Grunau, Alyssa Rosenzweig,
	Asahi Linux Mailing List

Hi Aditya,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-nonmm-unstable]
[also build test ERROR on linus/master v6.14-rc4 next-20250228]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Aditya-Garg/lib-vsprintf-Add-support-for-generic-FourCCs-by-extending-p4cc/20250301-003018
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
patch link:    https://lore.kernel.org/r/2C9622E6-A2DB-4681-A971-604C79F9955E%40live.com
patch subject: [PATCH v5] lib/vsprintf: Add support for generic FourCCs by extending %p4cc
config: arc-randconfig-001-20250301 (https://download.01.org/0day-ci/archive/20250302/202503020121.qsiw3acQ-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250302/202503020121.qsiw3acQ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503020121.qsiw3acQ-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   lib/test_printf.c: In function 'fourcc_pointer':
>> lib/test_printf.c:802:17: warning: braces around scalar initializer
     802 |                 { 0x41424344, "ABCD (0x41424344)", },
         |                 ^
   lib/test_printf.c:802:17: note: (near initialization for 'try_ch.code')
>> lib/test_printf.c:802:31: warning: excess elements in scalar initializer
     802 |                 { 0x41424344, "ABCD (0x41424344)", },
         |                               ^~~~~~~~~~~~~~~~~~~
   lib/test_printf.c:802:31: note: (near initialization for 'try_ch.code')
   lib/test_printf.c:805:17: warning: braces around scalar initializer
     805 |                 { 0x41424344, "DCBA (0x44434241)", },
         |                 ^
   lib/test_printf.c:805:17: note: (near initialization for 'try_cn.code')
   lib/test_printf.c:805:31: warning: excess elements in scalar initializer
     805 |                 { 0x41424344, "DCBA (0x44434241)", },
         |                               ^~~~~~~~~~~~~~~~~~~
   lib/test_printf.c:805:31: note: (near initialization for 'try_cn.code')
   lib/test_printf.c:808:17: warning: braces around scalar initializer
     808 |                 { le32_to_cpu(0x41424344), "ABCD (0x41424344)", },
         |                 ^
   lib/test_printf.c:808:17: note: (near initialization for 'try_cl.code')
   lib/test_printf.c:808:44: warning: excess elements in scalar initializer
     808 |                 { le32_to_cpu(0x41424344), "ABCD (0x41424344)", },
         |                                            ^~~~~~~~~~~~~~~~~~~
   lib/test_printf.c:808:44: note: (near initialization for 'try_cl.code')
   lib/test_printf.c:811:17: warning: braces around scalar initializer
     811 |                 { be32_to_cpu(0x41424344), "ABCD (0x41424344)", },
         |                 ^
   lib/test_printf.c:811:17: note: (near initialization for 'try_cb.code')
   lib/test_printf.c:811:44: warning: excess elements in scalar initializer
     811 |                 { be32_to_cpu(0x41424344), "ABCD (0x41424344)", },
         |                                            ^~~~~~~~~~~~~~~~~~~
   lib/test_printf.c:811:44: note: (near initialization for 'try_cb.code')
   In file included from include/linux/kernel.h:16,
                    from lib/test_printf.c:9:
>> include/linux/array_size.h:11:52: error: subscripted value is neither array nor pointer nor vector
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                    ^
   lib/test_printf.c:815:37: note: in expansion of macro 'ARRAY_SIZE'
     815 |         fourcc_pointer_test(try_ch, ARRAY_SIZE(try_ch), "%p4ch");
         |                                     ^~~~~~~~~~
   In file included from include/linux/build_bug.h:5,
                    from include/linux/init.h:5,
                    from lib/test_printf.c:8:
>> include/linux/compiler.h:201:56: error: subscripted value is neither array nor pointer nor vector
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                                        ^
   include/linux/compiler.h:197:79: note: in definition of macro '__BUILD_BUG_ON_ZERO_MSG'
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                               ^
   include/linux/compiler.h:201:35: note: in expansion of macro '__same_type'
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                   ^~~~~~~~~~~
   include/linux/compiler.h:202:58: note: in expansion of macro '__is_array'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                                          ^~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/test_printf.c:815:37: note: in expansion of macro 'ARRAY_SIZE'
     815 |         fourcc_pointer_test(try_ch, ARRAY_SIZE(try_ch), "%p4ch");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:197:77: error: expression in static assertion is not an integer
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                             ^
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/test_printf.c:815:37: note: in expansion of macro 'ARRAY_SIZE'
     815 |         fourcc_pointer_test(try_ch, ARRAY_SIZE(try_ch), "%p4ch");
         |                                     ^~~~~~~~~~
>> lib/test_printf.c:815:29: error: incompatible type for argument 1 of 'fourcc_pointer_test'
     815 |         fourcc_pointer_test(try_ch, ARRAY_SIZE(try_ch), "%p4ch");
         |                             ^~~~~~
         |                             |
         |                             struct fourcc_struct
   lib/test_printf.c:784:68: note: expected 'const struct fourcc_struct *' but argument is of type 'struct fourcc_struct'
     784 | static void __init fourcc_pointer_test(const struct fourcc_struct *fc, size_t n,
         |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
>> include/linux/array_size.h:11:52: error: subscripted value is neither array nor pointer nor vector
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                    ^
   lib/test_printf.c:816:37: note: in expansion of macro 'ARRAY_SIZE'
     816 |         fourcc_pointer_test(try_cn, ARRAY_SIZE(try_cn), "%p4cn");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:201:56: error: subscripted value is neither array nor pointer nor vector
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                                        ^
   include/linux/compiler.h:197:79: note: in definition of macro '__BUILD_BUG_ON_ZERO_MSG'
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                               ^
   include/linux/compiler.h:201:35: note: in expansion of macro '__same_type'
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                   ^~~~~~~~~~~
   include/linux/compiler.h:202:58: note: in expansion of macro '__is_array'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                                          ^~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/test_printf.c:816:37: note: in expansion of macro 'ARRAY_SIZE'
     816 |         fourcc_pointer_test(try_cn, ARRAY_SIZE(try_cn), "%p4cn");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:197:77: error: expression in static assertion is not an integer
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                             ^
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/test_printf.c:816:37: note: in expansion of macro 'ARRAY_SIZE'
     816 |         fourcc_pointer_test(try_cn, ARRAY_SIZE(try_cn), "%p4cn");
         |                                     ^~~~~~~~~~
   lib/test_printf.c:816:29: error: incompatible type for argument 1 of 'fourcc_pointer_test'
     816 |         fourcc_pointer_test(try_cn, ARRAY_SIZE(try_cn), "%p4cn");
         |                             ^~~~~~
         |                             |
         |                             struct fourcc_struct
   lib/test_printf.c:784:68: note: expected 'const struct fourcc_struct *' but argument is of type 'struct fourcc_struct'
     784 | static void __init fourcc_pointer_test(const struct fourcc_struct *fc, size_t n,
         |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
>> include/linux/array_size.h:11:52: error: subscripted value is neither array nor pointer nor vector
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                    ^
   lib/test_printf.c:817:37: note: in expansion of macro 'ARRAY_SIZE'
     817 |         fourcc_pointer_test(try_cl, ARRAY_SIZE(try_cl), "%p4cl");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:201:56: error: subscripted value is neither array nor pointer nor vector
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                                        ^
   include/linux/compiler.h:197:79: note: in definition of macro '__BUILD_BUG_ON_ZERO_MSG'
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                               ^
   include/linux/compiler.h:201:35: note: in expansion of macro '__same_type'
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                   ^~~~~~~~~~~
   include/linux/compiler.h:202:58: note: in expansion of macro '__is_array'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                                          ^~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/test_printf.c:817:37: note: in expansion of macro 'ARRAY_SIZE'
     817 |         fourcc_pointer_test(try_cl, ARRAY_SIZE(try_cl), "%p4cl");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:197:77: error: expression in static assertion is not an integer
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                             ^
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/test_printf.c:817:37: note: in expansion of macro 'ARRAY_SIZE'
     817 |         fourcc_pointer_test(try_cl, ARRAY_SIZE(try_cl), "%p4cl");
         |                                     ^~~~~~~~~~
   lib/test_printf.c:817:29: error: incompatible type for argument 1 of 'fourcc_pointer_test'
     817 |         fourcc_pointer_test(try_cl, ARRAY_SIZE(try_cl), "%p4cl");
         |                             ^~~~~~
         |                             |
         |                             struct fourcc_struct
   lib/test_printf.c:784:68: note: expected 'const struct fourcc_struct *' but argument is of type 'struct fourcc_struct'
     784 | static void __init fourcc_pointer_test(const struct fourcc_struct *fc, size_t n,
         |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
>> include/linux/array_size.h:11:52: error: subscripted value is neither array nor pointer nor vector
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                    ^
   lib/test_printf.c:818:37: note: in expansion of macro 'ARRAY_SIZE'
     818 |         fourcc_pointer_test(try_cb, ARRAY_SIZE(try_cb), "%p4cb");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:201:56: error: subscripted value is neither array nor pointer nor vector
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                                        ^
   include/linux/compiler.h:197:79: note: in definition of macro '__BUILD_BUG_ON_ZERO_MSG'
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                               ^
   include/linux/compiler.h:201:35: note: in expansion of macro '__same_type'
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                   ^~~~~~~~~~~
   include/linux/compiler.h:202:58: note: in expansion of macro '__is_array'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                                          ^~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/test_printf.c:818:37: note: in expansion of macro 'ARRAY_SIZE'
     818 |         fourcc_pointer_test(try_cb, ARRAY_SIZE(try_cb), "%p4cb");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:197:77: error: expression in static assertion is not an integer
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                             ^
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   lib/test_printf.c:818:37: note: in expansion of macro 'ARRAY_SIZE'
     818 |         fourcc_pointer_test(try_cb, ARRAY_SIZE(try_cb), "%p4cb");
         |                                     ^~~~~~~~~~
   lib/test_printf.c:818:29: error: incompatible type for argument 1 of 'fourcc_pointer_test'
     818 |         fourcc_pointer_test(try_cb, ARRAY_SIZE(try_cb), "%p4cb");
         |                             ^~~~~~
         |                             |
         |                             struct fourcc_struct
   lib/test_printf.c:784:68: note: expected 'const struct fourcc_struct *' but argument is of type 'struct fourcc_struct'
     784 | static void __init fourcc_pointer_test(const struct fourcc_struct *fc, size_t n,
         |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
--
   test_printf.c: In function 'fourcc_pointer':
   test_printf.c:802:17: warning: braces around scalar initializer
     802 |                 { 0x41424344, "ABCD (0x41424344)", },
         |                 ^
   test_printf.c:802:17: note: (near initialization for 'try_ch.code')
   test_printf.c:802:31: warning: excess elements in scalar initializer
     802 |                 { 0x41424344, "ABCD (0x41424344)", },
         |                               ^~~~~~~~~~~~~~~~~~~
   test_printf.c:802:31: note: (near initialization for 'try_ch.code')
   test_printf.c:805:17: warning: braces around scalar initializer
     805 |                 { 0x41424344, "DCBA (0x44434241)", },
         |                 ^
   test_printf.c:805:17: note: (near initialization for 'try_cn.code')
   test_printf.c:805:31: warning: excess elements in scalar initializer
     805 |                 { 0x41424344, "DCBA (0x44434241)", },
         |                               ^~~~~~~~~~~~~~~~~~~
   test_printf.c:805:31: note: (near initialization for 'try_cn.code')
   test_printf.c:808:17: warning: braces around scalar initializer
     808 |                 { le32_to_cpu(0x41424344), "ABCD (0x41424344)", },
         |                 ^
   test_printf.c:808:17: note: (near initialization for 'try_cl.code')
   test_printf.c:808:44: warning: excess elements in scalar initializer
     808 |                 { le32_to_cpu(0x41424344), "ABCD (0x41424344)", },
         |                                            ^~~~~~~~~~~~~~~~~~~
   test_printf.c:808:44: note: (near initialization for 'try_cl.code')
   test_printf.c:811:17: warning: braces around scalar initializer
     811 |                 { be32_to_cpu(0x41424344), "ABCD (0x41424344)", },
         |                 ^
   test_printf.c:811:17: note: (near initialization for 'try_cb.code')
   test_printf.c:811:44: warning: excess elements in scalar initializer
     811 |                 { be32_to_cpu(0x41424344), "ABCD (0x41424344)", },
         |                                            ^~~~~~~~~~~~~~~~~~~
   test_printf.c:811:44: note: (near initialization for 'try_cb.code')
   In file included from include/linux/kernel.h:16,
                    from test_printf.c:9:
>> include/linux/array_size.h:11:52: error: subscripted value is neither array nor pointer nor vector
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                    ^
   test_printf.c:815:37: note: in expansion of macro 'ARRAY_SIZE'
     815 |         fourcc_pointer_test(try_ch, ARRAY_SIZE(try_ch), "%p4ch");
         |                                     ^~~~~~~~~~
   In file included from include/linux/build_bug.h:5,
                    from include/linux/init.h:5,
                    from test_printf.c:8:
>> include/linux/compiler.h:201:56: error: subscripted value is neither array nor pointer nor vector
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                                        ^
   include/linux/compiler.h:197:79: note: in definition of macro '__BUILD_BUG_ON_ZERO_MSG'
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                               ^
   include/linux/compiler.h:201:35: note: in expansion of macro '__same_type'
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                   ^~~~~~~~~~~
   include/linux/compiler.h:202:58: note: in expansion of macro '__is_array'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                                          ^~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   test_printf.c:815:37: note: in expansion of macro 'ARRAY_SIZE'
     815 |         fourcc_pointer_test(try_ch, ARRAY_SIZE(try_ch), "%p4ch");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:197:77: error: expression in static assertion is not an integer
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                             ^
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   test_printf.c:815:37: note: in expansion of macro 'ARRAY_SIZE'
     815 |         fourcc_pointer_test(try_ch, ARRAY_SIZE(try_ch), "%p4ch");
         |                                     ^~~~~~~~~~
   test_printf.c:815:29: error: incompatible type for argument 1 of 'fourcc_pointer_test'
     815 |         fourcc_pointer_test(try_ch, ARRAY_SIZE(try_ch), "%p4ch");
         |                             ^~~~~~
         |                             |
         |                             struct fourcc_struct
   test_printf.c:784:68: note: expected 'const struct fourcc_struct *' but argument is of type 'struct fourcc_struct'
     784 | static void __init fourcc_pointer_test(const struct fourcc_struct *fc, size_t n,
         |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
>> include/linux/array_size.h:11:52: error: subscripted value is neither array nor pointer nor vector
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                    ^
   test_printf.c:816:37: note: in expansion of macro 'ARRAY_SIZE'
     816 |         fourcc_pointer_test(try_cn, ARRAY_SIZE(try_cn), "%p4cn");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:201:56: error: subscripted value is neither array nor pointer nor vector
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                                        ^
   include/linux/compiler.h:197:79: note: in definition of macro '__BUILD_BUG_ON_ZERO_MSG'
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                               ^
   include/linux/compiler.h:201:35: note: in expansion of macro '__same_type'
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                   ^~~~~~~~~~~
   include/linux/compiler.h:202:58: note: in expansion of macro '__is_array'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                                          ^~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   test_printf.c:816:37: note: in expansion of macro 'ARRAY_SIZE'
     816 |         fourcc_pointer_test(try_cn, ARRAY_SIZE(try_cn), "%p4cn");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:197:77: error: expression in static assertion is not an integer
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                             ^
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   test_printf.c:816:37: note: in expansion of macro 'ARRAY_SIZE'
     816 |         fourcc_pointer_test(try_cn, ARRAY_SIZE(try_cn), "%p4cn");
         |                                     ^~~~~~~~~~
   test_printf.c:816:29: error: incompatible type for argument 1 of 'fourcc_pointer_test'
     816 |         fourcc_pointer_test(try_cn, ARRAY_SIZE(try_cn), "%p4cn");
         |                             ^~~~~~
         |                             |
         |                             struct fourcc_struct
   test_printf.c:784:68: note: expected 'const struct fourcc_struct *' but argument is of type 'struct fourcc_struct'
     784 | static void __init fourcc_pointer_test(const struct fourcc_struct *fc, size_t n,
         |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
>> include/linux/array_size.h:11:52: error: subscripted value is neither array nor pointer nor vector
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                    ^
   test_printf.c:817:37: note: in expansion of macro 'ARRAY_SIZE'
     817 |         fourcc_pointer_test(try_cl, ARRAY_SIZE(try_cl), "%p4cl");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:201:56: error: subscripted value is neither array nor pointer nor vector
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                                        ^
   include/linux/compiler.h:197:79: note: in definition of macro '__BUILD_BUG_ON_ZERO_MSG'
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                               ^
   include/linux/compiler.h:201:35: note: in expansion of macro '__same_type'
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                   ^~~~~~~~~~~
   include/linux/compiler.h:202:58: note: in expansion of macro '__is_array'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                                          ^~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   test_printf.c:817:37: note: in expansion of macro 'ARRAY_SIZE'
     817 |         fourcc_pointer_test(try_cl, ARRAY_SIZE(try_cl), "%p4cl");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:197:77: error: expression in static assertion is not an integer
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                             ^
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   test_printf.c:817:37: note: in expansion of macro 'ARRAY_SIZE'
     817 |         fourcc_pointer_test(try_cl, ARRAY_SIZE(try_cl), "%p4cl");
         |                                     ^~~~~~~~~~
   test_printf.c:817:29: error: incompatible type for argument 1 of 'fourcc_pointer_test'
     817 |         fourcc_pointer_test(try_cl, ARRAY_SIZE(try_cl), "%p4cl");
         |                             ^~~~~~
         |                             |
         |                             struct fourcc_struct
   test_printf.c:784:68: note: expected 'const struct fourcc_struct *' but argument is of type 'struct fourcc_struct'
     784 | static void __init fourcc_pointer_test(const struct fourcc_struct *fc, size_t n,
         |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
>> include/linux/array_size.h:11:52: error: subscripted value is neither array nor pointer nor vector
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                    ^
   test_printf.c:818:37: note: in expansion of macro 'ARRAY_SIZE'
     818 |         fourcc_pointer_test(try_cb, ARRAY_SIZE(try_cb), "%p4cb");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:201:56: error: subscripted value is neither array nor pointer nor vector
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                                        ^
   include/linux/compiler.h:197:79: note: in definition of macro '__BUILD_BUG_ON_ZERO_MSG'
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                               ^
   include/linux/compiler.h:201:35: note: in expansion of macro '__same_type'
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                   ^~~~~~~~~~~
   include/linux/compiler.h:202:58: note: in expansion of macro '__is_array'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                                          ^~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   test_printf.c:818:37: note: in expansion of macro 'ARRAY_SIZE'
     818 |         fourcc_pointer_test(try_cb, ARRAY_SIZE(try_cb), "%p4cb");
         |                                     ^~~~~~~~~~
>> include/linux/compiler.h:197:77: error: expression in static assertion is not an integer
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                             ^
   include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: in expansion of macro '__must_be_array'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~
   test_printf.c:818:37: note: in expansion of macro 'ARRAY_SIZE'
     818 |         fourcc_pointer_test(try_cb, ARRAY_SIZE(try_cb), "%p4cb");
         |                                     ^~~~~~~~~~
   test_printf.c:818:29: error: incompatible type for argument 1 of 'fourcc_pointer_test'
     818 |         fourcc_pointer_test(try_cb, ARRAY_SIZE(try_cb), "%p4cb");
         |                             ^~~~~~
         |                             |
         |                             struct fourcc_struct
   test_printf.c:784:68: note: expected 'const struct fourcc_struct *' but argument is of type 'struct fourcc_struct'
     784 | static void __init fourcc_pointer_test(const struct fourcc_struct *fc, size_t n,
         |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~


vim +/fourcc_pointer_test +815 lib/test_printf.c

   792	
   793	static void __init fourcc_pointer(void)
   794	{
   795		static const struct fourcc_struct try_cc[] = {
   796			{ 0x3231564e, "NV12 little-endian (0x3231564e)", },
   797			{ 0xb231564e, "NV12 big-endian (0xb231564e)", },
   798			{ 0x10111213, ".... little-endian (0x10111213)", },
   799			{ 0x20303159, "Y10  little-endian (0x20303159)", },
   800		};
   801		static const struct fourcc_struct try_ch = {
 > 802			{ 0x41424344, "ABCD (0x41424344)", },
   803		};
   804		static const struct fourcc_struct try_cn = {
   805			{ 0x41424344, "DCBA (0x44434241)", },
   806		};
   807		static const struct fourcc_struct try_cl = {
   808			{ le32_to_cpu(0x41424344), "ABCD (0x41424344)", },
   809		};
   810		static const struct fourcc_struct try_cb = {
   811			{ be32_to_cpu(0x41424344), "ABCD (0x41424344)", },
   812		};
   813	
   814		fourcc_pointer_test(try_cc, ARRAY_SIZE(try_cc), "%p4cc");
 > 815		fourcc_pointer_test(try_ch, ARRAY_SIZE(try_ch), "%p4ch");
   816		fourcc_pointer_test(try_cn, ARRAY_SIZE(try_cn), "%p4cn");
   817		fourcc_pointer_test(try_cl, ARRAY_SIZE(try_cl), "%p4cl");
   818		fourcc_pointer_test(try_cb, ARRAY_SIZE(try_cb), "%p4cb");
   819	}
   820	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v5] lib/vsprintf: Add support for generic FourCCs by extending %p4cc
  2025-02-28 16:29 [PATCH v5] lib/vsprintf: Add support for generic FourCCs by extending %p4cc Aditya Garg
                   ` (2 preceding siblings ...)
  2025-03-01 17:35 ` kernel test robot
@ 2025-03-01 18:07 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2025-03-01 18:07 UTC (permalink / raw)
  To: Aditya Garg, Petr Mladek, Steven Rostedt,
	andriy.shevchenko@linux.intel.com, Rasmus Villemoes,
	senozhatsky@chromium.org, Jonathan Corbet, Andrew Morton,
	apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com,
	lukas.bulwahn@gmail.com
  Cc: llvm, oe-kbuild-all, Linux Memory Management List,
	linux-doc@vger.kernel.org, Linux Kernel Mailing List,
	Hector Martin, Sven Peter, Janne Grunau, Alyssa Rosenzweig,
	Asahi Linux Mailing List

Hi Aditya,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-nonmm-unstable]
[also build test ERROR on linus/master v6.14-rc4 next-20250228]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Aditya-Garg/lib-vsprintf-Add-support-for-generic-FourCCs-by-extending-p4cc/20250301-003018
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
patch link:    https://lore.kernel.org/r/2C9622E6-A2DB-4681-A971-604C79F9955E%40live.com
patch subject: [PATCH v5] lib/vsprintf: Add support for generic FourCCs by extending %p4cc
config: arm-randconfig-004-20250301 (https://download.01.org/0day-ci/archive/20250302/202503020112.24wZ1Wcs-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 14170b16028c087ca154878f5ed93d3089a965c6)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250302/202503020112.24wZ1Wcs-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503020112.24wZ1Wcs-lkp@intel.com/

All errors (new ones prefixed by >>):

   lib/test_printf.c:802:17: warning: excess elements in scalar initializer [-Wexcess-initializers]
     802 |                 { 0x41424344, "ABCD (0x41424344)", },
         |                               ^~~~~~~~~~~~~~~~~~~
   lib/test_printf.c:805:17: warning: excess elements in scalar initializer [-Wexcess-initializers]
     805 |                 { 0x41424344, "DCBA (0x44434241)", },
         |                               ^~~~~~~~~~~~~~~~~~~
   lib/test_printf.c:808:30: warning: excess elements in scalar initializer [-Wexcess-initializers]
     808 |                 { le32_to_cpu(0x41424344), "ABCD (0x41424344)", },
         |                                            ^~~~~~~~~~~~~~~~~~~
   lib/test_printf.c:811:30: warning: excess elements in scalar initializer [-Wexcess-initializers]
     811 |                 { be32_to_cpu(0x41424344), "ABCD (0x41424344)", },
         |                                            ^~~~~~~~~~~~~~~~~~~
>> lib/test_printf.c:815:30: error: subscripted value is not an array, pointer, or vector
     815 |         fourcc_pointer_test(try_ch, ARRAY_SIZE(try_ch), "%p4ch");
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:52: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                               ~~~~~^~
>> lib/test_printf.c:815:30: error: subscripted value is not an array, pointer, or vector
     815 |         fourcc_pointer_test(try_ch, ARRAY_SIZE(try_ch), "%p4ch");
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:202:53: note: expanded from macro '__must_be_array'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
     203 |                                                         "must be array")
         |                                                         ~~~~~~~~~~~~~~~~
   include/linux/compiler.h:201:47: note: expanded from macro '__is_array'
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                                        ^~
   include/linux/compiler_types.h:483:74: note: expanded from macro '__same_type'
     483 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
         |                                                                          ^
   include/linux/compiler.h:197:79: note: expanded from macro '__BUILD_BUG_ON_ZERO_MSG'
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                               ^
   lib/test_printf.c:816:30: error: subscripted value is not an array, pointer, or vector
     816 |         fourcc_pointer_test(try_cn, ARRAY_SIZE(try_cn), "%p4cn");
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:52: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                               ~~~~~^~
   lib/test_printf.c:816:30: error: subscripted value is not an array, pointer, or vector
     816 |         fourcc_pointer_test(try_cn, ARRAY_SIZE(try_cn), "%p4cn");
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:202:53: note: expanded from macro '__must_be_array'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
     203 |                                                         "must be array")
         |                                                         ~~~~~~~~~~~~~~~~
   include/linux/compiler.h:201:47: note: expanded from macro '__is_array'
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                                        ^~
   include/linux/compiler_types.h:483:74: note: expanded from macro '__same_type'
     483 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
         |                                                                          ^
   include/linux/compiler.h:197:79: note: expanded from macro '__BUILD_BUG_ON_ZERO_MSG'
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                               ^
   lib/test_printf.c:817:30: error: subscripted value is not an array, pointer, or vector
     817 |         fourcc_pointer_test(try_cl, ARRAY_SIZE(try_cl), "%p4cl");
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:52: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                               ~~~~~^~
   lib/test_printf.c:817:30: error: subscripted value is not an array, pointer, or vector
     817 |         fourcc_pointer_test(try_cl, ARRAY_SIZE(try_cl), "%p4cl");
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:202:53: note: expanded from macro '__must_be_array'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
     203 |                                                         "must be array")
         |                                                         ~~~~~~~~~~~~~~~~
   include/linux/compiler.h:201:47: note: expanded from macro '__is_array'
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                                        ^~
   include/linux/compiler_types.h:483:74: note: expanded from macro '__same_type'
     483 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
         |                                                                          ^
   include/linux/compiler.h:197:79: note: expanded from macro '__BUILD_BUG_ON_ZERO_MSG'
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                               ^
   lib/test_printf.c:818:30: error: subscripted value is not an array, pointer, or vector
     818 |         fourcc_pointer_test(try_cb, ARRAY_SIZE(try_cb), "%p4cb");
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:52: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                               ~~~~~^~
   lib/test_printf.c:818:30: error: subscripted value is not an array, pointer, or vector
     818 |         fourcc_pointer_test(try_cb, ARRAY_SIZE(try_cb), "%p4cb");
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/array_size.h:11:59: note: expanded from macro 'ARRAY_SIZE'
      11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
         |                                                           ^~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:202:53: note: expanded from macro '__must_be_array'
     202 | #define __must_be_array(a)      __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
         |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
     203 |                                                         "must be array")
         |                                                         ~~~~~~~~~~~~~~~~
   include/linux/compiler.h:201:47: note: expanded from macro '__is_array'
     201 | #define __is_array(a)           (!__same_type((a), &(a)[0]))
         |                                                        ^~
   include/linux/compiler_types.h:483:74: note: expanded from macro '__same_type'
     483 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
         |                                                                          ^
   include/linux/compiler.h:197:79: note: expanded from macro '__BUILD_BUG_ON_ZERO_MSG'
     197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
         |                                                                               ^
   4 warnings and 8 errors generated.


vim +815 lib/test_printf.c

   792	
   793	static void __init fourcc_pointer(void)
   794	{
   795		static const struct fourcc_struct try_cc[] = {
   796			{ 0x3231564e, "NV12 little-endian (0x3231564e)", },
   797			{ 0xb231564e, "NV12 big-endian (0xb231564e)", },
   798			{ 0x10111213, ".... little-endian (0x10111213)", },
   799			{ 0x20303159, "Y10  little-endian (0x20303159)", },
   800		};
   801		static const struct fourcc_struct try_ch = {
   802			{ 0x41424344, "ABCD (0x41424344)", },
   803		};
   804		static const struct fourcc_struct try_cn = {
   805			{ 0x41424344, "DCBA (0x44434241)", },
   806		};
   807		static const struct fourcc_struct try_cl = {
   808			{ le32_to_cpu(0x41424344), "ABCD (0x41424344)", },
   809		};
   810		static const struct fourcc_struct try_cb = {
   811			{ be32_to_cpu(0x41424344), "ABCD (0x41424344)", },
   812		};
   813	
   814		fourcc_pointer_test(try_cc, ARRAY_SIZE(try_cc), "%p4cc");
 > 815		fourcc_pointer_test(try_ch, ARRAY_SIZE(try_ch), "%p4ch");
   816		fourcc_pointer_test(try_cn, ARRAY_SIZE(try_cn), "%p4cn");
   817		fourcc_pointer_test(try_cl, ARRAY_SIZE(try_cl), "%p4cl");
   818		fourcc_pointer_test(try_cb, ARRAY_SIZE(try_cb), "%p4cb");
   819	}
   820	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-03-01 18:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-28 16:29 [PATCH v5] lib/vsprintf: Add support for generic FourCCs by extending %p4cc Aditya Garg
2025-02-28 16:41 ` Aditya Garg
2025-02-28 18:47 ` Andy Shevchenko
2025-03-01 17:35 ` kernel test robot
2025-03-01 18:07 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).