Hi Jakub

Thanks for doing this...

> On 28 Mar 2025, at 14:39, Jakub Jelinek <ja...@redhat.com> wrote:
> 
> +cobol/charmaps.cc cobol/valconv.cc: cobol/%.cc: $(LIB_SOURCE)/%.cc
> +     -l='ec\|common-defs\|io\|gcobolio\|libgcobol\|gfileio\|charmaps'; \
> +     l=$$l'\|valconv\|exceptl'; \
> +     sed -e '/^#include/s,"\('$$l'\)\.h","../../libgcobol/\1.h",' $^ > $@

.. however, this does not work with the BSD sed on Darwin (although it does
with GNU sed on Darwin).

The issue appears to be that alternation is an ERE addition from my reading of 
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03
(the Darwin BRE sed works fine when there is only one match in the 
sub-expression,
but fails as soon as any alternate is added).

Darwin’s sed (and at least x86_64 / aarch64 Linux sed) work fine with the 
updated patch
to use an ERE instead.  Do you think this is an acceptable update? (it is still 
POSIX sed).
thanks,
Iain

diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in
index 990d51a8578..bbf1c9ef30e 100644
--- a/gcc/cobol/Make-lang.in
+++ b/gcc/cobol/Make-lang.in
@@ -88,9 +88,8 @@ cobol1_OBJS =    \
 # so that the .h files can be found.
 
 cobol/charmaps.cc cobol/valconv.cc: cobol/%.cc: $(LIB_SOURCE)/%.cc
-       -l='ec\|common-defs\|io\|gcobolio\|gfileio\|charmaps'; \
-       l=$$l'\|valconv\|exceptl'; \
-       sed -e '/^#include/s,"\('$$l'\)\.h","../../libgcobol/\1.h",' $^ > $@
+       -l='ec|common-defs|io|gcobolio|gfileio|charmaps|valconv|exceptl'; \
+       sed -E -e '/^#include/s,"('$$l')\.h","../../libgcobol/\1.h",' $^ > $@
 
 LIB_SOURCE_H=$(wildcard $(LIB_SOURCE)/*.h)
 

Reply via email to