Changeset 1993 for trunk/src/kmk/read.c
- Timestamp:
- Oct 29, 2008, 1:37:51 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/read.c
r1980 r1993 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" … … 591 591 #define record_waiting_files() \ 592 592 do \ 593 { 593 { \ 594 594 if (filenames != 0) \ 595 595 { \ … … 672 672 continue; 673 673 674 /* Append this command line to the line being accumulated. */ 674 /* Append this command line to the line being accumulated. 675 Strip command prefix chars that appear after newlines. */ 675 676 if (commands_idx == 0) 676 677 cmds_started = ebuf->floc.lineno; 677 678 678 if (linelen + 1 +commands_idx > commands_len)679 if (linelen + commands_idx > commands_len) 679 680 { 680 commands_len = (linelen + 1 +commands_idx) * 2;681 commands_len = (linelen + commands_idx) * 2; 681 682 commands = xrealloc (commands, commands_len); 682 683 } 683 memcpy (&commands[commands_idx], line, linelen); 684 commands_idx += linelen; 685 commands[commands_idx++] = '\n'; 684 p = &commands[commands_idx]; 685 p2 = line + 1; 686 while (--linelen) 687 { 688 ++commands_idx; 689 *(p++) = *p2; 690 if (p2[0] == '\n' && p2[1] == cmd_prefix) 691 { 692 ++p2; 693 --linelen; 694 } 695 ++p2; 696 } 697 *p = '\n'; 698 ++commands_idx; 686 699 687 700 continue; … … 715 728 716 729 /* Compare a word, both length and contents. */ 717 #define word1eq(s) 730 #define word1eq(s) (wlen == sizeof(s)-1 && strneq (s, p, sizeof(s)-1)) 718 731 p = collapsed; 719 732 while (isspace ((unsigned char)*p)) … … 1121 1134 variable definition. But now we know it is definitely lossage. */ 1122 1135 if (line[0] == cmd_prefix) 1123 fatal(fstart, _(" commands commencebefore first target"));1136 fatal(fstart, _("recipe commences before first target")); 1124 1137 1125 1138 /* This line describes some target files. This is complicated by … … 1180 1193 case w_eol: 1181 1194 if (cmdleft != 0) 1182 fatal(fstart, _("missing rule before commands"));1195 fatal(fstart, _("missing rule before recipe")); 1183 1196 /* This line contained something but turned out to be nothing 1184 1197 but whitespace (a comment?). */ … … 1299 1312 one of the most common bugs found in makefiles... */ 1300 1313 fatal (fstart, _("missing separator%s"), 1301 !strneq(line, " ", 8) ? ""1302 : _(" (did you mean TAB instead of 8 spaces?)"));1314 (cmd_prefix == '\t' && !strneq(line, " ", 8)) 1315 ? "" : _(" (did you mean TAB instead of 8 spaces?)")); 1303 1316 continue; 1304 1317 } … … 2514 2527 See Savannah bug # 12124. */ 2515 2528 if (snapped_deps) 2516 fatal (flocp, _("prerequisites cannot be defined in command scripts"));2529 fatal (flocp, _("prerequisites cannot be defined in recipes")); 2517 2530 2518 2531 if (commands_idx > 0) … … 2673 2686 { 2674 2687 error (&cmds->fileinfo, 2675 _("warning: overriding commandsfor target `%s'"),2688 _("warning: overriding recipe for target `%s'"), 2676 2689 f->name); 2677 2690 error (&f->cmds->fileinfo, 2678 _("warning: ignoring old commandsfor target `%s'"),2691 _("warning: ignoring old recipe for target `%s'"), 2679 2692 f->name); 2680 2693 } … … 3207 3220 #ifndef CONFIG_WITH_ALLOC_CACHES 3208 3221 new1 = xmalloc (size); 3209 #else 3210 new1 = (struct nameseq *)alloccache_alloc (cache); 3222 memset (new1, '\0', size); 3223 #else 3224 new1 = (struct nameseq *) alloccache_calloc (cache); 3211 3225 #endif 3212 3226 new1->name = name; … … 3821 3835 if (len > max_incl_len) 3822 3836 max_incl_len = len; 3823 dirs[idx++] = strcache_add_len (*cpp, len - 1);3837 dirs[idx++] = strcache_add_len (*cpp, len); 3824 3838 } 3825 3839 }
Note:
See TracChangeset
for help on using the changeset viewer.