diff mbox series

[blktests] src/Makefile: fix number sign handling in macro

Message ID 20230301080301.2410060-1-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series [blktests] src/Makefile: fix number sign handling in macro | expand

Commit Message

Shin'ichiro Kawasaki March 1, 2023, 8:03 a.m. UTC
GNU make version 4.3 introduced a backward-incompatible change. The
number sign '#' now should not have preceding backslash in a macro [1].
To make macros with number signs work regardless of make versions,
assign the number sign to a variable.

[1] https://lwn.net/Articles/810071/

Reported-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
Link: https://lore.kernel.org/linux-block/cfccc895-5a9b-f45b-5851-74c94219d743@linux.alibaba.com/
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
This patch can be applied on top of Ming Lei's series for miniublk [2].

[2] https://lore.kernel.org/linux-block/20230224124502.1720278-1-ming.lei@redhat.com/

 src/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Chaitanya Kulkarni March 2, 2023, 5:02 a.m. UTC | #1
On 3/1/2023 12:03 AM, Shin'ichiro Kawasaki wrote:
> GNU make version 4.3 introduced a backward-incompatible change. The
> number sign '#' now should not have preceding backslash in a macro [1].
> To make macros with number signs work regardless of make versions,
> assign the number sign to a variable.
> 
> [1] https://lwn.net/Articles/810071/
> 
> Reported-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
> Link: https://lore.kernel.org/linux-block/cfccc895-5a9b-f45b-5851-74c94219d743@linux.alibaba.com/
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
> This patch can be applied on top of Ming Lei's series for miniublk [2].
> 
> [2] https://lore.kernel.org/linux-block/20230224124502.1720278-1-ming.lei@redhat.com/


Looks good. I've reviewed Ming's ublk series, feel free to add this one
too.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck
Shin'ichiro Kawasaki March 2, 2023, 7:45 a.m. UTC | #2
On Mar 02, 2023 / 05:02, Chaitanya Kulkarni wrote:
> On 3/1/2023 12:03 AM, Shin'ichiro Kawasaki wrote:
> > GNU make version 4.3 introduced a backward-incompatible change. The
> > number sign '#' now should not have preceding backslash in a macro [1].
> > To make macros with number signs work regardless of make versions,
> > assign the number sign to a variable.
> > 
> > [1] https://lwn.net/Articles/810071/
> > 
> > Reported-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
> > Link: https://lore.kernel.org/linux-block/cfccc895-5a9b-f45b-5851-74c94219d743@linux.alibaba.com/
> > Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> > ---
> > This patch can be applied on top of Ming Lei's series for miniublk [2].
> > 
> > [2] https://lore.kernel.org/linux-block/20230224124502.1720278-1-ming.lei@redhat.com/
> 
> 
> Looks good. I've reviewed Ming's ublk series, feel free to add this one
> too.
> 
> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

Thanks, I've merged this together with the ublk series.
diff mbox series

Patch

diff --git a/src/Makefile b/src/Makefile
index 81c6541..cbb0b25 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,8 +1,10 @@ 
-HAVE_C_HEADER = $(shell if echo "\#include <$(1)>" |		\
+H := \#
+
+HAVE_C_HEADER = $(shell if echo "$(H)include <$(1)>" |		\
 		$(CC) -E - > /dev/null 2>&1; then echo "$(2)";	\
 		else echo "$(3)"; fi)
 
-HAVE_C_MACRO = $(shell if echo "#include <$(1)>" |	\
+HAVE_C_MACRO = $(shell if echo "$(H)include <$(1)>" |	\
 		$(CC) -E - 2>&1 /dev/null | grep $(2) > /dev/null 2>&1; \
 		then echo 1;else echo 0; fi)