Changeset 1989 for vendor/gnumake/current/read.c
- Timestamp:
- Oct 29, 2008, 12:02:45 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/gnumake/current/read.c
r900 r1989 1 1 /* Reading and parsing of makefiles for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software 4 4 Foundation, Inc. 5 5 This file is part of GNU Make. … … 7 7 GNU Make is free software; you can redistribute it and/or modify it under the 8 8 terms of the GNU General Public License as published by the Free Software 9 Foundation; either version 2, or (at your option) any later version. 9 Foundation; either version 3 of the License, or (at your option) any later 10 version. 10 11 11 12 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY … … 14 15 15 16 You 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. */ 17 this program. If not, see <http://www.gnu.org/licenses/>. */ 18 18 19 19 #include "make.h" … … 468 468 #define record_waiting_files() \ 469 469 do \ 470 { 470 { \ 471 471 if (filenames != 0) \ 472 472 { \ … … 541 541 continue; 542 542 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. */ 544 545 if (commands_idx == 0) 545 546 cmds_started = ebuf->floc.lineno; 546 547 547 if (linelen + 1 +commands_idx > commands_len)548 if (linelen + commands_idx > commands_len) 548 549 { 549 commands_len = (linelen + 1 +commands_idx) * 2;550 commands_len = (linelen + commands_idx) * 2; 550 551 commands = xrealloc (commands, commands_len); 551 552 } 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; 555 568 556 569 continue; … … 575 588 576 589 /* Compare a word, both length and contents. */ 577 #define word1eq(s) 590 #define word1eq(s) (wlen == sizeof(s)-1 && strneq (s, p, sizeof(s)-1)) 578 591 p = collapsed; 579 592 while (isspace ((unsigned char)*p)) … … 613 626 if (!in_ignored_define) 614 627 { 615 628 int i = conditional_line (p, wlen, fstart); 616 629 if (i != -2) 617 630 { … … 849 862 variable definition. But now we know it is definitely lossage. */ 850 863 if (line[0] == cmd_prefix) 851 fatal(fstart, _(" commands commencebefore first target"));864 fatal(fstart, _("recipe commences before first target")); 852 865 853 866 /* This line describes some target files. This is complicated by … … 900 913 case w_eol: 901 914 if (cmdleft != 0) 902 fatal(fstart, _("missing rule before commands"));915 fatal(fstart, _("missing rule before recipe")); 903 916 /* This line contained something but turned out to be nothing 904 917 but whitespace (a comment?). */ … … 988 1001 one of the most common bugs found in makefiles... */ 989 1002 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?)")); 992 1005 continue; 993 1006 } … … 1881 1894 See Savannah bug # 12124. */ 1882 1895 if (snapped_deps) 1883 fatal (flocp, _("prerequisites cannot be defined in command scripts"));1896 fatal (flocp, _("prerequisites cannot be defined in recipes")); 1884 1897 1885 1898 if (commands_idx > 0) … … 1981 1994 { 1982 1995 error (&cmds->fileinfo, 1983 _("warning: overriding commandsfor target `%s'"),1996 _("warning: overriding recipe for target `%s'"), 1984 1997 f->name); 1985 1998 error (&f->cmds->fileinfo, 1986 _("warning: ignoring old commandsfor target `%s'"),1999 _("warning: ignoring old recipe for target `%s'"), 1987 2000 f->name); 1988 2001 } … … 2425 2438 /* Add it to the front of the chain. */ 2426 2439 new1 = xmalloc (size); 2440 memset (new1, '\0', size); 2427 2441 new1->name = name; 2428 2442 new1->next = new; … … 2977 2991 if (len > max_incl_len) 2978 2992 max_incl_len = len; 2979 dirs[idx++] = strcache_add_len (*cpp, len - 1);2993 dirs[idx++] = strcache_add_len (*cpp, len); 2980 2994 } 2981 2995 }
Note:
See TracChangeset
for help on using the changeset viewer.