* A few cleanups, and 3.77.94 release. 3.77.94
authorPaul Smith <psmith@gnu.org>
Wed, 25 Aug 1999 21:39:28 +0000 (21:39 +0000)
committerPaul Smith <psmith@gnu.org>
Wed, 25 Aug 1999 21:39:28 +0000 (21:39 +0000)
ChangeLog
function.c
main.c
make.h
variable.c

index bac8e47..c273f09 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+1999-08-25  Paul D. Smith  <psmith@gnu.org>
+
+       * Version 3.77.94 released.
+
+       * main.c (main) [__MSDOS__]: If the user uses -j, warn that it's
+       not supported and reset it.
+
+       * make.h (ISDIGIT): Obtained this from the textutils distribution.
+       * main.c (decode_switches): Use it.
+       * function.c (is_numeric): Use it.
+
+       * main.c (struct command_switch): Store the switch char in an
+       unsigned char to shut up GCC about using it with ctype.h macros.
+       Besides, it _is_ always unsigned.
+
 1999-08-24  Paul D. Smith  <psmith@gnu.org>
 
        * make.texinfo: Change "dependency" to "prerequisite" and
@@ -13,8 +28,8 @@
 
        * remake.c (update_file): Move the considered check into the
        double-colon rule loop, so we consider double-colon rules
-       individually (otherwise after the first is pruned, the rest might
-       not get run).
+       individually (otherwise after the first is pruned, the rest won't
+       get run).
 
        * README.template: Minor changes.
 
index 0e619fd..0acfd7e 100644 (file)
@@ -702,13 +702,10 @@ is_numeric (p)
   char *end = p + strlen (p) - 1;
   char *beg = p;
   strip_whitespace (&p, &end);
-  while (p <= end)
-    {
-      if (!isdigit (*p))
-       return 0;
 
-      p++;
-    }
+  while (p <= end)
+    if (!ISDIGIT (*(p++)))  /* ISDIGIT only evals its arg once: see make.h.  */
+      return 0;
 
   return (end - beg >= 0);
 }
diff --git a/main.c b/main.c
index de82b59..0035a1d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -79,7 +79,7 @@ static char *quote_as_word PARAMS ((char *out, char *in, int double_dollars));
 
 struct command_switch
   {
-    char c;                    /* The switch character.  */
+    unsigned char c;           /* The switch character.  */
 
     enum                       /* Type of the value.  */
       {
@@ -1270,7 +1270,7 @@ int main (int argc, char ** argv)
   /* We need to know what kind of shell we will be using.  */
   {
     extern int _is_unixy_shell (const char *_path);
-    struct variable *shv = lookup_variable("SHELL", 5);
+    struct variable *shv = lookup_variable ("SHELL", 5);
     extern int unixy_shell;
     extern char *default_shell;
 
@@ -1294,6 +1294,15 @@ int main (int argc, char ** argv)
   decode_env_switches ("MFLAGS", 6);
 #endif
 
+#ifdef __MSDOS__
+  if (job_slots != 1)
+    {
+      error (NILF, _("Parallel jobs (-j) are not supported on MS-DOS."));
+      error (NILF, _("Resetting to single job mode."));
+      job_slots = 1;
+    }
+#endif
+
 #ifdef MAKE_JOBSERVER
   /* If the jobserver-fds option is seen, make sure that -j is reasonable.  */
 
@@ -1851,8 +1860,7 @@ handle_non_switch_argument (arg, env)
        }
       else
        {
-         lastgoal->next
-           = (struct dep *) xmalloc (sizeof (struct dep));
+         lastgoal->next = (struct dep *) xmalloc (sizeof (struct dep));
          lastgoal = lastgoal->next;
        }
       lastgoal->name = 0;
@@ -2075,7 +2083,7 @@ decode_switches (argc, argv, env)
 
                case positive_int:
                  if (optarg == 0 && argc > optind
-                     && isdigit (argv[optind][0]))
+                     && ISDIGIT (argv[optind][0]))
                    optarg = argv[optind++];
 
                  if (!doit)
@@ -2087,8 +2095,7 @@ decode_switches (argc, argv, env)
                      if (i < 1)
                        {
                          if (doit)
-                           error (NILF, _("the `-%c' option requires a \
-positive integral argument"),
+                           error (NILF, _("the `-%c' option requires a positive integral argument"),
                                   cs->c);
                          bad = 1;
                        }
@@ -2103,7 +2110,7 @@ positive integral argument"),
 #ifndef NO_FLOAT
                case floating:
                  if (optarg == 0 && optind < argc
-                     && (isdigit (argv[optind][0]) || argv[optind][0] == '.'))
+                     && (ISDIGIT (argv[optind][0]) || argv[optind][0] == '.'))
                    optarg = argv[optind++];
 
                  if (doit)
diff --git a/make.h b/make.h
index b25318b..a50334f 100644 (file)
--- a/make.h
+++ b/make.h
@@ -299,6 +299,17 @@ extern char *alloca ();
 # endif /* HAVE_ALLOCA_H.  */
 #endif /* GCC.  */
 
+/* ISDIGIT offers the following features:
+   - Its arg may be any int or unsigned int; it need not be an unsigned char.
+   - It's guaranteed to evaluate its argument exactly once.
+      NOTE!  Make relies on this behavior, don't change it!
+   - It's typically faster.
+   Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
+   only '0' through '9' are digits.  Prefer ISDIGIT to isdigit() unless
+   it's important to use the locale's definition of `digit' even when the
+   host does not conform to Posix.  */
+#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
+
 #ifndef iAPX286
 # define streq(a, b) \
    ((a) == (b) || \
index 97207f1..377daf5 100644 (file)
@@ -954,7 +954,7 @@ print_variable (v, prefix)
      register struct variable *v;
      char *prefix;
 {
-  char *origin;
+  const char *origin;
 
   switch (v->origin)
     {
@@ -982,7 +982,6 @@ print_variable (v, prefix)
     case o_invalid:
     default:
       abort ();
-      break;
     }
   printf ("# %s\n", origin);