diff mbox series

[1/3] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3

Message ID 20220126114144.370517-1-pmenzel@molgen.mpg.de (mailing list archive)
State Handled Elsewhere
Headers show
Series [1/3] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3 | expand

Commit Message

Paul Menzel Jan. 26, 2022, 11:41 a.m. UTC
Buidling `raid6test` on Ubuntu 21.10 (ppc64le) with GNU Make 4.3 shows the
errors below:

    $ cd lib/raid6/test/
    $ make
    <stdin>:1:1: error: stray ‘\’ in program
    <stdin>:1:2: error: stray ‘#’ in program
    <stdin>:1:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
    cp -f ../int.uc int.uc
    awk -f ../unroll.awk -vN=1 < int.uc > int1.c
    gcc -I.. -I ../../../include -g -O2                      -c -o int1.o int1.c
    awk -f ../unroll.awk -vN=2 < int.uc > int2.c
    gcc -I.. -I ../../../include -g -O2                      -c -o int2.o int2.c
    awk -f ../unroll.awk -vN=4 < int.uc > int4.c
    gcc -I.. -I ../../../include -g -O2                      -c -o int4.o int4.c
    awk -f ../unroll.awk -vN=8 < int.uc > int8.c
    gcc -I.. -I ../../../include -g -O2                      -c -o int8.o int8.c
    awk -f ../unroll.awk -vN=16 < int.uc > int16.c
    gcc -I.. -I ../../../include -g -O2                      -c -o int16.o int16.c
    awk -f ../unroll.awk -vN=32 < int.uc > int32.c
    gcc -I.. -I ../../../include -g -O2                      -c -o int32.o int32.c
    rm -f raid6.a
    ar cq raid6.a int1.o int2.o int4.o int8.o int16.o int32.o recov.o algos.o tables.o
    ranlib raid6.a
    gcc -I.. -I ../../../include -g -O2                      -o raid6test test.c raid6.a
    /usr/bin/ld: raid6.a(algos.o):/dev/shm/linux/lib/raid6/test/algos.c:28: multiple definition of `raid6_call'; /scratch/local/ccIJjN8s.o:/dev/shm/linux/lib/raid6/test/test.c:22: first defined here
    collect2: error: ld returned 1 exit status
    make: *** [Makefile:72: raid6test] Error 1

The errors come from the `HAS_ALTIVEC` test, which fails, and the POWER
optimized versions are not built. That’s also reason nobody noticed on the
other architectures.

GNU Make 4.3 does not remove the backslash anymore. From the 4.3 release
announcment:

> * WARNING: Backward-incompatibility!
>   Number signs (#) appearing inside a macro reference or function invocation
>   no longer introduce comments and should not be escaped with backslashes:
>   thus a call such as:
>     foo := $(shell echo '#')
>   is legal.  Previously the number sign needed to be escaped, for example:
>     foo := $(shell echo '\#')
>   Now this latter will resolve to "\#".  If you want to write makefiles
>   portable to both versions, assign the number sign to a variable:
>     H := \#
>     foo := $(shell echo '$H')
>   This was claimed to be fixed in 3.81, but wasn't, for some reason.
>   To detect this change search for 'nocomment' in the .FEATURES variable.

So, do the same as commit 9564a8cf422d (Kbuild: fix # escaping in .cmd
files for future Make) and commit 929bef467771 (bpf: Use $(pound) instead
of \# in Makefiles) and define and use a `$(pound)` variable.

Reference for the change in make:
https://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b57

Cc: Matt Brown <matthew.brown.dev@gmail.com>
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
 lib/raid6/test/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

David Laight Jan. 26, 2022, 12:06 p.m. UTC | #1
From: Paul Menzel
> Sent: 26 January 2022 11:42
> 
..
> +pound := \#

Please use 'hash' not 'pound'.
Only american greengrocers use that horrid name.

A 'pound' is '£'.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Paul Menzel Jan. 26, 2022, 12:12 p.m. UTC | #2
Dear David,


Am 26.01.22 um 13:06 schrieb David Laight:
> From: Paul Menzel
>> Sent: 26 January 2022 11:42
> ..
>> +pound := \#
> 
> Please use 'hash' not 'pound'.
> Only american greengrocers use that horrid name.
> 
> A 'pound' is '£'.

Sure, I can change that, if you send a patch cleaning this up for the 
other files already using that in the tree? ;-) Or can it be different 
all over the Linux code base?


Kind regards,

Paul


PS:

> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)

If you care, the standard signature delimiter is `-- ` [1].


[1]: https://en.wikipedia.org/wiki/Signature_block#Standard_delimiter
David T-G Jan. 26, 2022, 2:38 p.m. UTC | #3
David, et al --

...and then David Laight said...
% 
% From: Paul Menzel
% > Sent: 26 January 2022 11:42
% > 
% ..
% > +pound := \#
% 
% Please use 'hash' not 'pound'.

Ahem ...  Everyone knows that hash is best served hot and that
that symbol is an octothorpe.


% Only american greengrocers use that horrid name.
[snip]

*grin*


HAND

:-D
Tim Small Jan. 26, 2022, 7:29 p.m. UTC | #4
On 26/01/2022 12:12, Paul Menzel wrote:

> Sure, I can change that,

FWIW, the GNU Make documentation uses "Number signs" to refer to "#", 
and I think that may cause the least confusion across speakers of 
different dialects of English.

Tim.
Song Liu Feb. 8, 2022, 6:43 a.m. UTC | #5
Hi Paul,

Sorry for the delayed reply.

On Wed, Jan 26, 2022 at 3:42 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
>
> Buidling `raid6test` on Ubuntu 21.10 (ppc64le) with GNU Make 4.3 shows the
> errors below:

Please do not use `xxx` in the commit log (and subject).

>
>     $ cd lib/raid6/test/
>     $ make
>     <stdin>:1:1: error: stray ‘\’ in program
>     <stdin>:1:2: error: stray ‘#’ in program
>     <stdin>:1:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
>     cp -f ../int.uc int.uc
>     awk -f ../unroll.awk -vN=1 < int.uc > int1.c
>     gcc -I.. -I ../../../include -g -O2                      -c -o int1.o int1.c
>     awk -f ../unroll.awk -vN=2 < int.uc > int2.c
>     gcc -I.. -I ../../../include -g -O2                      -c -o int2.o int2.c
>     awk -f ../unroll.awk -vN=4 < int.uc > int4.c
>     gcc -I.. -I ../../../include -g -O2                      -c -o int4.o int4.c
>     awk -f ../unroll.awk -vN=8 < int.uc > int8.c
>     gcc -I.. -I ../../../include -g -O2                      -c -o int8.o int8.c
>     awk -f ../unroll.awk -vN=16 < int.uc > int16.c
>     gcc -I.. -I ../../../include -g -O2                      -c -o int16.o int16.c
>     awk -f ../unroll.awk -vN=32 < int.uc > int32.c
>     gcc -I.. -I ../../../include -g -O2                      -c -o int32.o int32.c
>     rm -f raid6.a
>     ar cq raid6.a int1.o int2.o int4.o int8.o int16.o int32.o recov.o algos.o tables.o
>     ranlib raid6.a
>     gcc -I.. -I ../../../include -g -O2                      -o raid6test test.c raid6.a
>     /usr/bin/ld: raid6.a(algos.o):/dev/shm/linux/lib/raid6/test/algos.c:28: multiple definition of `raid6_call'; /scratch/local/ccIJjN8s.o:/dev/shm/linux/lib/raid6/test/test.c:22: first defined here
>     collect2: error: ld returned 1 exit status
>     make: *** [Makefile:72: raid6test] Error 1
>
> The errors come from the `HAS_ALTIVEC` test, which fails, and the POWER
> optimized versions are not built. That’s also reason nobody noticed on the
> other architectures.
>
> GNU Make 4.3 does not remove the backslash anymore. From the 4.3 release
> announcment:
>
> > * WARNING: Backward-incompatibility!
> >   Number signs (#) appearing inside a macro reference or function invocation
> >   no longer introduce comments and should not be escaped with backslashes:
> >   thus a call such as:
> >     foo := $(shell echo '#')
> >   is legal.  Previously the number sign needed to be escaped, for example:
> >     foo := $(shell echo '\#')
> >   Now this latter will resolve to "\#".  If you want to write makefiles
> >   portable to both versions, assign the number sign to a variable:
> >     H := \#
> >     foo := $(shell echo '$H')
> >   This was claimed to be fixed in 3.81, but wasn't, for some reason.
> >   To detect this change search for 'nocomment' in the .FEATURES variable.
>
> So, do the same as commit 9564a8cf422d (Kbuild: fix # escaping in .cmd
> files for future Make) and commit 929bef467771 (bpf: Use $(pound) instead
> of \# in Makefiles) and define and use a `$(pound)` variable.

Please run ./scripts/checkpatch.pl against the patch files, and fix
errors/warnings
as much as possible.

Thanks,
Song

>
> Reference for the change in make:
> https://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b57
>
> Cc: Matt Brown <matthew.brown.dev@gmail.com>
> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
> ---
>  lib/raid6/test/Makefile | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile
> index a4c7cd74cff5..4fb7700a741b 100644
> --- a/lib/raid6/test/Makefile
> +++ b/lib/raid6/test/Makefile
> @@ -4,6 +4,8 @@
>  # from userspace.
>  #
>
> +pound := \#
> +
>  CC      = gcc
>  OPTFLAGS = -O2                 # Adjust as desired
>  CFLAGS  = -I.. -I ../../../include -g $(OPTFLAGS)
> @@ -42,7 +44,7 @@ else ifeq ($(HAS_NEON),yes)
>          OBJS   += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o
>          CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1
>  else
> -        HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\
> +        HAS_ALTIVEC := $(shell printf '$(pound)include <altivec.h>\nvector int a;\n' |\
>                           gcc -c -x c - >/dev/null && rm ./-.o && echo yes)
>          ifeq ($(HAS_ALTIVEC),yes)
>                  CFLAGS += -I../../../arch/powerpc/include
> --
> 2.34.1
>
Wols Lists Feb. 8, 2022, 6:44 p.m. UTC | #6
On 26/01/2022 11:41, Paul Menzel wrote:
> So, do the same as commit 9564a8cf422d (Kbuild: fix # escaping in .cmd
> files for future Make) and commit 929bef467771 (bpf: Use $(pound) instead
> of \# in Makefiles) and define and use a `$(pound)` variable.

Ouch!

In the English (as opposed to American) speaking world this will be very 
confusing! The pound sign is £ not #.

If this is not dictated by some sort of upstream PLEASE can we make it 
$(hash) not $(pound)

Cheers,
Wol
diff mbox series

Patch

diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile
index a4c7cd74cff5..4fb7700a741b 100644
--- a/lib/raid6/test/Makefile
+++ b/lib/raid6/test/Makefile
@@ -4,6 +4,8 @@ 
 # from userspace.
 #
 
+pound := \#
+
 CC	 = gcc
 OPTFLAGS = -O2			# Adjust as desired
 CFLAGS	 = -I.. -I ../../../include -g $(OPTFLAGS)
@@ -42,7 +44,7 @@  else ifeq ($(HAS_NEON),yes)
         OBJS   += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o
         CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1
 else
-        HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\
+        HAS_ALTIVEC := $(shell printf '$(pound)include <altivec.h>\nvector int a;\n' |\
                          gcc -c -x c - >/dev/null && rm ./-.o && echo yes)
         ifeq ($(HAS_ALTIVEC),yes)
                 CFLAGS += -I../../../arch/powerpc/include