OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / read-md.c
index 90707b3..4f1933f 100644 (file)
@@ -847,6 +847,14 @@ handle_enum (int lineno, bool md_p)
     }
 }
 
+/* Try to find the definition of the given enum.  Return null on failure.  */
+
+struct enum_type *
+lookup_enum_type (const char *name)
+{
+  return (struct enum_type *) htab_find (enum_types, &name);
+}
+
 /* For every enum definition, call CALLBACK with two arguments:
    a pointer to the constant definition and INFO.  Stop when CALLBACK
    returns zero.  */
@@ -977,14 +985,14 @@ handle_file (directive_handler_t handle_directive)
 static void
 handle_toplevel_file (directive_handler_t handle_directive)
 {
-  char *lastsl;
+  const char *base;
 
   in_fname = read_md_filename;
-  lastsl = strrchr (in_fname, '/');
-  if (lastsl != NULL)
-    base_dir = xstrndup (in_fname, lastsl - in_fname + 1);
-  else
+  base = lbasename (in_fname);
+  if (base == in_fname)
     base_dir = NULL;
+  else
+    base_dir = xstrndup (in_fname, base - in_fname);
 
   handle_file (handle_directive);
 }