delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/08/06/02:47:49

Date: Sun, 6 Aug 2000 09:46:43 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Bruce Korb <bkorb AT sco DOT COM>
cc: djgpp-workers AT delorie DOT com
Subject: Re: DJGPP patch for fixincludes
In-Reply-To: <39849CAA.58977AD5@sco.com>
Message-ID: <Pine.SUN.3.91.1000806094525.14058B-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 30 Jul 2000, Bruce Korb wrote:

> 1.  The MSDOS case element in mkfixinc.sh should be something like:
> 
> 	${MAKE} -f ${srcdir}/make.dos install
> 	exit $?
> 
> 2.  There should be a new source file "make.dos" with the default
>     be to build the two __MSDOS__ defined executables (regardless
>     of platform) and an "install" target that copies fixincl.sh and
>     fixincl into position (the directory "..").

I've done all this, see the patches below.  The only difference is
that the two programs, fixincl and applyfix, are not copied to "..",
they are run from the directory where they are built (because that's
what fixinc.sh seemed to be doing originally).

> 3.  check.tpl should be augmented so that after the regular fixincl
>     goes through its paces, the __MSDOS__ flavor is built and run
>     against the one header, "testing.h".  Test that the output is
>     correct.  That should test the operation of the DOS  version.
>     That ought to be enough.

I didn't do this part, since I don't have AutoGen installed and don't
know how to use it anyway.  What I did instead was to add a "check:"
target to Makefile.DOS and two new files in the new subdirectory
fixinc/tests/msdos/, which together allow to test the MS-DOS version
of fixincl.

While working on testing this, I found that the file-selection feature
(whereby each test says to what header files it is applicable) gets in
the way.  In particular, only a couple of tests have testing.h in the
list of files.  So I added a feature where if the environment variable
$FIXINCL_TEST is set, fixincl is forced to ignore the file names where
it can, and apply the fixes to all files.  These changes are also
part of the patches below.

2000-08-05  Eli Zaretskii  <eliz AT is DOT elta DOT co DOT il>

	* fixinc/fixlib.h (ENV_TABLE): New env variable $FIXINCL_TEST and
	new variable pz_fixincl_test.

	* fixinc/fixincl.c (fix_applies): Don't test the file name for a
	match in the pattern if we were asked to ignore file-name
	restrictions.

	* fixinc/Makefile.DOS: New file.

	* fixinc/tests/msdos/testing.h, fixinc/tests/msdos/testing.exp:
	New files, for testing fixincludes with DJGPP.

	* fixinc/mkfixinc.sh: For i?86-*-msdosdjgpp*, build the two
	executables fixincl and applyfix using Makefile.DOS.

--- fixinc/fixlib.h~	Fri Jul 28 13:45:20 2000
+++ fixinc/fixlib.h	Sat Aug  5 21:30:12 2000
@@ -116,7 +116,10 @@
          "amount of user entertainment" )            \
                                                      \
   _ENV_( pz_find_base, BOOL_TRUE, "FIND_BASE",       \
-         "leader to trim from file names" )
+         "leader to trim from file names" )          \
+                                                     \
+  _ENV_( pz_fixincl_test, BOOL_FALSE, "FIXINCL_TEST",\
+         "if set, we are run by a test suite" )
 
 /*  Test Descriptor
 
--- fixinc/fixincl.c~	Tue Aug  1 20:44:02 2000
+++ fixinc/fixincl.c	Sat Aug  5 23:22:56 2000
@@ -1112,7 +1115,15 @@
   /*  IF there is a file name restriction,
       THEN ensure the current file name matches one in the pattern  */
 
-  if (pz_scan != (char *) NULL)
+  if (pz_scan != (char *) NULL
+      /* If we are run by the test suite, disregard header file names.
+	 We do not do this for tests with empty patch_args[] because
+	 those are broken.  We do not do that for tests which have the
+	 FD_REPLACEMENT flag set because they exit the loop of fixes
+	 immediately.  */
+      && (pz_fixincl_test == (char *) NULL
+	  || *p_fixd->patch_args == (char *) NULL
+	  || (p_fixd->fd_flags & FD_REPLACEMENT)))
     {
       size_t name_len;
 

--- /dev/null	Sat Aug  5 23:54:37 2000
+++ fixinc/Makefile.DOS	Sat Aug  5 23:50:14 2000
@@ -0,0 +1,124 @@
+# Makefile for GNU compilers.
+#   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+
+#This file is part of GNU CC.
+
+#GNU CC is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 2, or (at your option)
+#any later version.
+
+#GNU CC is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#GNU General Public License for more details.
+
+#You should have received a copy of the GNU General Public License
+#along with GNU CC; see the file COPYING.  If not, write to
+#the Free Software Foundation, 59 Temple Place - Suite 330,
+#Boston, MA 02111-1307, USA.
+
+# This Makefile.DOS file lives in the fixinc subdirectory.
+# Its purpose is to build the fixincl and applyfix programs for
+# the DJGPP (aka MS-DOS) port of GCC.
+
+CFLAGS = -Wall -g -O2
+FIXINC_DEFS = -DIN_GCC $(CFLAGS) $(CPPFLAGS) $(INCLUDES)
+
+CC = gcc
+SHELL = /bin/sh
+
+target=i386-pc-msdosdjgpp
+# Directory where sources are, from where we are.
+srcdir = .
+VPATH = $(srcdir)
+subdir = fixinc
+
+# End of variables for you to override.
+
+default : all
+
+# Now figure out from those variables how to compile and link.
+
+# Specify the directories to be searched for header files.
+# Both . and srcdir are used, in that order.
+#
+INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. \
+-I$(srcdir)/../config -I$(srcdir)/../../include
+
+# Always use -I$(srcdir)/config when compiling.
+.c.o:
+	$(CC) -c $(FIXINC_DEFS) $<
+
+# The only suffixes we want for implicit rules are .c and .o.
+.SUFFIXES:
+.SUFFIXES: .c .o
+
+#
+
+## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+##
+##  Makefile for constructing the "best" include fixer we can
+##
+## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+LIBERTY = $(srcdir)/../../libiberty/libiberty.a
+OBJ = fixincl.o fixtests.o fixfixes.o server.o procopen.o \
+      gnu-regex.o fixlib.o
+
+HDR = server.h gnu-regex.h fixlib.h machname.h
+
+TARGETS = fixincl applyfix
+
+all : $(TARGETS)
+gen : fixincl.x
+
+fixincl: fixincl.o fixlib.o fixtests.o gnu-regex.o $(LIBERTY)
+	$(CC) $(FIXINC_DEFS) -o $@ $^
+
+applyfix: fixfixes.o fixlib.o gnu-regex.o $(LIBERTY)
+	$(CC) $(FIXINC_DEFS) -o $@ $^
+
+$(OBJ)      : $(HDR)
+fixincl.o   : fixincl.x fixincl.c
+fixtests.o  : fixtests.c
+fixfixes.o  : fixfixes.c fixincl.x
+server.o    : server.c
+procopen.o  : procopen.c
+gnu-regex.o : gnu-regex.c
+fixlib.o    : fixlib.c
+
+#  'machname.h' is built in the build directory.
+#  'fixincl.x' in the source dir.
+#
+machname.h: ../specs
+	$(SHELL) $(srcdir)/genfixes $@
+
+fixincl.x: fixincl.tpl inclhack.def
+	cd $(srcdir) ; $(SHELL) ./genfixes $@
+
+clean:
+	rm -f *.o $(TARGETS) fixincl.x machname.h *~ *.exe
+
+#  Build the executable and copy up into gcc dir.
+#  We still copy the script because we still have alternative scripts.
+#
+inst-bin : fixincl
+	./fixincl.exe -v
+	@if [ -f ../fixinc.sh ] ; then rm -f ../fixinc.sh || \
+	    mv -f ../fixinc.sh ../fixinc.sh.$$ || exit 1 ; fi
+	@if [ -f ./fixincl.sh ] ; \
+	then echo cp ./fixincl.sh ../fixinc.sh ; \
+		cp ./fixincl.sh ../fixinc.sh ; \
+	else echo cp $(srcdir)/fixincl.sh ../fixinc.sh ; \
+		cp $(srcdir)/fixincl.sh ../fixinc.sh ; fi
+	chmod 755 ../fixinc.sh
+
+check : fixincl applyfix
+	@cd .. ; \
+	test -d ./include.dos || mkdir ./include.dos ; \
+	if test "$(srcdir)"=="." ; then fixdir=$(subdir) ; \
+	else fixdir=$(srcdir) ; fi ; \
+	export FIXINCL_TEST=y ; export TARGET_MACHINE=* ; \
+	 ./fixinc.sh ./include.dos $(fixdir)/tests/msdos
+	diff -c $(srcdir)/tests/msdos/testing.exp ../include.dos/testing.h
--- /dev/null	Sat Aug  5 23:54:57 2000
+++ fixinc/tests/msdos/testing.h	Sat Aug  5 19:34:02 2000
@@ -0,0 +1,69 @@
+#if defined( CTRL_QUOTES_DEF_CHECK )
+#define _CTRL(c) ('c'&037)
+#endif  /* CTRL_QUOTES_DEF_CHECK */
+
+
+#if defined( CTRL_QUOTES_USE_CHECK )
+#define TCTRLFOO BSD43_CTRL(T, 1)
+#endif  /* CTRL_QUOTES_USE_CHECK */
+
+
+#if defined( IO_QUOTES_DEF_CHECK )
+#define XX_IO(x)        ('x'<<8|256)
+#endif  /* IO_QUOTES_DEF_CHECK */
+
+
+#if defined( IO_QUOTES_USE_CHECK )
+#define TIOCFOO BSD43__IOWR(T, 1)
+#define TIOCFOO \
+BSD43__IOWR(T, 1) /* Some are multi-line */
+#endif  /* IO_QUOTES_USE_CHECK */
+
+
+#if defined( LIBC1_IFDEFD_MEMX_CHECK )
+/* `memcpy' is a built-in function for gcc 2.x. */
+#if defined(__STDC__) && __GNUC__ < 2
+/* Copy N bytes of SRC to DEST.  */
+extern __ptr_t memcpy __P ((__ptr_t __dest, __const __ptr_t __src,
+                         size_t __n));
+#endif
+#endif  /* LIBC1_IFDEFD_MEMX_CHECK */
+
+
+#if defined( MACHINE_NAME_CHECK )
+/* MACH_DIFF: */
+#if defined( i386 ) || defined( sparc ) || defined( vax )
+/* no uniform test, so be careful  :-) */
+#endif  /* MACHINE_NAME_CHECK */
+
+
+#if defined( SCO_STRICT_ANSI_CHECK )
+#if !__STDC__ /* not standard C */
+int foo;
+#endif
+#endif  /* SCO_STRICT_ANSI_CHECK */
+
+
+#if defined( SYSV68_STRING_CHECK )
+extern int strlen();
+extern int ffs(long);
+extern char
+	*memccpy(),
+	memcpy();
+extern int
+	strncmp(),
+	strlen(),
+	strspn();
+extern int
+	strlen(), strspn();
+#endif  /* SYSV68_STRING_CHECK */
+
+
+#if defined( UNDEFINE_NULL_CHECK )
+#define NULL 0UL
+#define NULL	((void*)0)
+
+#endif  /* UNDEFINE_NULL_CHECK */
+
+
+#define NULL 0
--- /dev/null	Sat Aug  5 23:55:03 2000
+++ fixinc/tests/msdos/testing.exp	Sat Aug  5 23:17:52 2000
@@ -0,0 +1,81 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/testing.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+#if defined( CTRL_QUOTES_DEF_CHECK )
+#define _CTRL(c) (c&037)
+#endif  /* CTRL_QUOTES_DEF_CHECK */
+
+
+#if defined( CTRL_QUOTES_USE_CHECK )
+#define TCTRLFOO BSD43_CTRL('T', 1)
+#endif  /* CTRL_QUOTES_USE_CHECK */
+
+
+#if defined( IO_QUOTES_DEF_CHECK )
+#define XX_IO(x)        (x<<8|256)
+#endif  /* IO_QUOTES_DEF_CHECK */
+
+
+#if defined( IO_QUOTES_USE_CHECK )
+#define TIOCFOO BSD43__IOWR('T', 1)
+#define TIOCFOO \
+BSD43__IOWR('T', 1) /* Some are multi-line */
+#endif  /* IO_QUOTES_USE_CHECK */
+
+
+#if defined( LIBC1_IFDEFD_MEMX_CHECK )
+/* Copy N bytes of SRC to DEST.  */
+extern __ptr_t memcpy __P ((__ptr_t __dest, __const __ptr_t __src,
+                         size_t __n));
+#endif  /* LIBC1_IFDEFD_MEMX_CHECK */
+
+
+#if defined( MACHINE_NAME_CHECK )
+/* MACH_DIFF: */
+#if defined( __i386__ ) || defined( sparc ) || defined( vax )
+/* no uniform test, so be careful  :-) */
+#endif  /* MACHINE_NAME_CHECK */
+
+
+#if defined( SCO_STRICT_ANSI_CHECK )
+#if !defined(__STRICT_ANSI__) /* not standard C */
+int foo;
+#endif
+#endif  /* SCO_STRICT_ANSI_CHECK */
+
+
+#if defined( SYSV68_STRING_CHECK )
+extern unsigned int strlen();
+extern int ffs(int);
+extern void
+	*memccpy(),
+	memcpy();
+extern int
+	strncmp(),
+	strlen(),
+	strspn();
+extern size_t
+	strlen(), strspn();
+#endif  /* SYSV68_STRING_CHECK */
+
+
+#if defined( UNDEFINE_NULL_CHECK )
+#ifndef NULL
+#define NULL 0UL
+#endif
+#ifndef NULL
+#define NULL	((void*)0)
+#endif
+
+#endif  /* UNDEFINE_NULL_CHECK */
+
+
+#ifndef NULL
+#define NULL 0
+#endif
--- fixinc/mkfixinc.s~0	Mon May  8 21:39:52 2000
+++ fixinc/mkfixinc.sh	Sat Aug  5 23:50:16 2000
@@ -70,7 +70,7 @@
 	i?86-*-win32 | \
 	i?86-*-pe | i?86-*-cygwin* | \
 	i?86-*-mingw32* | \
-	i?86-*-uwin* | i?86-*-msdosdjgpp* | \
+	i?86-*-uwin* | \
 	mips-sgi-irix5cross64 | \
 	powerpc-*-eabiaix* | \
 	powerpc-*-eabisim* | \
@@ -87,6 +87,12 @@
 	*-sgi-irix*)
 		fixincludes=fixinc.irix
 		;;
+
+	i?86-*-msdosdjgpp*)
+		echo $MAKE -f $(srcdir)/Makefile.DOS SHELL=\"$SHELL\" inst-bin
+		$MAKE -f $(srcdir)/Makefile.DOS SHELL=\"$SHELL\" inst-bin
+		exit $?
+		;;
 esac
 
 #  IF there is no include fixing,

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019