bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error with gmake: overriding macros


From: Paul D. Smith
Subject: Re: error with gmake: overriding macros
Date: Fri, 16 Feb 2001 00:55:29 -0500

%% Nolan Ed-P1840C <address@hidden> writes:

  ne> gmake TIMING=min -f makefile.simdif mul0 ; #-- gmake command fails ERROR 2

"Error 2" is not a GNU make error message.  It's difficult to be 100%
sure without the actual message, but that typically means that the
subprocess make invoked (the shell in this case) exited with an error
code of 2, rather than 0.

I suggest you examine the output command line generated by make
vs. gmake and carefully compare them to determine where they're
different.

  ne> I have tried many different debug options and spent a bunch of
  ne> time trying to figure out why.  to no avail.. Is this a legitimate
  ne> bug?

There's no way to know since you haven't provided enough information,
and I can't reproduce the problem.

  ne> gmake -ver
  ne> GNU Make version 3.79, by Richard Stallman and Roland McGrath.

You might try the latest version (3.79.1) and see if that helps at all.

You might also try the patch below; there is a problem that was recently
reported and fixed on certain rare, specific types of command lines.

--- make-3.79.1/read.c  Wed Jun 21 15:33:30 2000
+++ make/read.c Fri Nov 24 09:12:25 2000
@@ -2142,15 +2142,16 @@
   char *buffer = linebuffer->buffer;
   register char *p = linebuffer->buffer;
   register char *end = p + linebuffer->size;
-  register int len, lastlen = 0;
-  register char *p2;
   register unsigned int nlines = 0;
-  register int backslash;
 
   *p = '\0';
 
   while (fgets (p, end - p, stream) != 0)
     {
+      char *p2;
+      unsigned long len;
+      int backslash;
+
       len = strlen (p);
       if (len == 0)
        {
@@ -2164,51 +2165,42 @@
          len = 1;
        }
 
+      /* Jump past the text we just read.  */
       p += len;
+
+      /* If the last char isn't a newline, the whole line didn't fit into the
+         buffer.  Get some more buffer and try again.  */
       if (p[-1] != '\n')
        {
-         /* Probably ran out of buffer space.  */
-         register unsigned int p_off = p - buffer;
+         unsigned long p_off = p - buffer;
          linebuffer->size *= 2;
          buffer = (char *) xrealloc (buffer, linebuffer->size);
          p = buffer + p_off;
          end = buffer + linebuffer->size;
          linebuffer->buffer = buffer;
          *p = '\0';
-         lastlen = len;
          continue;
        }
 
+      /* We got a newline, so add one to the count of lines.  */
       ++nlines;
 
 #if !defined(WINDOWS32) && !defined(__MSDOS__)
       /* Check to see if the line was really ended with CRLF; if so ignore
          the CR.  */
-      if (len > 1 && p[-2] == '\r')
+      if ((p - buffer) > 1 && p[-2] == '\r')
         {
-          --len;
           --p;
           p[-1] = '\n';
         }
 #endif
 
-      if (len == 1 && p > buffer)
-       /* P is pointing at a newline and it's the beginning of
-          the buffer returned by the last fgets call.  However,
-          it is not necessarily the beginning of a line if P is
-          pointing past the beginning of the holding buffer.
-          If the buffer was just enlarged (right before the newline),
-          we must account for that, so we pretend that the two lines
-          were one line.  */
-       len += lastlen;
-      lastlen = len;
       backslash = 0;
-      for (p2 = p - 2; --len > 0; --p2)
+      for (p2 = p - 2; p2 >= buffer; --p2)
        {
-         if (*p2 == '\\')
-           backslash = !backslash;
-         else
+         if (*p2 != '\\')
            break;
+          backslash = !backslash;
        }
 
       if (!backslash)


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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]