Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: zsh-3.1.5-pws-6: cygwin rlimit config fix



Zsh's makepro.awk script currently pulls all the prototypes out of the
source file regardless of whether they're compiled into the image.

This causes a problem with with exec.pro, since it pulls out
prototypes for current_limits, which is in terms of the RLIM_NLIMITS
#define.  If HAVE_GETRLIMIT isn't defined, RLIM_NLIMITS probably isn't
either.  The upshot is that exec.pro doesn't compile when running
under cygwin.

It also causes a few warnings to have prototypes for static functions
that are never defined.

The fix I used was to have makepro.awk handle things like

	/**/
	#ifdef HAVE_GETRLIMIT

and spit them out in the .pro file along with the prototypes like so:

#ifdef HAVE_GETRLIMIT
extern struct rlimit current_limits[RLIM_NLIMITS];
extern struct rlimit limits[RLIM_NLIMITS];
extern int zsetlimit _((int limnum,char*nam));
extern int setlimits _((char*nam));
#endif /* HAVE_GETRLIMIT */

...which nicely avoids the problem.

Index: zsh/ChangeLog
diff -c zsh/ChangeLog:1.1.1.1 zsh/ChangeLog:1.4
*** zsh/ChangeLog:1.1.1.1	Sat Jan 23 18:10:11 1999
--- zsh/ChangeLog	Sat Jan 30 14:06:22 1999
***************
*** 1,3 ****
--- 1,34 ----
+ 1999-01-24  Matt Armstrong  <matt_armstrong@bigfoot.com>
+ 
+ 	* Src/init.c: Stick /**/ before autoload_zleread() #ifdefs to
+ 	avoid compiler warning.
+ 
+ 	* Src/exec.c: Stick /**/ before and after #ifdef GET_RLIMIT to
+ 	prevent a reference to RLIM_NLIMITS in exec.pro.
+ 
+ 	* Src/makepro.awk: Handles preprocessor conditionals after /**/
+ 	lines.
Index: zsh/Src/exec.c
diff -c zsh/Src/exec.c:1.1.1.2 zsh/Src/exec.c:1.2
*** zsh/Src/exec.c:1.1.1.2	Sat Jan 23 20:48:36 1999
--- zsh/Src/exec.c	Sun Jan 24 10:41:28 1999
***************
*** 148,153 ****
--- 148,154 ----
      return l;
  }
  
+ /**/
  #ifdef HAVE_GETRLIMIT
  
  /* the resource limits for the shell and its children */
***************
*** 184,189 ****
--- 185,191 ----
      return ret;
  }
  
+ /**/
  #endif /* HAVE_GETRLIMIT */
  
  /* fork and set limits */
Index: zsh/Src/init.c
diff -c zsh/Src/init.c:1.1.1.3 zsh/Src/init.c:1.3
*** zsh/Src/init.c:1.1.1.3	Sat Jan 30 10:15:06 1999
--- zsh/Src/init.c	Sat Jan 30 10:30:07 1999
***************
*** 936,941 ****
--- 936,942 ----
      /* do nothing */
  }
  
+ /**/
  # ifdef UNLINKED_XMOD_zle
  
  /**/
***************
*** 947,952 ****
--- 948,954 ----
      return zleread(lp, rp, ha);
  }
  
+ /**/
  # endif /* UNLINKED_XMOD_zle */
  
  /**/
Index: zsh/Src/makepro.awk
diff -c zsh/Src/makepro.awk:1.1.1.2 zsh/Src/makepro.awk:1.3
*** zsh/Src/makepro.awk:1.1.1.2	Sat Jan 23 20:48:39 1999
--- zsh/Src/makepro.awk	Sun Jan 24 10:48:29 1999
***************
*** 40,45 ****
--- 40,52 ----
  	    aborting = 1
  	    exit 1
  	}
+ 	if (line == "" && $0 ~ /^[ \t]*#/) {
+             # Directly after the /**/ was a preprocessor line.
+             # Spit it out and re-start the outer loop.
+ 	    printf "%s\n", $0
+ 	    locals = locals $0 "\n"
+ 	    next
+ 	}
  	gsub(/\t/, " ")
  	line = line " " $0
  	gsub(/\/\*([^*]|\*+[^*\/])*\*+\//, " ", line)


Messages sorted by: Reverse Date, Date, Thread, Author