Changeset 1980 in kBuild
- Timestamp:
- Oct 27, 2008 11:25:49 PM (16 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/commands.c
r1954 r1980 413 413 414 414 cmds->any_recurse = 0; 415 #ifdef CONFIG_WITH_COMMANDS_FUNC 415 #ifndef CONFIG_WITH_COMMANDS_FUNC 416 cmds->lines_flags = xmalloc (nlines); 417 #else 416 418 cmds->lines_flags = xmalloc (nlines * sizeof (cmds->lines_flags[0])); 417 #else418 cmds->lines_flags = xmalloc (nlines);419 419 #endif 420 420 for (idx = 0; idx < nlines; ++idx) … … 423 423 424 424 for (p = lines[idx]; 425 #ifdef CONFIG_WITH_COMMANDS_FUNC 425 #ifndef CONFIG_WITH_COMMANDS_FUNC 426 isblank ((unsigned char)*p) || *p == '-' || *p == '@' || *p == '+'; 427 #else 426 428 isblank ((unsigned char)*p) || *p == '-' || *p == '@' || *p == '+' || *p == '%'; 427 #else428 isblank ((unsigned char)*p) || *p == '-' || *p == '@' || *p == '+';429 429 #endif 430 430 ++p) … … 536 536 exit (10); 537 537 #else /* not Amiga */ 538 #if defined (WINDOWS32) && !defined(CONFIG_NEW_WIN32_CTRL_EVENT)538 #if defined (WINDOWS32) && !defined (CONFIG_NEW_WIN32_CTRL_EVENT) 539 539 extern HANDLE main_thread; 540 540 … … 618 618 619 619 #ifdef WINDOWS32 620 # ifndef CONFIG_NEW_WIN32_CTRL_EVENT620 # ifndef CONFIG_NEW_WIN32_CTRL_EVENT 621 621 if (main_thread) 622 622 CloseHandle (main_thread); 623 # endif /* !CONFIG_NEW_WIN32_CTRL_EVENT */623 # endif /* !CONFIG_NEW_WIN32_CTRL_EVENT */ 624 624 /* Cannot call W32_kill with a pid (it needs a handle). The exit 625 625 status of 130 emulates what happens in Bash. */ -
trunk/src/kmk/dep.h
r1863 r1980 59 59 60 60 61 62 61 #ifndef CONFIG_WITH_ALLOC_CACHES 63 62 struct nameseq *multi_glob (struct nameseq *chain, unsigned int size); -
trunk/src/kmk/dir.c
r1941 r1980 220 220 #ifndef DIRECTORY_BUCKETS 221 221 #ifdef KMK 222 # define DIRECTORY_BUCKETS 4096222 # define DIRECTORY_BUCKETS 4096 223 223 # else 224 # define DIRECTORY_BUCKETS 199224 # define DIRECTORY_BUCKETS 199 225 225 # endif 226 226 #endif … … 1016 1016 #endif 1017 1017 memset (dir->contents, '\0', sizeof (struct directory_contents)); 1018 1019 1018 } 1020 1019 … … 1239 1238 files += f; 1240 1239 impossible += im; 1241 1242 1240 #ifdef KMK 1243 1241 fputs ("# ", stdout); … … 1391 1389 gl->gl_closedir = ansi_free; 1392 1390 gl->gl_stat = local_stat; 1393 #ifdef __EMX__ /* The FreeBSD implemen ation actually uses gl_lstat!! */1391 #ifdef __EMX__ /* The FreeBSD implementation actually uses gl_lstat!! */ 1394 1392 gl->gl_lstat = local_stat; 1395 1393 #endif … … 1404 1402 hash_init (&directories, DIRECTORY_BUCKETS, 1405 1403 directory_hash_1, directory_hash_2, directory_hash_cmp); 1406 #else /* */1404 #else /* CONFIG_WITH_STRCACHE2 */ 1407 1405 hash_init_strcached (&directories, DIRECTORY_BUCKETS, &file_strcache, 1408 1406 offsetof (struct directory, name)); 1409 #endif /* */1407 #endif /* CONFIG_WITH_STRCACHE2 */ 1410 1408 hash_init (&directory_contents, DIRECTORY_BUCKETS, 1411 1409 directory_contents_hash_1, directory_contents_hash_2, … … 1418 1416 alloccache_init (&dirfile_cache, sizeof (struct dirfile), 1419 1417 "dirfile", NULL, NULL); 1420 #endif 1421 } 1418 #endif /* CONFIG_WITH_ALLOC_CACHES */ 1419 } -
trunk/src/kmk/expand.c
r1975 r1980 81 81 unsigned int offset = ptr - variable_buffer; 82 82 variable_buffer_length = (newlen + 100 > 2 * variable_buffer_length 83 84 83 ? newlen + 100 84 : 2 * variable_buffer_length); 85 85 variable_buffer = xrealloc (variable_buffer, variable_buffer_length); 86 86 ptr = variable_buffer + offset; … … 116 116 variable_buffer[0] = '\0'; 117 117 } 118 #else 118 #else /* CONFIG_WITH_VALUE_LENGTH */ 119 119 if (variable_buffer == 0) 120 120 { … … 123 123 variable_buffer[0] = '\0'; 124 124 } 125 #endif 125 #endif /* CONFIG_WITH_VALUE_LENGTH */ 126 126 127 127 return variable_buffer; … … 210 210 /* Expand a simple reference to variable NAME, which is LENGTH chars long. */ 211 211 212 #if defined(__GNUC__) || defined(_MSC_VER) /* bird added MSC */212 #if defined(__GNUC__) 213 213 __inline 214 #elif defined (MY_INLINE) /* bird */ 215 MY_INLINE 214 216 #endif 215 217 static char * … … 236 238 unsigned int value_len; 237 239 240 /* XXX: Inline recursively_expand_for_file() here and what it calls, try 241 make use of O directly instead wasting time on an intermediate buffer. */ 238 242 value = recursively_expand_for_file (v, NULL, &value_len); 239 243 o = variable_buffer_output (o, value, value_len); … … 760 764 #ifndef CONFIG_WITH_VALUE_LENGTH 761 765 return variable_expand_string(NULL, line, (long)-1); 762 #else 766 #else /* CONFIG_WITH_VALUE_LENGTH */ 763 767 char *s; 764 768 … … 770 774 } 771 775 return variable_expand_string_2 (NULL, line, (long)-1, &s); 772 #endif 776 #endif /* CONFIG_WITH_VALUE_LENGTH */ 773 777 } 774 778 … … 793 797 if (!end || *end == '\0') 794 798 return allocated_variable_expand (str); 799 795 800 tmp = alloca (end - str + 1); 796 801 memcpy (tmp, str, end - str); 797 802 tmp[end - str] = '\0'; 803 798 804 return allocated_variable_expand (tmp); 799 805 #else /* CONFIG_WITH_VALUE_LENGTH */ … … 844 850 { 845 851 char *result; 846 struct variable_set_list *save ;847 const struct floc * reading_file_saved;852 struct variable_set_list *savev; 853 const struct floc *savef; 848 854 long len = length == ~0U ? (long)-1 : (long)length; 849 855 char *eol; … … 856 862 else 857 863 { 858 save = current_variable_set_list;864 savev = current_variable_set_list; 859 865 current_variable_set_list = file->variables; 860 reading_file_saved = reading_file; 866 867 savef = reading_file; 861 868 if (file->cmds && file->cmds->fileinfo.filenm) 862 869 reading_file = &file->cmds->fileinfo; 863 870 else 864 871 reading_file = 0; 872 865 873 result = variable_expand_string_2 (o, line, len, &eol); 866 current_variable_set_list = save; 867 reading_file = reading_file_saved; 874 875 current_variable_set_list = savev; 876 reading_file = savef; 868 877 } 869 878 … … 1006 1015 variable_buffer = 0; 1007 1016 1008 assert ((unsigned int)v->length == strlen (v->name)); 1017 assert ((unsigned int)v->length == strlen (v->name)); /* bird */ 1009 1018 val = variable_append (v->name, strlen (v->name), current_variable_set_list); 1010 1019 variable_buffer_output (val, "", 1); -
trunk/src/kmk/file.c
r1975 r1980 538 538 multi_glob (parse_file_seq (&p, '\0', &dep_cache, 1), &dep_cache); 539 539 #endif 540 540 541 if (! new) 541 542 new = ood; … … 858 859 and thereby save a little time. */ 859 860 incdep_flush_and_term (); 860 #endif 861 #endif /* CONFIG_WITH_INCLUDEDEP */ 861 862 862 863 /* For every target that's not .SUFFIXES, expand its dependencies. … … 887 888 for (f2 = f->double_colon; f2 != 0; f2 = f2->prev) 888 889 f2->command_flags |= COMMANDS_NOTPARALLEL; 889 #endif 890 #endif /* KMK */ 890 891 free (file_slot_0); 891 892 … … 1383 1384 hash_init (&files, 1000, file_hash_1, file_hash_2, file_hash_cmp); 1384 1385 # endif 1385 #else 1386 #else /* CONFIG_WITH_STRCACHE2 */ 1386 1387 # ifdef KMK 1387 1388 hash_init_strcached (&files, 32755, &file_strcache, … … 1391 1392 offsetof (struct file, hname)); 1392 1393 # endif 1393 #endif 1394 #endif /* CONFIG_WITH_STRCACHE2 */ 1394 1395 } 1395 1396 -
trunk/src/kmk/filedef.h
r1975 r1980 211 211 #define ORDINARY_MTIME_MAX ((FILE_TIMESTAMP_S (NEW_MTIME) \ 212 212 << FILE_TIMESTAMP_LO_BITS) \ 213 + ORDINARY_MTIME_MIN + (FILE_TIMESTAMPS_PER_S - 1)) /* bird: MSC overflow fix */213 + ORDINARY_MTIME_MIN + (FILE_TIMESTAMPS_PER_S - 1)) /* bird: MSC overflow fix - XXX: darwin is bitching, check it again, org: ORDINARY_MTIME_MIN + FILE_TIMESTAMPS_PER_S - 1) */ 214 214 215 215 /* Modtime value to use for `infinitely new'. We used to get the current time -
trunk/src/kmk/function.c
r1972 r1980 340 340 /* Do the hash table lookup. */ 341 341 342 __inline staticconst struct function_table_entry *342 MY_INLINE const struct function_table_entry * 343 343 lookup_function_in_hash_tab (const char *s, unsigned char len) 344 344 { … … 352 352 /* Look up a function by name. */ 353 353 354 __inline staticconst struct function_table_entry *354 MY_INLINE const struct function_table_entry * 355 355 lookup_function (const char *s, unsigned int len) 356 356 { … … 517 517 0), 518 518 sizeof (struct nameseq)); 519 #else 519 #else /* CONFIG_WITH_ALLOC_CACHES */ 520 520 chain = multi_glob (parse_file_seq 521 521 (&line, '\0', &nameseq_cache, … … 525 525 0), 526 526 &nameseq_cache); 527 #endif 527 #endif /* CONFIG_WITH_ALLOC_CACHES */ 528 528 529 529 if (result == 0) … … 1032 1032 free (var->value); 1033 1033 var->value = savestring (p, len); 1034 1034 1035 result = allocated_variable_expand (body); 1035 1036 -
trunk/src/kmk/hash.h
r1902 r1980 100 100 /* hash and comparison macros for case-sensitive string keys. */ 101 101 102 #ifndef CONFIG_WITH_OPTIMIZATION_HACKS103 102 #define STRING_HASH_1(KEY, RESULT) do { \ 104 103 unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \ … … 106 105 (RESULT) += (*_key_ << (_key_[1] & 0xf)); \ 107 106 } while (0) 108 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */109 # define STRING_HASH_1(KEY, RESULT) do { \110 unsigned char const *_key_ = (unsigned char const *) (KEY); \111 unsigned int _ch_ = *_key_; \112 while (_ch_) \113 { \114 unsigned char _ch2_ = *++_key_; \115 (RESULT) += (_ch_ << (_ch2_ & 0xf)); \116 _ch_ = _ch2_; \117 } \118 } while (0)119 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */120 107 #define return_STRING_HASH_1(KEY) do { \ 121 108 unsigned long _result_ = 0; \ … … 124 111 } while (0) 125 112 126 #ifndef CONFIG_WITH_OPTIMIZATION_HACKS127 113 #define STRING_HASH_2(KEY, RESULT) do { \ 128 114 unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \ … … 130 116 (RESULT) += (*_key_ << (_key_[1] & 0x7)); \ 131 117 } while (0) 132 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */133 # define STRING_HASH_2(KEY, RESULT) do { \134 unsigned char const *_key_ = (unsigned char const *) (KEY); \135 unsigned int _ch_ = *_key_; \136 while (_ch_) \137 { \138 unsigned char _ch2_ = *++_key_; \139 (RESULT) += (_ch_ << (_ch2_ & 0x7)); \140 _ch_ = _ch2_; \141 } \142 } while (0)143 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */144 118 #define return_STRING_HASH_2(KEY) do { \ 145 119 unsigned long _result_ = 0; \ … … 155 129 } while (0) 156 130 157 #ifndef CONFIG_WITH_OPTIMIZATION_HACKS 131 158 132 #define STRING_N_HASH_1(KEY, N, RESULT) do { \ 159 133 unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \ … … 164 138 (RESULT) += *++_key_; \ 165 139 } while (0) 166 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */167 # define STRING_N_HASH_1(KEY, N, RESULT) do { \168 unsigned char const *_key_ = (unsigned char const *) (KEY); \169 unsigned int _ch_ = *_key_; \170 int _n_ = (N); \171 if (_n_) \172 { \173 for (;;) \174 { \175 unsigned char _ch2_; \176 if (!--_n_) \177 { \178 (RESULT) += _ch_; \179 break; \180 } \181 _ch2_ = *++_key_; \182 (RESULT) += (_ch_ << (_ch2_ & 0xf)); \183 _ch_ = _ch2_; \184 if (!_ch_) break; \185 } \186 } \187 else \188 (RESULT) += _ch_; \189 } while (0)190 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */191 140 #define return_STRING_N_HASH_1(KEY, N) do { \ 192 141 unsigned long _result_ = 0; \ … … 195 144 } while (0) 196 145 197 #ifndef CONFIG_WITH_OPTIMIZATION_HACKS198 146 #define STRING_N_HASH_2(KEY, N, RESULT) do { \ 199 147 unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \ … … 204 152 (RESULT) += *++_key_; \ 205 153 } while (0) 206 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */207 # define STRING_N_HASH_2(KEY, N, RESULT) do { \208 unsigned char const *_key_ = (unsigned char const *) (KEY); \209 unsigned int _ch_ = *_key_; \210 int _n_ = (N); \211 if (_n_) \212 { \213 for (;;) \214 { \215 unsigned char _ch2_; \216 if (!--_n_) \217 { \218 (RESULT) += _ch_; \219 break; \220 } \221 _ch2_ = *++_key_; \222 (RESULT) += (_ch_ << (_ch2_ & 0x7)); \223 _ch_ = _ch2_; \224 if (!_ch_) break; \225 } \226 } \227 else \228 (RESULT) += _ch_; \229 } while (0)230 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */231 154 #define return_STRING_N_HASH_2(KEY, N) do { \ 232 155 unsigned long _result_ = 0; \ … … 246 169 /* hash and comparison macros for case-insensitive string _key_s. */ 247 170 248 #if 1 /*ndef CONFIG_WITH_OPTIMIZATION_HACKS - testme */249 171 #define ISTRING_HASH_1(KEY, RESULT) do { \ 250 172 unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \ … … 252 174 (RESULT) += ((isupper (*_key_) ? tolower (*_key_) : *_key_) << (_key_[1] & 0xf)); \ 253 175 } while (0) 254 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */255 #define ISTRING_HASH_1(KEY, RESULT) do { \256 unsigned char const *_key_ = (unsigned char const *) (KEY); \257 unsigned int _ch_ = *_key_;258 while (_ch_) \259 { \260 unsigned _ch2_ = *++_key_; \261 (RESULT) += ((isupper (_ch_) ? tolower (_ch_) : _ch_) << (_ch2_ & 0xf)); \262 _ch_ = _ch2_; \263 } \264 } while (0)265 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */266 176 #define return_ISTRING_HASH_1(KEY) do { \ 267 177 unsigned long _result_ = 0; \ … … 270 180 } while (0) 271 181 272 #if 1 /* ndef CONFIG_WITH_OPTIMIZATION_HACKS - testme */273 182 #define ISTRING_HASH_2(KEY, RESULT) do { \ 274 183 unsigned char const *_key_ = (unsigned char const *) (KEY) - 1; \ … … 276 185 (RESULT) += ((isupper (*_key_) ? tolower (*_key_) : *_key_) << (_key_[1] & 0x7)); \ 277 186 } while (0) 278 #else /* CONFIG_WITH_OPTIMIZATION_HACKS */279 #define ISTRING_HASH_2(KEY, RESULT) do { \280 unsigned char const *_key_ = (unsigned char const *) (KEY); \281 unsigned int _ch_ = *_key_;282 while (_ch_) \283 { \284 unsigned _ch2_ = *++_key_; \285 (RESULT) += ((isupper (_ch_) ? tolower (_ch_) : _ch_) << (_ch2_ & 0x7)); \286 _ch_ = _ch2_; \287 } \288 } while (0)289 #endif /* CONFIG_WITH_OPTIMIZATION_HACKS */290 187 #define return_ISTRING_HASH_2(KEY) do { \ 291 188 unsigned long _result_ = 0; \ -
trunk/src/kmk/job.c
r1440 r1980 780 780 message (0, "The failing command:\n%s", c->file->cmds->command_lines[c->command_line - 1]); 781 781 } 782 #else 782 #else /* !KMK */ 783 783 child_error (c->file->name, exit_code, exit_sig, coredump, 0); 784 #endif 784 #endif /* !KMK */ 785 785 786 786 c->file->update_status = 2; … … 1059 1059 else if (*p == '%') 1060 1060 flags |= COMMAND_GETTER_SKIP_IT; 1061 #endif 1061 #endif 1062 1062 else if (!isblank ((unsigned char)*p)) 1063 1063 #ifndef CONFIG_WITH_KMK_BUILTIN … … 1235 1235 } 1236 1236 1237 # ifndef VMS1237 # ifndef VMS 1238 1238 free (argv[0]); 1239 1239 free ((char *) argv); 1240 # endif1240 # endif 1241 1241 1242 1242 /* synchronous command execution? */ … … 2820 2820 && !isspace ((unsigned char)p[1]) 2821 2821 # ifdef KMK 2822 && strchr (sh_chars, p[1]) == 0 2822 && strchr (sh_chars, p[1]) == 0 2823 2823 && (p[1] != '"' || !unixy_shell)) 2824 2824 # else 2825 2825 && strchr (sh_chars_sh, p[1]) == 0) 2826 # endif 2826 # endif 2827 2827 /* back up one notch, to copy the backslash */ 2828 2828 --p; -
trunk/src/kmk/main.c
r1968 r1980 679 679 alloccache_init (&variable_set_list_cache, sizeof (struct variable_set_list), "variable_set_list", NULL, NULL); 680 680 } 681 #endif 681 #endif /* CONFIG_WITH_ALLOC_CACHES */ 682 682 683 683 static void … … 787 787 db_level |= DB_KMK; 788 788 break; 789 #endif 789 #endif /* DB_KMK */ 790 790 default: 791 791 fatal (NILF, _("unknown debug level specification `%s'"), p); … … 809 809 set_make_priority_and_affinity (void) 810 810 { 811 # ifdef WINDOWS32811 # ifdef WINDOWS32 812 812 DWORD dwPriority; 813 813 if (process_affinity) … … 830 830 dwPriority, GetLastError ()); 831 831 832 # else /*#elif HAVE_NICE */832 # else /*#elif HAVE_NICE */ 833 833 int nice_level = 0; 834 834 switch (process_priority) … … 846 846 fprintf (stderr, "warning: nice (%d) failed: %s\n", 847 847 nice_level, strerror (errno)); 848 # endif848 # endif 849 849 } 850 #endif 850 #endif /* KMK */ 851 851 852 852 … … 1287 1287 #if defined(set_space_map_entry) /*bird*/ 1288 1288 char space_map[space_map_size]; 1289 #endif 1289 #endif /* set_space_map_entry */ 1290 1290 1291 1291 … … 1307 1307 char *windows32_path = NULL; 1308 1308 1309 #ifndef ELECTRIC_HEAP /* Drop this because it prevent JIT debugging. */1309 #ifndef ELECTRIC_HEAP /* Drop this because it prevents JIT debugging. */ 1310 1310 SetUnhandledExceptionFilter(handle_runtime_exceptions); 1311 1311 #endif /* !ELECTRIC_HEAP */ -
trunk/src/kmk/read.c
r1977 r1980 175 175 static char *find_char_unquote (char *string, int stop1, int stop2, 176 176 int blank, int ignorevars); 177 #else 177 #else /* CONFIG_WITH_VALUE_LENGTH */ 178 178 __inline static char *remove_comments (char *line, char *eol); 179 179 __inline static char *find_char_unquote_0 (char *string, int stop1, char **eosp); … … 181 181 int blank, int ignorevars, 182 182 unsigned int string_len); 183 __inline staticchar *183 MY_INLINE char * 184 184 find_char_unquote (char *string, int stop1, int stop2, int blank, int ignorevars) 185 185 { … … 195 195 return find_char_unquote_2 (string, stop1, stop2, blank, ignorevars, 0); 196 196 } 197 #endif 197 #endif /* CONFIG_WITH_VALUE_LENGTH */ 198 198 199 199
Note:
See TracChangeset
for help on using the changeset viewer.