This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [PATCH 5.8.1 @20218] OS/2 API
[perl5.git] / perly.fixer
index 00f583c..b627a8c 100755 (executable)
@@ -2,7 +2,7 @@
 
 # Fix up yacc output to allow dynamic allocation.  Since perly.c
 # is now provided with the perl source, this should not be necessary.
-#  
+#
 # However, if the user wishes to use byacc, or wishes to try another 
 # compiler compiler (e.g. bison or yacc), this script will get run.
 # See makefile run_byacc target for more details.
 # Currently, only byacc version 1.8 is fully supported.
 #
 #  Hacks to make it work with Interactive's SysVr3 Version 2.2
-#   doughera@lafvax.lafayette.edu (Andy Dougherty)   3/23/91
+#   doughera@lafayette.edu (Andy Dougherty)   3/23/91
 #
 # Additional information to make the BSD section work with SunOS 4.0.2
 #   tdinger@East.Sun.COM (Tom Dinger)  4/15/1991
+#
+# Also edit some practices gcc -Wall finds questionable.
+#  
+
+gnupatch=patch
+. ./config.sh
 
 input=$1
 output=$2
@@ -34,13 +40,19 @@ if grep 'yaccpar 1.8 (Berkeley)' $input >/dev/null 2>&1; then
     cp $input $output
     # Don't expect the diff to do everything -- do some by hand
     if test -f perly_c.diff; then
-       patch -F3 $output <perly_c.diff
+       $gnupatch -F3 $output <perly_c.diff
        sed -e '/^[     ]*printf("yydebug:/s/printf(/PerlIO_printf(Perl_debug_log, /' \
            -e '/^#line /s/"y[.]tab[.]c"/"perly.c"/' \
            -e '/\[\] *= *[{]/s/^/static /' \
            -e '/^static static/s/^static //' \
            -e '/^#define.WORD/,/^#define.ARROW/d' \
            -e '/^int.yydebug/,/^#define.yystacksize/d' \
+           -e 's/^yyerrlab:$//' \
+           -e 's/^    goto yyerrlab;//' \
+           -e 's/^yynewerror:$//' \
+           -e 's/^    goto yynewerror;//' \
+           -e 's|^static char yysccsid\(.*\)|/* static char yysccsid\1 */|' \
+           -e 's|deprecate(|deprecate_old(|' \
            < $output > $tmp && mv -f $tmp $output || exit 1
        rm -rf $input
        echo "If you need to debug perly.c, you need to fix up the #line"
@@ -49,13 +61,19 @@ if grep 'yaccpar 1.8 (Berkeley)' $input >/dev/null 2>&1; then
     exit
 elif grep 'yaccpar     1.9 (Berkeley)' $input >/dev/null 2>&1; then
     if test -f perly.c.dif9; then
-       patch -F3 $output <perly.c.dif9
+       $gnupatch -F3 $output <perly.c.dif9
        sed -e '/^[     ]*printf("yydebug:/s/printf(/PerlIO_printf(Perl_debug_log, /' \
            -e '/^#line /s/"y[.]tab[.]c"/"perly.c"/' \
            -e '/\[\] *= *[{]/s/^/static /' \
            -e '/^static static/s/^static //' \
            -e '/^#define.WORD/,/^#define.ARROW/d' \
            -e '/^int.yydebug/,/^#define.yystacksize/d' \
+           -e 's/^yyerrlab:$//' \
+           -e 's/^    goto yyerrlab;//' \
+           -e 's/^yynewerror:$//' \
+           -e 's/^    goto yynewerror;//' \
+           -e 's|^static char yysccsid\(.*\)|/* static char yysccsid\1 */|' \
+           -e 's|deprecate(|deprecate_old(|' \
            < $output > $tmp && mv -f $tmp $output || exit 1
        rm -rf $input
        echo "If you need to debug perly.c, you need to fix up the #line"