public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: stex: Fix gcc 13 warnings
@ 2023-05-29 19:50 Bart Van Assche
  2023-06-01  0:43 ` Martin K. Petersen
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2023-05-29 19:50 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, stable, Randy Dunlap,
	James E.J. Bottomley

gcc 13 may assign another type to enumeration constants than gcc 12. Split
the large enum at the top of source file stex.c such that the type of the
constants used in time expressions is changed back to the same type chosen
by gcc 12. This patch suppresses compiler warnings like this one:

In file included from ./include/linux/bitops.h:7,
                 from ./include/linux/kernel.h:22,
                 from drivers/scsi/stex.c:13:
drivers/scsi/stex.c: In function ‘stex_common_handshake’:
./include/linux/typecheck.h:12:25: error: comparison of distinct pointer types lacks a cast [-Werror]
   12 |         (void)(&__dummy == &__dummy2); \
      |                         ^~
./include/linux/jiffies.h:106:10: note: in expansion of macro ‘typecheck’
  106 |          typecheck(unsigned long, b) && \
      |          ^~~~~~~~~
drivers/scsi/stex.c:1035:29: note: in expansion of macro ‘time_after’
 1035 |                         if (time_after(jiffies, before + MU_MAX_DELAY * HZ)) {
      |                             ^~~~~~~~~~

See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107405.

Cc: stable@vger.kernel.org
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/stex.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 5b230e149c3d..8ffb75be99bc 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -109,7 +109,9 @@ enum {
 	TASK_ATTRIBUTE_HEADOFQUEUE		= 0x1,
 	TASK_ATTRIBUTE_ORDERED			= 0x2,
 	TASK_ATTRIBUTE_ACA			= 0x4,
+};
 
+enum {
 	SS_STS_NORMAL				= 0x80000000,
 	SS_STS_DONE				= 0x40000000,
 	SS_STS_HANDSHAKE			= 0x20000000,
@@ -121,7 +123,9 @@ enum {
 	SS_I2H_REQUEST_RESET			= 0x2000,
 
 	SS_MU_OPERATIONAL			= 0x80000000,
+};
 
+enum {
 	STEX_CDB_LENGTH				= 16,
 	STATUS_VAR_LEN				= 128,
 

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

* [PATCH] scsi: stex: Fix gcc 13 warnings
@ 2023-05-29 20:21 Bart Van Assche
  2023-05-29 20:27 ` Bart Van Assche
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2023-05-29 20:21 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: Jaegeuk Kim, linux-scsi, Adrian Hunter, Bart Van Assche, stable,
	Randy Dunlap, James E.J. Bottomley

gcc 13 may assign another type to enumeration constants than gcc 12. Split
the large enum at the top of source file stex.c such that the type of the
constants used in time expressions is changed back to the same type chosen
by gcc 12. This patch suppresses compiler warnings like this one:

In file included from ./include/linux/bitops.h:7,
                 from ./include/linux/kernel.h:22,
                 from drivers/scsi/stex.c:13:
drivers/scsi/stex.c: In function ‘stex_common_handshake’:
./include/linux/typecheck.h:12:25: error: comparison of distinct pointer types lacks a cast [-Werror]
   12 |         (void)(&__dummy == &__dummy2); \
      |                         ^~
./include/linux/jiffies.h:106:10: note: in expansion of macro ‘typecheck’
  106 |          typecheck(unsigned long, b) && \
      |          ^~~~~~~~~
drivers/scsi/stex.c:1035:29: note: in expansion of macro ‘time_after’
 1035 |                         if (time_after(jiffies, before + MU_MAX_DELAY * HZ)) {
      |                             ^~~~~~~~~~

See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107405.

Cc: stable@vger.kernel.org
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/stex.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 5b230e149c3d..8ffb75be99bc 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -109,7 +109,9 @@ enum {
 	TASK_ATTRIBUTE_HEADOFQUEUE		= 0x1,
 	TASK_ATTRIBUTE_ORDERED			= 0x2,
 	TASK_ATTRIBUTE_ACA			= 0x4,
+};
 
+enum {
 	SS_STS_NORMAL				= 0x80000000,
 	SS_STS_DONE				= 0x40000000,
 	SS_STS_HANDSHAKE			= 0x20000000,
@@ -121,7 +123,9 @@ enum {
 	SS_I2H_REQUEST_RESET			= 0x2000,
 
 	SS_MU_OPERATIONAL			= 0x80000000,
+};
 
+enum {
 	STEX_CDB_LENGTH				= 16,
 	STATUS_VAR_LEN				= 128,
 

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

* Re: [PATCH] scsi: stex: Fix gcc 13 warnings
  2023-05-29 20:21 Bart Van Assche
@ 2023-05-29 20:27 ` Bart Van Assche
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2023-05-29 20:27 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: Jaegeuk Kim, linux-scsi, Adrian Hunter, stable, Randy Dunlap,
	James E.J. Bottomley

On 5/29/23 13:21, Bart Van Assche wrote:
> gcc 13 may assign another type to enumeration constants than gcc 12. Split
> the large enum at the top of source file stex.c such that the type of the
> constants used in time expressions is changed back to the same type chosen
> by gcc 12. This patch suppresses compiler warnings like this one:

Please ignore this email and the replies to this email since it includes
two different patch series.

Thanks,

Bart.


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

* Re: [PATCH] scsi: stex: Fix gcc 13 warnings
  2023-05-29 19:50 [PATCH] scsi: stex: Fix gcc 13 warnings Bart Van Assche
@ 2023-06-01  0:43 ` Martin K. Petersen
  0 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2023-06-01  0:43 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, linux-scsi, stable, Randy Dunlap,
	James E.J. Bottomley

On Mon, 29 May 2023 12:50:34 -0700, Bart Van Assche wrote:

> gcc 13 may assign another type to enumeration constants than gcc 12. Split
> the large enum at the top of source file stex.c such that the type of the
> constants used in time expressions is changed back to the same type chosen
> by gcc 12. This patch suppresses compiler warnings like this one:
> 
> In file included from ./include/linux/bitops.h:7,
>                  from ./include/linux/kernel.h:22,
>                  from drivers/scsi/stex.c:13:
> drivers/scsi/stex.c: In function ‘stex_common_handshake’:
> ./include/linux/typecheck.h:12:25: error: comparison of distinct pointer types lacks a cast [-Werror]
>    12 |         (void)(&__dummy == &__dummy2); \
>       |                         ^~
> ./include/linux/jiffies.h:106:10: note: in expansion of macro ‘typecheck’
>   106 |          typecheck(unsigned long, b) && \
>       |          ^~~~~~~~~
> drivers/scsi/stex.c:1035:29: note: in expansion of macro ‘time_after’
>  1035 |                         if (time_after(jiffies, before + MU_MAX_DELAY * HZ)) {
>       |                             ^~~~~~~~~~
> 
> [...]

Applied to 6.4/scsi-fixes, thanks!

[1/1] scsi: stex: Fix gcc 13 warnings
      https://git.kernel.org/mkp/scsi/c/6d074ce23177

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2023-06-01  0:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-29 19:50 [PATCH] scsi: stex: Fix gcc 13 warnings Bart Van Assche
2023-06-01  0:43 ` Martin K. Petersen
  -- strict thread matches above, loose matches on Subject: below --
2023-05-29 20:21 Bart Van Assche
2023-05-29 20:27 ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox