Ignore:
Timestamp:
Oct 29, 2008, 12:02:45 AM (17 years ago)
Author:
bird
Message:

Load gnumake-2008-10-28-CVS into vendor/gnumake/current.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/gnumake/current/read.c

    r900 r1989  
    11/* Reading and parsing of makefiles for GNU Make.
    22Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
    3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
    44Foundation, Inc.
    55This file is part of GNU Make.
     
    77GNU Make is free software; you can redistribute it and/or modify it under the
    88terms of the GNU General Public License as published by the Free Software
    9 Foundation; either version 2, or (at your option) any later version.
     9Foundation; either version 3 of the License, or (at your option) any later
     10version.
    1011
    1112GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     
    1415
    1516You should have received a copy of the GNU General Public License along with
    16 GNU Make; see the file COPYING.  If not, write to the Free Software
    17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.  */
     17this program.  If not, see <http://www.gnu.org/licenses/>.  */
    1818
    1919#include "make.h"
     
    468468#define record_waiting_files()                                                \
    469469  do                                                                          \
    470     {                                                                         \
     470    {                                                                         \
    471471      if (filenames != 0)                                                     \
    472472        {                                                                     \
     
    541541                continue;
    542542
    543               /* Append this command line to the line being accumulated.  */
     543              /* Append this command line to the line being accumulated.
     544                 Strip command prefix chars that appear after newlines.  */
    544545              if (commands_idx == 0)
    545546                cmds_started = ebuf->floc.lineno;
    546547
    547               if (linelen + 1 + commands_idx > commands_len)
     548              if (linelen + commands_idx > commands_len)
    548549                {
    549                   commands_len = (linelen + 1 + commands_idx) * 2;
     550                  commands_len = (linelen + commands_idx) * 2;
    550551                  commands = xrealloc (commands, commands_len);
    551552                }
    552               memcpy (&commands[commands_idx], line, linelen);
    553               commands_idx += linelen;
    554               commands[commands_idx++] = '\n';
     553              p = &commands[commands_idx];
     554              p2 = line + 1;
     555              while (--linelen)
     556                {
     557                  ++commands_idx;
     558                  *(p++) = *p2;
     559                  if (p2[0] == '\n' && p2[1] == cmd_prefix)
     560                    {
     561                      ++p2;
     562                      --linelen;
     563                    }
     564                  ++p2;
     565                }
     566              *p = '\n';
     567              ++commands_idx;
    555568
    556569              continue;
     
    575588
    576589      /* Compare a word, both length and contents. */
    577 #define word1eq(s)      (wlen == sizeof(s)-1 && strneq (s, p, sizeof(s)-1))
     590#define word1eq(s)      (wlen == sizeof(s)-1 && strneq (s, p, sizeof(s)-1))
    578591      p = collapsed;
    579592      while (isspace ((unsigned char)*p))
     
    613626      if (!in_ignored_define)
    614627        {
    615           int i = conditional_line (p, wlen, fstart);
     628          int i = conditional_line (p, wlen, fstart);
    616629          if (i != -2)
    617630            {
     
    849862         variable definition.  But now we know it is definitely lossage.  */
    850863      if (line[0] == cmd_prefix)
    851         fatal(fstart, _("commands commence before first target"));
     864        fatal(fstart, _("recipe commences before first target"));
    852865
    853866      /* This line describes some target files.  This is complicated by
     
    900913          case w_eol:
    901914            if (cmdleft != 0)
    902               fatal(fstart, _("missing rule before commands"));
     915              fatal(fstart, _("missing rule before recipe"));
    903916            /* This line contained something but turned out to be nothing
    904917               but whitespace (a comment?).  */
     
    9881001                 one of the most common bugs found in makefiles...  */
    9891002              fatal (fstart, _("missing separator%s"),
    990                      !strneq(line, "        ", 8) ? ""
    991                      : _(" (did you mean TAB instead of 8 spaces?)"));
     1003                     (cmd_prefix == '\t' && !strneq(line, "        ", 8))
     1004                     ? "" : _(" (did you mean TAB instead of 8 spaces?)"));
    9921005            continue;
    9931006          }
     
    18811894     See Savannah bug # 12124.  */
    18821895  if (snapped_deps)
    1883     fatal (flocp, _("prerequisites cannot be defined in command scripts"));
     1896    fatal (flocp, _("prerequisites cannot be defined in recipes"));
    18841897
    18851898  if (commands_idx > 0)
     
    19811994            {
    19821995              error (&cmds->fileinfo,
    1983                      _("warning: overriding commands for target `%s'"),
     1996                     _("warning: overriding recipe for target `%s'"),
    19841997                     f->name);
    19851998              error (&f->cmds->fileinfo,
    1986                      _("warning: ignoring old commands for target `%s'"),
     1999                     _("warning: ignoring old recipe for target `%s'"),
    19872000                     f->name);
    19882001            }
     
    24252438      /* Add it to the front of the chain.  */
    24262439      new1 = xmalloc (size);
     2440      memset (new1, '\0', size);
    24272441      new1->name = name;
    24282442      new1->next = new;
     
    29772991          if (len > max_incl_len)
    29782992            max_incl_len = len;
    2979           dirs[idx++] = strcache_add_len (*cpp, len - 1);
     2993          dirs[idx++] = strcache_add_len (*cpp, len);
    29802994        }
    29812995    }
Note: See TracChangeset for help on using the changeset viewer.