- Timestamp:
- Sep 8, 2004 3:15:50 AM (20 years ago)
- Location:
- trunk/src/gmake
- Files:
-
- 18 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmake/function.c
r57 r160 402 402 403 403 static char * 404 func_patsubst (char *o, char **argv, const char *funcname )404 func_patsubst (char *o, char **argv, const char *funcname UNUSED) 405 405 { 406 406 o = patsubst_expand (o, argv[2], argv[0], argv[1], (char *) 0, (char *) 0); … … 410 410 411 411 static char * 412 func_join (char *o, char **argv, const char *funcname )412 func_join (char *o, char **argv, const char *funcname UNUSED) 413 413 { 414 414 int doneany = 0; … … 450 450 451 451 static char * 452 func_origin (char *o, char **argv, const char *funcname )452 func_origin (char *o, char **argv, const char *funcname UNUSED) 453 453 { 454 454 /* Expand the argument. */ … … 645 645 646 646 static char * 647 func_subst (char *o, char **argv, const char *funcname )647 func_subst (char *o, char **argv, const char *funcname UNUSED) 648 648 { 649 649 o = subst_expand (o, argv[2], argv[0], argv[1], strlen (argv[0]), … … 655 655 656 656 static char * 657 func_firstword (char *o, char **argv, const char *funcname )657 func_firstword (char *o, char **argv, const char *funcname UNUSED) 658 658 { 659 659 unsigned int i; … … 669 669 670 670 static char * 671 func_words (char *o, char **argv, const char *funcname )671 func_words (char *o, char **argv, const char *funcname UNUSED) 672 672 { 673 673 int i = 0; … … 718 718 719 719 static char * 720 func_word (char *o, char **argv, const char *funcname )720 func_word (char *o, char **argv, const char *funcname UNUSED) 721 721 { 722 722 char *end_p=0; … … 744 744 745 745 static char * 746 func_wordlist (char *o, char **argv, const char *funcname )746 func_wordlist (char *o, char **argv, const char *funcname UNUSED) 747 747 { 748 748 int start, count; … … 781 781 782 782 static char* 783 func_findstring (char *o, char **argv, const char *funcname )783 func_findstring (char *o, char **argv, const char *funcname UNUSED) 784 784 { 785 785 /* Find the first occurrence of the first string in the second. */ … … 792 792 793 793 static char * 794 func_foreach (char *o, char **argv, const char *funcname )794 func_foreach (char *o, char **argv, const char *funcname UNUSED) 795 795 { 796 796 /* expand only the first two. */ … … 1012 1012 1013 1013 static char * 1014 func_strip (char *o, char **argv, const char *funcname )1014 func_strip (char *o, char **argv, const char *funcname UNUSED) 1015 1015 { 1016 1016 char *p = argv[0]; … … 1081 1081 */ 1082 1082 static char * 1083 func_sort (char *o, char **argv, const char *funcname )1083 func_sort (char *o, char **argv, const char *funcname UNUSED) 1084 1084 { 1085 1085 char **words = 0; … … 1143 1143 1144 1144 static char * 1145 func_if (char *o, char **argv, const char *funcname )1145 func_if (char *o, char **argv, const char *funcname UNUSED) 1146 1146 { 1147 1147 const char *begp = argv[0]; … … 1184 1184 1185 1185 static char * 1186 func_wildcard (char *o, char **argv, const char *funcname )1186 func_wildcard (char *o, char **argv, const char *funcname UNUSED) 1187 1187 { 1188 1188 … … 1205 1205 1206 1206 static char * 1207 func_eval (char *o, char **argv, const char *funcname )1207 func_eval (char *o, char **argv, const char *funcname UNUSED) 1208 1208 { 1209 1209 char *buf; … … 1224 1224 1225 1225 static char * 1226 func_value (char *o, char **argv, const char *funcname )1226 func_value (char *o, char **argv, const char *funcname UNUSED) 1227 1227 { 1228 1228 /* Look up the variable. */ … … 1424 1424 #ifndef _AMIGA 1425 1425 static char * 1426 func_shell (char *o, char **argv, const char *funcname )1426 func_shell (char *o, char **argv, const char *funcname UNUSED) 1427 1427 { 1428 1428 char* batch_filename = NULL; 1429 int i;1429 unsigned int i; 1430 1430 1431 1431 #ifdef __MSDOS__ … … 1921 1921 1922 1922 static char * 1923 func_call (char *o, char **argv, const char *funcname )1923 func_call (char *o, char **argv, const char *funcname UNUSED) 1924 1924 { 1925 1925 static int max_args = 0; -
trunk/src/gmake/job.c
r58 r160 230 230 231 231 int unixy_shell = 1; 232 233 /* Number of jobs started in the current second. */ 234 235 unsigned long job_counter = 0; 232 236 233 237 … … 370 374 371 375 372 /* 373 found apostrophe at (p-1) 374 375 inc p until after closing apostrophe. */ 376 /* found apostrophe at (p-1) 377 inc p until after closing apostrophe. 378 */ 376 379 377 380 static char * 378 handle_apos (char *p)381 vms_handle_apos (char *p) 379 382 { 380 383 int alast; 381 int inside;382 384 383 385 #define SEPCHARS ",/()= " 384 386 385 inside= 0;387 alast = 0; 386 388 387 389 while (*p != 0) … … 389 391 if (*p == '"') 390 392 { 391 if (inside) 392 { 393 while ((alast > 0) 394 && (*p == '"')) 395 { 396 p++; 397 alast--; 398 } 399 if (alast == 0) 400 inside = 0; 401 else 402 { 403 fprintf (stderr, _("Syntax error, still inside '\"'\n")); 404 exit (3); 405 } 393 if (alast) 394 { 395 alast = 0; 396 p++; 406 397 } 407 398 else … … 410 401 if (strchr (SEPCHARS, *p)) 411 402 break; 412 inside = 1;413 403 alast = 1; 414 while (*p == '"')415 {416 alast++;417 p++;418 }419 404 } 420 405 } … … 442 427 443 428 RETSIGTYPE 444 child_handler (int sig )429 child_handler (int sig UNUSED) 445 430 { 446 431 ++dead_children; … … 453 438 454 439 #ifdef __EMX__ 455 signal(SIGCHLD, SIG_DFL); /* The signal handler must called only once! ????*/ 456 #endif 457 440 /* The signal handler must called only once! */ 441 signal (SIGCHLD, SIG_DFL); 442 #endif 443 444 /* This causes problems if the SIGCHLD interrupts a printf(). 458 445 DB (DB_JOBS, (_("Got a SIGCHLD; %u unreaped children.\n"), dead_children)); 446 */ 459 447 } 460 448 … … 605 593 coredump = WCOREDUMP (status); 606 594 607 #if 0 /*def __EMX__*/ 608 /* the SIGCHLD handler must not be used on OS/2 because, unlike 609 on UNIX systems, it had to call wait() itself. Therefore 610 job_rfd has to be closed here. */ 611 if (job_rfd >= 0) 612 { 613 close (job_rfd); 614 job_rfd = -1; 615 } 616 #endif 617 595 /* If we have started jobs in this second, remove one. */ 596 if (job_counter) 597 --job_counter; 618 598 } 619 599 else … … 1378 1358 #endif /* __MSDOS__ or Amiga or WINDOWS32 */ 1379 1359 1360 /* Bump the number of jobs started in this second. */ 1361 ++job_counter; 1362 1380 1363 /* We are the parent side. Set the state to 1381 1364 say the commands are running and return. */ … … 1667 1650 saved_errno = errno; 1668 1651 #ifdef __EMX__ 1669 signal(SIGCHLD, SIG_DFL); /* The child handler must be turned off here. */ 1652 /* The child handler must be turned off here. */ 1653 signal (SIGCHLD, SIG_DFL); 1670 1654 #endif 1671 1655 set_child_handler_action_flags (SA_RESTART); … … 1725 1709 } 1726 1710 1711 /* Determine if the load average on the system is too high to start a new job. 1712 The real system load average is only recomputed once a second. However, a 1713 very parallel make can easily start tens or even hundreds of jobs in a 1714 second, which brings the system to its knees for a while until that first 1715 batch of jobs clears out. 1716 1717 To avoid this we use a weighted algorithm to try to account for jobs which 1718 have been started since the last second, and guess what the load average 1719 would be now if it were computed. 1720 1721 This algorithm was provided by Thomas Riedl <[email protected]>, 1722 who writes: 1723 1724 ! calculate something load-oid and add to the observed sys.load, 1725 ! so that latter can catch up: 1726 ! - every job started increases jobctr; 1727 ! - every dying job decreases a positive jobctr; 1728 ! - the jobctr value gets zeroed every change of seconds, 1729 ! after its value*weight_b is stored into the 'backlog' value last_sec 1730 ! - weight_a times the sum of jobctr and last_sec gets 1731 ! added to the observed sys.load. 1732 ! 1733 ! The two weights have been tried out on 24 and 48 proc. Sun Solaris-9 1734 ! machines, using a several-thousand-jobs-mix of cpp, cc, cxx and smallish 1735 ! sub-shelled commands (rm, echo, sed...) for tests. 1736 ! lowering the 'direct influence' factor weight_a (e.g. to 0.1) 1737 ! resulted in significant excession of the load limit, raising it 1738 ! (e.g. to 0.5) took bad to small, fast-executing jobs and didn't 1739 ! reach the limit in most test cases. 1740 ! 1741 ! lowering the 'history influence' weight_b (e.g. to 0.1) resulted in 1742 ! exceeding the limit for longer-running stuff (compile jobs in 1743 ! the .5 to 1.5 sec. range),raising it (e.g. to 0.5) overrepresented 1744 ! small jobs' effects. 1745 1746 */ 1747 1748 #define LOAD_WEIGHT_A 0.25 1749 #define LOAD_WEIGHT_B 0.25 1750 1727 1751 static int 1728 1752 load_too_high (void) … … 1731 1755 return 1; 1732 1756 #else 1733 double load; 1757 static double last_sec; 1758 static time_t last_now; 1759 double load, guess; 1760 time_t now; 1734 1761 1735 1762 if (max_load_average < 0) 1736 1763 return 0; 1737 1764 1765 /* Find the real system load average. */ 1738 1766 make_access (); 1739 1767 if (getloadavg (&load, 1) != 1) … … 1755 1783 user_access (); 1756 1784 1757 DB (DB_JOBS, ("Current system load = %f (max requested = %f)\n", 1758 load, max_load_average)); 1759 return load >= max_load_average; 1785 /* If we're in a new second zero the counter and correct the backlog 1786 value. Only keep the backlog for one extra second; after that it's 0. */ 1787 now = time (NULL); 1788 if (last_now < now) 1789 { 1790 if (last_now == now - 1) 1791 last_sec = LOAD_WEIGHT_B * job_counter; 1792 else 1793 last_sec = 0.0; 1794 1795 job_counter = 0; 1796 last_now = now; 1797 } 1798 1799 /* Try to guess what the load would be right now. */ 1800 guess = load + (LOAD_WEIGHT_A * (job_counter + last_sec)); 1801 1802 DB (DB_JOBS, ("Estimated system load = %f (actual = %f) (max requested = %f)\n", 1803 guess, load, max_load_average)); 1804 1805 return guess >= max_load_average; 1760 1806 #endif 1761 1807 } … … 2193 2239 comma or space and before slash. */ 2194 2240 case '"': 2195 q = handle_apos (q + 1);2241 q = vms_handle_apos (q); 2196 2242 sep = q; 2197 2243 break; … … 2868 2914 char** sh_cmds; 2869 2915 #else /* must be UNIX-ish */ 2870 static char sh_chars[] = "#;\"*?[]&|<>(){}$`^~ ";2871 static char *sh_cmds[] = { " cd", "eval", "exec", "exit", "login",2872 "logout", "set", "umask", "wait", "while", "for",2873 "case", "if", ":", ".", "break", "continue",2874 "export", "read", "readonly", "shift", "times",2875 "trap", "switch", 0 };2876 #endif /* __MSDOS__ */2916 static char sh_chars[] = "#;\"*?[]&|<>(){}$`^~!"; 2917 static char *sh_cmds[] = { ".", ":", "break", "case", "cd", "continue", 2918 "eval", "exec", "exit", "export", "for", "if", 2919 "login", "logout", "read", "readonly", "set", 2920 "shift", "switch", "test", "times", "trap", 2921 "umask", "wait", "while", 0 }; 2922 #endif 2877 2923 register int i; 2878 2924 register char *p; -
trunk/src/gmake/main.c
r57 r160 392 392 { CHAR_MAX+4, flag, (char *) &warn_undefined_variables_flag, 1, 1, 0, 0, 0, 393 393 "warn-undefined-variables" }, 394 { '\0',}394 { 0 } 395 395 }; 396 396 … … 550 550 551 551 static RETSIGTYPE 552 debug_signal_handler (int sig )552 debug_signal_handler (int sig UNUSED) 553 553 { 554 554 db_level = db_level ? DB_NONE : DB_BASIC; … … 839 839 { 840 840 static char *stdin_nm = 0; 841 registerstruct file *f;842 register unsignedint i;841 struct file *f; 842 int i; 843 843 char **p; 844 844 struct dep *read_makefiles; … … 1163 1163 if (current_directory[0] != '\0' 1164 1164 && argv[0] != 0 1165 && (argv[0][0] != '/' && (argv[0][0] == '\0' || argv[0][1] != ':'))) 1165 && (argv[0][0] != '/' && (argv[0][0] == '\0' || argv[0][1] != ':')) 1166 #ifdef __EMX__ 1167 /* do not prepend cwd if argv[0] contains no '/', e.g. "make" */ 1168 && (strchr (argv[0], '/') != 0 || strchr (argv[0], '\\') != 0) 1169 # endif 1170 ) 1166 1171 argv[0] = concat (current_directory, "/", argv[0]); 1167 1172 #else /* !__MSDOS__ */ … … 1510 1515 { 1511 1516 char *cp; 1512 1513 for (i=1; i < jobserver_fds->idx; ++i) 1514 if (!streq (jobserver_fds->list[0], jobserver_fds->list[i])) 1517 unsigned int ui; 1518 1519 for (ui=1; ui < jobserver_fds->idx; ++ui) 1520 if (!streq (jobserver_fds->list[0], jobserver_fds->list[ui])) 1515 1521 fatal (NILF, _("internal error: multiple --jobserver-fds options")); 1516 1522 … … 1743 1749 in updating or could not be found at all. */ 1744 1750 int any_failed = 0; 1745 registerunsigned int i;1751 unsigned int i; 1746 1752 struct dep *d; 1747 1753 … … 1817 1823 { 1818 1824 /* These names might have changed. */ 1819 register unsignedint i, j = 0;1825 int i, j = 0; 1820 1826 for (i = 1; i < argc; ++i) 1821 1827 if (strneq (argv[i], "-f", 2)) /* XXX */ … … 2022 2028 init_switches (void) 2023 2029 { 2024 registerchar *p;2025 registerint c;2026 registerunsigned int i;2030 char *p; 2031 unsigned int c; 2032 unsigned int i; 2027 2033 2028 2034 if (options[0] != '\0') … … 2236 2242 if (optarg == 0) 2237 2243 optarg = cs->noarg_value; 2244 else if (*optarg == '\0') 2245 { 2246 error (NILF, _("the `-%c' option requires a non-empty string argument"), 2247 cs->c); 2248 bad = 1; 2249 } 2238 2250 2239 2251 sl = *(struct stringlist **) cs->value_ptr;
Note:
See TracChangeset
for help on using the changeset viewer.