Re: Static pattern usage

2003-10-06 Thread Peter A. Kerzum
I used this trick with rather complex define/eval constructs
It really works but sometimes gives me 'virtual memory exhaused'
If you (Sam) are interested, I can give you precise example.
If only I figured out how to work out this (endless loop?)
my build system would be perfect =)
Paul D. Smith wrote:
%% Sam Ravnborg <[EMAIL PROTECTED]> writes:

  sr> Is there any other way to get the name of the target
  sr> to be used in the prerequisite list?
  sr> Other make implementation expands $* to the name of
  sr> the target when listed in the prerequisites, but not gnu make.
No make expands $* in the prerequisites list to the name of the target.

Some makes support a feature where $$@ (note two $'s!) in the
prerequisites list will expand to the name of the target.  GNU make also
supports this syntax (see the GNU make manual).
However, this won't help you because again, the $$@ is not expanded
until _after_ all the other variables are expanded.  This is true even
for other versions of make which support this syntax.
The only way to do what you want is to use the $(eval ...) function to
declare extra dependencies.  Something like:
  OBJS = foo.o
  deps_foo.o := foo.h
  $(foreach target,$(OBJS),$(eval $(target): $$(deps_$(target

(note, this is untested).



--
Best Regards,
Peter A. Kerzum


___
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make


make 3.80 subscript error if environ has small string

2003-10-06 Thread Paul Eggert
GNU make 3.80 assumes that every string in the environment has at least
MAKELEVEL_LENGTH bytes in it, and it executes a subscript error otherwise.
Normally this is harmless, but

Here is a patch.

2003-10-05  Paul Eggert  <[EMAIL PROTECTED]>

* main.c (main):
Avoid potential subscript error if environ has short strings.

===
RCS file: RCS/main.c,v
retrieving revision 3.80
retrieving revision 3.80.0.1
diff -pu -r3.80 -r3.80.0.1
--- main.c  2002/08/10 01:27:17 3.80
+++ main.c  2003/10/06 05:46:41 3.80.0.1
@@ -1845,8 +1845,8 @@ int main (int argc, char ** argv)
 
 #ifndef _AMIGA
  for (p = environ; *p != 0; ++p)
-   if ((*p)[MAKELEVEL_LENGTH] == '='
-   && strneq (*p, MAKELEVEL_NAME, MAKELEVEL_LENGTH))
+   if (strneq (*p, MAKELEVEL_NAME, MAKELEVEL_LENGTH)
+   && (*p)[MAKELEVEL_LENGTH] == '=')
  {
/* The SGI compiler apparently can't understand
   the concept of storing the result of a function


___
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make


virtual memory exhausted

2003-10-06 Thread Peter A. Kerzum
Excuse me for another silly question, but can you tell when could this 
error occure:

virtual memory exhausted

--
Best Regards,
Peter A. Kerzum


___
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make


make 3.80 sprintf potential buffer overruns

2003-10-06 Thread Paul Eggert
I audited GNU make 3.80 for potential buffer overruns due to sprintf
calls, and came up with the following patch.  Most of the buffer
overruns are fairly theoretical: they can occur only on hosts where
integers are fairly wide.  Some of them are more practical, though:
they can occur on hosts that have 5-digit file descriptor numbers.

2003-10-06  Paul Eggert  <[EMAIL PROTECTED]>

* arscan.c (ar_member_touch): Don't overrun buffer if a time stamp
is so large that it doesn't fit into ar_hdr.ar_date.
Report overflow instead.

* function.c (func_words):
Don't assume int can print in less than 20 bytes.
(func_shell): Don't assume that line number can print in 11
bytes or less.
(func_call): Don't assume that int can print in 10 bytes or less.

* main.c (main): Don't assume that file descriptors can be
printed as integers in 4 bytes or less.  Don't assume that
make level can be printed in less than about 30 bytes.
(define_makeflags): Don't assume that unsigned can be printed
in less than 30 bytes.  Don't assume that double %g prints in
less than 100 bytes.

* make.h (EOVERFLOW): Define if errno.h doesn't.
(INT_STRLEN_BOUND, INT_BUFSIZE_BOUND): New macros, taken from gnulib.

* misc.c (strerror): Don't refer to errno; that is bogus.
Don't translate "Unknown error %d", as the translation can
overflow the static buffer.  Don't assume that ints can be
printed in 20 bytes or less.

* signame.c (strsignal):
Don't assume that ints can be printed in 20 bytes or less.

* variable.c (define_automatic_variables): Don't assume that
version number + "Customs" fits in 200 bytes.  Don't assume
that int can be printed in less than 200 bytes.
(target_environment): Don't assume that double %g prints in less than
100 bytes.

===
RCS file: arscan.c,v
retrieving revision 3.80
retrieving revision 3.80.0.1
diff -pu -r3.80 -r3.80.0.1
--- arscan.c2001/06/01 03:56:50 3.80
+++ arscan.c2003/10/06 06:53:34 3.80.0.1
@@ -777,6 +777,7 @@ ar_member_touch (arname, memname)
   struct ar_hdr ar_hdr;
   register int i;
   struct stat statbuf;
+  char mtime_buf[INT_BUFSIZE_BOUND (statbuf.st_mtime)];
 
   if (pos < 0)
 return (int) pos;
@@ -803,7 +804,16 @@ ar_member_touch (arname, memname)
   /* Advance member's time to that time */
   for (i = 0; i < sizeof ar_hdr.ar_date; i++)
 ar_hdr.ar_date[i] = ' ';
-  sprintf (ar_hdr.ar_date, "%ld", (long int) statbuf.st_mtime);
+  if (statbuf.st_mtime < 0)
+sprintf (mtime_buf, "%ld", (long int) statbuf.st_mtime);
+  else
+sprintf (mtime_buf, "%lu", (unsigned long int) statbuf.st_mtime);
+  if (sizeof ar_hdr.ar_date <= strlen (mtime_buf))
+{
+  errno = EOVERFLOW;
+  goto lose;
+}
+  strcpy (ar_hdr.ar_date, mtime_buf);
 #ifdef AIAMAG
   ar_hdr.ar_date[strlen(ar_hdr.ar_date)] = ' ';
 #endif
===
RCS file: function.c,v
retrieving revision 3.80
retrieving revision 3.80.0.1
diff -pu -r3.80 -r3.80.0.1
--- function.c  2002/10/04 02:13:42 3.80
+++ function.c  2003/10/06 06:53:34 3.80.0.1
@@ -704,7 +704,7 @@ func_words (o, argv, funcname)
 {
   int i = 0;
   char *word_iterator = argv[0];
-  char buf[20];
+  char buf[INT_BUFSIZE_BOUND (i)];
 
   while (find_next_token (&word_iterator, (unsigned int *) 0) != 0)
 ++i;
@@ -1531,7 +1531,9 @@ func_shell (o, argv, funcname)
   /* For error messages.  */
   if (reading_file != 0)
 {
-  error_prefix = (char *) alloca (strlen (reading_file->filenm)+11+4);
+  error_prefix = (char *) alloca (strlen (reading_file->filenm) + 1
+ + INT_STRLEN_BOUND (reading_file->lineno)
+ + 3);
   sprintf (error_prefix,
   "%s:%lu: ", reading_file->filenm, reading_file->lineno);
 }
@@ -2045,7 +2047,7 @@ func_call (o, argv, funcname)
 
   for (i=0; *argv; ++i, ++argv)
 {
-  char num[11];
+  char num[INT_BUFSIZE_BOUND (i)];
 
   sprintf (num, "%d", i);
   define_variable (num, strlen (num), *argv, o_automatic, 0);
===
RCS file: main.c,v
retrieving revision 3.80.0.1
retrieving revision 3.80.0.2
diff -pu -r3.80.0.1 -r3.80.0.2
--- main.c  2003/10/06 05:46:41 3.80.0.1
+++ main.c  2003/10/06 07:02:01 3.80.0.2
@@ -1573,7 +1573,8 @@ int main (int argc, char ** argv)
   jobserver_fds = (struct stringlist *)
 xmalloc (sizeof (struct stringlist));
   jobserver_fds->list = (char **) xmalloc (sizeof (char *));
-  jobserver_fds->list[0] = xmalloc ((sizeof ("1024")*2)+1);
+  jobserver_fds->list[0] = xmalloc (INT_STRLEN_BOUND (job_fds[0]) + 1
+ 

Re: Static pattern usage

2003-10-06 Thread Paul D. Smith
%% "Peter A. Kerzum" <[EMAIL PROTECTED]> writes:

  pak> I used this trick with rather complex define/eval constructs It
  pak> really works but sometimes gives me 'virtual memory exhaused' If
  pak> you (Sam) are interested, I can give you precise example.  If
  pak> only I figured out how to work out this (endless loop?)  my build
  pak> system would be perfect =)

Apply the patch attached to bug #1517 at

  http://savannah.gnu.org/projects/make

-- 
---
 Paul D. Smith <[EMAIL PROTECTED]>  Find some GNU make tips at:
 http://www.gnu.org  http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


___
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make


Re: virtual memory exhausted

2003-10-06 Thread Jerome Zago
On Monday 06 October 2003 11:49, Peter A. Kerzum wrote:
> Excuse me for another silly question, but can you tell when could this
> error occure:
>
> virtual memory exhausted

When calling malloc(0) on some systems. See 
http://savannah.gnu.org/bugs/?func=detailbug&bug_id=2888&group_id=71 for 
details.


___
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make


Re: Static pattern usage

2003-10-06 Thread Sam Ravnborg
On Mon, Oct 06, 2003 at 01:53:48PM +0400, Peter A. Kerzum wrote:
> I used this trick with rather complex define/eval constructs
> It really works but sometimes gives me 'virtual memory exhaused'
> If you (Sam) are interested, I can give you precise example.

I would be glad to see that - if not for anything else then
just to learn one more way to utilise make.

TIA, Sam


___
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make


Unable to build win32 GNU make-3.80

2003-10-06 Thread jgrant
Hello,

Just tried to build win32 version of make-3.80.  I had some problems with
that though:

1. The build_w32.bat has a typo, + before the first if.  This should not be
there.
2. In the "NMakefile" $(MAKE) is used, which is in my environment to be set
to gmake.exe, perhaps this NMakefile should use something like:
NMAKE=nmake.exe Then use $(NMAKE) to avoid other make conflicts in the
NMakefile in the archive.
3. This version of GNU make would not build, using MSVC6, or MSVC .Net C
compiler, the batch file, or the "nmake NMakefile" methods.

Attached is a log, does anyone have any ideas what could be the problem? I
did this in cmd.exe, setting the appropriate environment variables before
trying, using vcvars32.bat etc.


Best regards

J. Grant




C:\Documents and Settings\jgrant\Desktop\make-3.80>set make=gnumake 

C:\Documents and Settings\jgrant\Desktop\make-3.80>if not exist config.h copy 
config.h.W32 config.h 

C:\Documents and Settings\jgrant\Desktop\make-3.80>cd w32\subproc 

C:\Documents and Settings\jgrant\Desktop\make-3.80\w32\subproc>echo "Creating the 
subproc library" 
"Creating the subproc library"

C:\Documents and 
Settings\jgrant\Desktop\make-3.80\w32\subproc>C:\WINNT\system32\cmd.exe /c build.bat 

C:\Documents and Settings\jgrant\Desktop\make-3.80\w32\subproc>if not exist 
.\WinDebug\nul mkdir .\WinDebug 

C:\Documents and Settings\jgrant\Desktop\make-3.80\w32\subproc>cl.exe /nologo /MT /W3 
/GX /Z7 /YX /Od /I .. /I . /I ../include /D WIN32 /D WINDOWS32 /D _DEBUG /D _WINDOWS 
/FR.\WinDebug/ /Fp.\WinDebug/subproc.pch /Fo.\WinDebug/ /c misc.c 
misc.c

C:\Documents and Settings\jgrant\Desktop\make-3.80\w32\subproc>cl.exe /nologo /MT /W3 
/GX /Z7 /YX /Od /I .. /I . /I ../include /I ../.. /D WIN32 /D WINDOWS32 /D _DEBUG /D 
_WINDOWS /FR.\WinDebug/ /Fp.\WinDebug/subproc.pch /Fo.\WinDebug/ /c sub_proc.c 
sub_proc.c

C:\Documents and Settings\jgrant\Desktop\make-3.80\w32\subproc>cl.exe /nologo /MT /W3 
/GX /Z7 /YX /Od /I .. /I . /I ../include /D WIN32 /D WINDOWS32 /D _DEBUG /D _WINDOWS 
/FR.\WinDebug/ /Fp.\WinDebug/subproc.pch /Fo.\WinDebug/ /c w32err.c 
w32err.c

C:\Documents and Settings\jgrant\Desktop\make-3.80\w32\subproc>lib.exe /NOLOGO 
/OUT:.\WinDebug\subproc.lib  .\WinDebug/misc.obj  .\WinDebug/sub_proc.obj  
.\WinDebug/w32err.obj 

C:\Documents and Settings\jgrant\Desktop\make-3.80\w32\subproc>if not exist 
.\WinRel\nul mkdir .\WinRel 

C:\Documents and Settings\jgrant\Desktop\make-3.80\w32\subproc>cl.exe /nologo /MT /W3 
/GX /YX /O2 /I ../include /D WIN32 /D WINDOWS32 /D NDEBUG /D _WINDOWS /FR.\WinRel/ 
/Fp.\WinRel/subproc.pch /Fo.\WinRel/ /c misc.c 
misc.c

C:\Documents and Settings\jgrant\Desktop\make-3.80\w32\subproc>cl.exe /nologo /MT /W3 
/GX /YX /O2 /I ../include /I ../.. /D WIN32 /D WINDOWS32 /D NDEBUG /D _WINDOWS 
/FR.\WinRel/ /Fp.\WinRel/subproc.pch /Fo.\WinRel/ /c sub_proc.c 
sub_proc.c

C:\Documents and Settings\jgrant\Desktop\make-3.80\w32\subproc>cl.exe /nologo /MT /W3 
/GX /YX /O2 /I ../include /D WIN32 /D WINDOWS32 /D NDEBUG /D _WINDOWS /FR.\WinRel/ 
/Fp.\WinRel/subproc.pch /Fo.\WinRel/ /c w32err.c 
w32err.c

C:\Documents and Settings\jgrant\Desktop\make-3.80\w32\subproc>lib.exe /NOLOGO 
/OUT:.\WinRel\subproc.lib  .\WinRel/misc.obj  .\WinRel/sub_proc.obj  
.\WinRel/w32err.obj 

C:\Documents and Settings\jgrant\Desktop\make-3.80\w32\subproc>cd ..\.. 

C:\Documents and Settings\jgrant\Desktop\make-3.80>del link.dbg link.rel 

C:\Documents and Settings\jgrant\Desktop\make-3.80>del config.h 

C:\Documents and Settings\jgrant\Desktop\make-3.80>copy config.h.W32 config.h 
1 file(s) copied.

C:\Documents and Settings\jgrant\Desktop\make-3.80>echo off 
"Creating GNU make for Windows 95/NT"

C:\Documents and Settings\jgrant\Desktop\make-3.80>if not exist .\WinDebug\nul mkdir 
.\WinDebug 

C:\Documents and Settings\jgrant\Desktop\make-3.80>cl.exe /nologo /MT /W3 /GX /Zi /YX 
/Od /I . /I glob /I w32/include /D TIVOLI /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE 
/D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/gnumake.pch /Fo.\WinDebug/ 
/Fd.\WinDebug/gnumake.pdb /c variable.c 
variable.c
variable.c(85) : warning C4113: 'unsigned long (__cdecl *)()' differs in parameter 
lists from 'unsigned long (__cdecl *)(const void *)'
variable.c(85) : warning C4113: 'unsigned long (__cdecl *)()' differs in parameter 
lists from 'unsigned long (__cdecl *)(const void *)'
variable.c(85) : warning C4113: 'int (__cdecl *)()' differs in parameter lists from 
'int (__cdecl *)(const void *,const void *)'
variable.c(399) : warning C4113: 'unsigned long (__cdecl *)()' differs in parameter 
lists from 'unsigned long (__cdecl *)(const void *)'
variable.c(399) : warning C4113: 'unsigned long (__cdecl *)()' differs in parameter 
lists from 'unsigned long (__cdecl *)(const void *)'
variable.c(399) : warning C4113: 'int (__cdecl *)()' differs in parameter lists from 
'int (__cdecl *)(const void *,const void *)'
variable.c(470) : warning C4113: 'void (__cdecl *)()' differs in parameter lists from 
'

Re: Unable to build win32 GNU make-3.80

2003-10-06 Thread Paul D. Smith
%% [EMAIL PROTECTED] writes:

  j> 3. This version of GNU make would not build, using MSVC6, or MSVC
  j>.Net C compiler, the batch file, or the "nmake NMakefile" methods.

See bug # 1687 on Savannah (http://savannah.gnu.org/projects/make)

-- 
---
 Paul D. Smith <[EMAIL PROTECTED]>  Find some GNU make tips at:
 http://www.gnu.org  http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


___
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make


RE: Unable to build win32 GNU make-3.80

2003-10-06 Thread jgrant
Hello,

Thanks for the pointer
[http://savannah.gnu.org/bugs/?func=detailbug&bug_id=1687&group_id=71].  Is
there any plan to release a fixed version of 3.80?  It seems like it is
quite a while it has not been working.

Is there a release Errata for GNU make?  I think this would be useful if
there is not one already, I could not find one.

Regarding the warnings during compile, are they all still in CVS version? if
they are, then I can create a patch that resolves some of these if you would
like (I will test on several platforms etc).  Please let me know if you
would like me to do this.

Best regards

J. Grant


> -Original Message-
> From: Paul D. Smith [mailto:[EMAIL PROTECTED]
> Sent: 06 October 2003 17:08
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: Unable to build win32 GNU make-3.80
> 
> 
> %% [EMAIL PROTECTED] writes:
> 
>   j> 3. This version of GNU make would not build, using MSVC6, or MSVC
>   j>.Net C compiler, the batch file, or the "nmake 
> NMakefile" methods.
> 
> See bug # 1687 on Savannah (http://savannah.gnu.org/projects/make)
> 
> --
> --
> -
>  Paul D. Smith <[EMAIL PROTECTED]>  Find some GNU make tips at:
>  http://www.gnu.org  http://make.paulandlesley.org
>  "Please remain calm...I may be mad, but I am a 
> professional." --Mad Scientist
> 


___
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make