This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
U/modified/d_strchr.U: add stub unit
authorAaron Crane <arc@cpan.org>
Fri, 13 Oct 2017 08:26:29 +0000 (10:26 +0200)
committerAaron Crane <arc@cpan.org>
Sat, 21 Oct 2017 15:45:08 +0000 (16:45 +0100)
The Perl core now wants to rely on C89 strchr() and strrchr(), so needn't
attempt to use BSD index() and rindex() as a fallback.

This is almost trivial: Perl can simplify use those functions directly.
However, metaconfig's standard dist/U/d_strchr.U unit says that the C code
should guard uses of index() and rindex() with the HAS_INDEX cpp symbol. But
"index" and "rindex" are also Perl builtins, so they appear in files like
opcode.h and keywords.c. This causes metaconfig to (a) warn you that they
were used without the HAS_INDEX guard, and (b) include the strchr/index
probe in the generated Configure anyway.

Work around this by creating a locally-modified stub d_strchr unit that
never actually does anything.

U/modified/d_strchr.U [new file with mode: 0644]

diff --git a/U/modified/d_strchr.U b/U/modified/d_strchr.U
new file mode 100644 (file)
index 0000000..fbd6627
--- /dev/null
@@ -0,0 +1,9 @@
+?RCS: d_strchr.U
+?RCS:
+?MAKE:d_strchr: Nothing
+?S:d_strchr:
+?S:    This variable is unconditionally defined
+?S:.
+: stub, never used
+d_strchr=nothing
+