convert flags to bitfields
[deliverable/binutils-gdb.git] / gdb / cli / cli-decode.c
index 853ec88a47e3ad89d058172259ea446115e097a3..d36ab4e455b8883059c99c5b436495ccb5984ede 100644 (file)
@@ -226,7 +226,10 @@ add_cmd (const char *name, enum command_class class, void (*fun) (char *, int),
   set_cmd_cfunc (c, fun);
   set_cmd_context (c, NULL);
   c->doc = doc;
-  c->flags = 0;
+  c->cmd_deprecated = 0;
+  c->deprecated_warn_user = 0;
+  c->malloced_replacement = 0;
+  c->doc_allocated = 0;
   c->replacement = NULL;
   c->pre_show_hook = NULL;
   c->hook_in = 0;
@@ -261,7 +264,8 @@ add_cmd (const char *name, enum command_class class, void (*fun) (char *, int),
 struct cmd_list_element *
 deprecate_cmd (struct cmd_list_element *cmd, char *replacement)
 {
-  cmd->flags |= (CMD_DEPRECATED | DEPRECATED_WARN_USER);
+  cmd->cmd_deprecated = 1;
+  cmd->deprecated_warn_user = 1;
 
   if (replacement != NULL)
     cmd->replacement = replacement;
@@ -298,10 +302,10 @@ add_alias_cmd (const char *name, const char *oldname, enum command_class class,
   c = add_cmd (name, class, NULL, old->doc, list);
 
   /* If OLD->DOC can be freed, we should make another copy.  */
-  if ((old->flags & DOC_ALLOCATED) != 0)
+  if (old->doc_allocated)
     {
       c->doc = xstrdup (old->doc);
-      c->flags |= DOC_ALLOCATED;
+      c->doc_allocated = 1;
     }
   /* NOTE: Both FUNC and all the FUNCTIONs need to be copied.  */
   c->func = old->func;
@@ -448,7 +452,7 @@ add_setshow_cmd_full (const char *name,
     }
   set = add_set_or_show_cmd (name, set_cmd, class, var_type, var,
                             full_set_doc, set_list);
-  set->flags |= DOC_ALLOCATED;
+  set->doc_allocated = 1;
 
   if (set_func != NULL)
     set_cmd_sfunc (set, set_func);
@@ -457,7 +461,7 @@ add_setshow_cmd_full (const char *name,
 
   show = add_set_or_show_cmd (name, show_cmd, class, var_type, var,
                              full_show_doc, show_list);
-  show->flags |= DOC_ALLOCATED;
+  show->doc_allocated = 1;
   show->show_value_func = show_func;
 
   if (set_result != NULL)
@@ -800,7 +804,7 @@ delete_cmd (const char *name, struct cmd_list_element **list,
          *prehookee = iter->hookee_pre;
          if (iter->hookee_post)
            iter->hookee_post->hook_post = 0;
-         if (iter->doc && (iter->flags & DOC_ALLOCATED) != 0)
+         if (iter->doc && iter->doc_allocated)
            xfree (iter->doc);
          *posthook = iter->hook_post;
          *posthookee = iter->hookee_post;
@@ -1395,7 +1399,7 @@ lookup_cmd_1 (const char **text, struct cmd_list_element *clist,
        itself and we will adjust the appropriate DEPRECATED_WARN_USER
        flags.  */
       
-      if (found->flags & DEPRECATED_WARN_USER)
+      if (found->deprecated_warn_user)
        deprecated_cmd_warning (line);
       found = found->cmd_pointer;
     }
@@ -1600,14 +1604,14 @@ deprecated_cmd_warning (const char *text)
     /* Return if text doesn't evaluate to a command.  */
     return;
 
-  if (!((alias ? (alias->flags & DEPRECATED_WARN_USER) : 0)
-      || (cmd->flags & DEPRECATED_WARN_USER) ) ) 
+  if (!((alias ? alias->deprecated_warn_user : 0)
+      || cmd->deprecated_warn_user) ) 
     /* Return if nothing is deprecated.  */
     return;
   
   printf_filtered ("Warning:");
   
-  if (alias && !(cmd->flags & CMD_DEPRECATED))
+  if (alias && !cmd->cmd_deprecated)
     printf_filtered (" '%s', an alias for the", alias->name);
     
   printf_filtered (" command '");
@@ -1617,7 +1621,7 @@ deprecated_cmd_warning (const char *text)
   
   printf_filtered ("%s", cmd->name);
 
-  if (alias && (cmd->flags & CMD_DEPRECATED))
+  if (alias && cmd->cmd_deprecated)
     printf_filtered ("' (%s) is deprecated.\n", alias->name);
   else
     printf_filtered ("' is deprecated.\n"); 
@@ -1626,7 +1630,7 @@ deprecated_cmd_warning (const char *text)
   /* If it is only the alias that is deprecated, we want to indicate
      the new alias, otherwise we'll indicate the new command.  */
 
-  if (alias && !(cmd->flags & CMD_DEPRECATED))
+  if (alias && !cmd->cmd_deprecated)
     {
       if (alias->replacement)
        printf_filtered ("Use '%s'.\n\n", alias->replacement);
@@ -1643,9 +1647,9 @@ deprecated_cmd_warning (const char *text)
 
   /* We've warned you, now we'll keep quiet.  */
   if (alias)
-    alias->flags &= ~DEPRECATED_WARN_USER;
+    alias->deprecated_warn_user = 0;
   
-  cmd->flags &= ~DEPRECATED_WARN_USER;
+  cmd->deprecated_warn_user = 0;
 }
 
 
@@ -1787,7 +1791,7 @@ complete_on_cmdlist (struct cmd_list_element *list,
 
            if (pass == 0)
              {
-               if ((ptr->flags & CMD_DEPRECATED) != 0)
+               if (ptr->cmd_deprecated)
                  {
                    saw_deprecated_match = 1;
                    continue;
This page took 0.024905 seconds and 4 git commands to generate.