home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / gnu / utils / bug / 2040 < prev    next >
Encoding:
Text File  |  1992-11-11  |  8.5 KB  |  293 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!zoo
  3. From: zoo@cygnus.com (david d `zoo' zuhn)
  4. Subject: clean code patches for bison
  5. Message-ID: <9211110110.AA03656@cygnus.com>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: Cygnus Support -- +1 415 903 1434
  8. Distribution: gnu
  9. Date: Wed, 11 Nov 1992 01:10:03 GMT
  10. Approved: bug-gnu-utils@prep.ai.mit.edu
  11. Lines: 280
  12.  
  13. These patches to bison 1.19 remove all references to the macro USG from the
  14. bison source code.  This macro is obsolete, and usage of it has been
  15. inconsistent.  It has been replaced by two specific checks, for <string.h>
  16. and <memory.h>.   The bulk of these patches are changes to the configure
  17. script, which should be regenerated from configure.in anyway.
  18.  
  19. Yours for cleaner code.....
  20.  
  21.   david d 'zoo' zuhn |    There is great disorder under the heavens,
  22.     cygnus support   |         and the situation is excellent.
  23.     zoo@cygnus.com   |    
  24.  
  25.  
  26. ---------- slice 'n' dice ---------------------------------- file: bison-diffs
  27.  
  28. diff -rc2 bison-1.19/ChangeLog bison-1.19-zoo/ChangeLog
  29. *** bison-1.19/ChangeLog    Mon Sep 28 07:33:52 1992
  30. --- bison-1.19-zoo/ChangeLog    Tue Nov 10 16:59:53 1992
  31. ***************
  32. *** 1,2 ****
  33. --- 1,13 ----
  34. + Tue Nov 10 16:57:54 1992  david d `zoo' zuhn  (zoo at cirdan.cygnus.com)
  35. +     * configure.in: added a check for <memory.h>
  36. +     * conflicts.c: use HAVE_MEMORY_H instead of USG for <memory.h>,
  37. +     remove test for USG by <alloca.h>
  38. +     * getopt.c: remove test for USG for <alloca.h>
  39. +     * system.h: rework so that testing for USG is no longer needed
  40.   Fri Sep 25 18:06:28 1992  Richard Stallman  (rms@mole.gnu.ai.mit.edu)
  41.   
  42. diff -rc2 bison-1.19/configure bison-1.19-zoo/configure
  43. *** bison-1.19/configure    Fri Sep 18 12:02:58 1992
  44. --- bison-1.19-zoo/configure    Tue Nov 10 16:54:49 1992
  45. ***************
  46. *** 81,85 ****
  47.     # Try the directory containing this script, then `..'.
  48.     prog=$0
  49. !   confdir=`echo $prog|sed 's,/[^/][^/]*$,,'`
  50.     test "X$confdir" = "X$prog" && confdir=.
  51.     srcdir=$confdir
  52. --- 81,85 ----
  53.     # Try the directory containing this script, then `..'.
  54.     prog=$0
  55. !   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  56.     test "X$confdir" = "X$prog" && confdir=.
  57.     srcdir=$confdir
  58. ***************
  59. *** 148,152 ****
  60.   # Make sure to not get the incompatible SysV /etc/install and
  61.   # /usr/sbin/install, which might be in PATH before a BSD-like install,
  62. ! # or the SunOS /usr/etc/install directory.
  63.   if test -z "$INSTALL"; then
  64.     echo checking for install
  65. --- 148,152 ----
  66.   # Make sure to not get the incompatible SysV /etc/install and
  67.   # /usr/sbin/install, which might be in PATH before a BSD-like install,
  68. ! # or the SunOS /usr/etc/install directory, or the AIX /bin/install.
  69.   if test -z "$INSTALL"; then
  70.     echo checking for install
  71. ***************
  72. *** 158,165 ****
  73.       *)
  74.         if test -f $dir/install; then
  75. !     INSTALL="$dir/install -c"
  76. !     INSTALL_PROGRAM='$(INSTALL)'
  77. !     INSTALL_DATA='$(INSTALL) -m 644'
  78. !     break
  79.         fi
  80.         ;;
  81. --- 158,169 ----
  82.       *)
  83.         if test -f $dir/install; then
  84. !     if grep dspmsg $dir/install >/dev/null 2>&1; then
  85. !       : # AIX
  86. !     else
  87. !       INSTALL="$dir/install -c"
  88. !       INSTALL_PROGRAM='$(INSTALL)'
  89. !       INSTALL_DATA='$(INSTALL) -m 644'
  90. !       break
  91. !     fi
  92.         fi
  93.         ;;
  94. ***************
  95. *** 218,228 ****
  96.   rm -f conftest*
  97.   
  98. ! echo checking for BSD string and memory functions
  99. ! echo "#include <strings.h>
  100. ! main() { exit(0); } t() { rindex(0, 0); bzero(0, 0); }" > conftest.c
  101. ! if eval $compile; then
  102. !   :
  103. ! else
  104. !   DEFS="$DEFS -DUSG=1"
  105.   fi
  106.   rm -f conftest*
  107. --- 222,233 ----
  108.   rm -f conftest*
  109.   
  110. ! echo checking for memory.h
  111. ! cat <<EOF > conftest.c
  112. ! #include <memory.h>
  113. ! EOF
  114. ! err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  115. ! if test -z "$err"; then
  116. !   DEFS="$DEFS -DHAVE_MEMORY_H=1"
  117.   fi
  118.   rm -f conftest*
  119. ***************
  120. *** 306,314 ****
  121.   if test -n "$prefix"; then
  122.     test -z "$exec_prefix" && exec_prefix='$(prefix)'
  123. !   prsub="s,^prefix[     ]*=.*$,prefix = $prefix,"
  124.   fi
  125.   if test -n "$exec_prefix"; then
  126.     prsub="$prsub
  127. ! s,^exec_prefix[     ]*=.*$,exec_prefix = $exec_prefix,"
  128.   fi
  129.   
  130. --- 311,319 ----
  131.   if test -n "$prefix"; then
  132.     test -z "$exec_prefix" && exec_prefix='$(prefix)'
  133. !   prsub="s%^prefix[     ]*=.*$%prefix = $prefix%"
  134.   fi
  135.   if test -n "$exec_prefix"; then
  136.     prsub="$prsub
  137. ! s%^exec_prefix[     ]*=.*$%exec_prefix = $exec_prefix%"
  138.   fi
  139.   
  140. ***************
  141. *** 350,354 ****
  142.     srcdir=$top_srcdir
  143.     # Remove last slash and all that follows it.  Not all systems have dirname.
  144. !   dir=`echo $file|sed 's,/[^/][^/]*$,,'`
  145.     if test "$dir" != "$file"; then
  146.       test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  147. --- 355,359 ----
  148.     srcdir=$top_srcdir
  149.     # Remove last slash and all that follows it.  Not all systems have dirname.
  150. !   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  151.     if test "$dir" != "$file"; then
  152.       test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  153. ***************
  154. *** 360,372 ****
  155.     sed -e "
  156.   $prsub
  157. ! s,@CC@,$CC,g
  158. ! s,@CPP@,$CPP,g
  159. ! s,@INSTALL@,$INSTALL,g
  160. ! s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,g
  161. ! s,@INSTALL_DATA@,$INSTALL_DATA,g
  162. ! s,@ALLOCA@,$ALLOCA,g
  163. ! s,@LIBS@,$LIBS,g
  164. ! s,@srcdir@,$srcdir,g
  165. ! s,@DEFS@,$DEFS," $top_srcdir/${file}.in >> $file
  166.   done
  167.   
  168. --- 365,377 ----
  169.     sed -e "
  170.   $prsub
  171. ! s%@CC@%$CC%g
  172. ! s%@CPP@%$CPP%g
  173. ! s%@INSTALL@%$INSTALL%g
  174. ! s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  175. ! s%@INSTALL_DATA@%$INSTALL_DATA%g
  176. ! s%@ALLOCA@%$ALLOCA%g
  177. ! s%@LIBS@%$LIBS%g
  178. ! s%@srcdir@%$srcdir%g
  179. ! s%@DEFS@%$DEFS%" $top_srcdir/${file}.in >> $file
  180.   done
  181.   
  182. diff -rc2 bison-1.19/configure.in bison-1.19-zoo/configure.in
  183. *** bison-1.19/configure.in    Mon Jul 13 23:39:22 1992
  184. --- bison-1.19-zoo/configure.in    Tue Nov 10 17:01:56 1992
  185. ***************
  186. *** 7,11 ****
  187.   AC_ISC_POSIX
  188.   AC_STDC_HEADERS
  189. ! AC_USG
  190.   AC_HAVE_FUNCS(strerror)
  191.   AC_ALLOCA
  192. --- 7,12 ----
  193.   AC_ISC_POSIX
  194.   AC_STDC_HEADERS
  195. ! AC_HEADER_CHECK(string.h,AC_DEFINE(HAVE_STRING_H))
  196. ! AC_HEADER_CHECK(memory.h,AC_DEFINE(HAVE_MEMORY_H))
  197.   AC_HAVE_FUNCS(strerror)
  198.   AC_ALLOCA
  199. diff -rc2 bison-1.19/conflicts.c bison-1.19-zoo/conflicts.c
  200. *** bison-1.19/conflicts.c    Thu Sep 24 13:23:12 1992
  201. --- bison-1.19-zoo/conflicts.c    Tue Nov 10 16:57:19 1992
  202. ***************
  203. *** 33,37 ****
  204.   #define bcopy(s, d, n) memcpy ((d), (s), (n))
  205.   #else
  206. ! #ifdef USG
  207.   #include <memory.h>
  208.   #define bcopy(src, dst, num) memcpy((dst), (src), (num))
  209. --- 33,37 ----
  210.   #define bcopy(s, d, n) memcpy ((d), (s), (n))
  211.   #else
  212. ! #ifdef HAVE_MEMORY_H
  213.   #include <memory.h>
  214.   #define bcopy(src, dst, num) memcpy((dst), (src), (num))
  215. ***************
  216. *** 42,46 ****
  217.   #define alloca __builtin_alloca
  218.   #else
  219. ! #if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__))))
  220.   #include <alloca.h>
  221.   #else
  222. --- 42,46 ----
  223.   #define alloca __builtin_alloca
  224.   #else
  225. ! #if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(SVR4) && !defined(__svr4__))))
  226.   #include <alloca.h>
  227.   #else
  228. diff -rc2 bison-1.19/getopt.c bison-1.19-zoo/getopt.c
  229. *** bison-1.19/getopt.c    Mon Aug 24 10:00:50 1992
  230. --- bison-1.19-zoo/getopt.c    Tue Nov 10 17:06:52 1992
  231. ***************
  232. *** 24,28 ****
  233.   #define alloca __builtin_alloca
  234.   #else /* not __GNUC__ */
  235. ! #if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__))))
  236.   #include <alloca.h>
  237.   #else
  238. --- 24,28 ----
  239.   #define alloca __builtin_alloca
  240.   #else /* not __GNUC__ */
  241. ! #if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(SVR4) && !defined(__svr4__))))
  242.   #include <alloca.h>
  243.   #else
  244. ***************
  245. *** 37,41 ****
  246.   #include <stdio.h>
  247.   
  248. ! #if defined(USG) || defined(STDC_HEADERS) || defined(__GNU_LIBRARY__)
  249.   #include <string.h>
  250.   #endif
  251. --- 37,41 ----
  252.   #include <stdio.h>
  253.   
  254. ! #if defined(HAVE_STRING_H) || defined(STDC_HEADERS) || defined(__GNU_LIBRARY__)
  255.   #include <string.h>
  256.   #endif
  257. diff -rc2 bison-1.19/system.h bison-1.19-zoo/system.h
  258. *** bison-1.19/system.h    Sun Jun 21 21:07:21 1992
  259. --- bison-1.19-zoo/system.h    Tue Nov 10 16:54:01 1992
  260. ***************
  261. *** 4,14 ****
  262.   #endif /* MSDOS */
  263.   
  264. ! #if defined(USG) || defined(VMS)
  265.   #include <string.h>
  266. ! #else /* not USG */
  267. ! #ifdef MSDOS
  268. ! #include <string.h>
  269.   #else
  270.   #include <strings.h>
  271. ! #endif /* not MSDOS */
  272. ! #endif /* not USG */
  273. --- 4,15 ----
  274.   #endif /* MSDOS */
  275.   
  276. ! #if HAVE_STRING_H || STDC_HEADERS
  277.   #include <string.h>
  278. ! #define index strchr
  279. ! #define rindex strrchr
  280. ! #define bcopy(s, d, n) memcpy ((d), (s), (n))
  281. ! #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
  282. ! #define bzero(s, n) memset ((s), 0, (n))
  283.   #else
  284.   #include <strings.h>
  285. ! #endif
  286.  
  287.