tmp_alias_str += std::string (alias->name);
 
       if (cmd->cmd_deprecated)
-       printf_filtered (_("Warning: command '%s' (%s) is deprecated.\n"),
-                        tmp_cmd_str.c_str (), tmp_alias_str.c_str ());
+       printf_filtered (_("Warning: command '%ps' (%ps) is deprecated.\n"),
+                        styled_string (title_style.style (),
+                                       tmp_cmd_str.c_str ()),
+                        styled_string (title_style.style (),
+                                       tmp_alias_str.c_str ()));
       else
-       printf_filtered (_("Warning: '%s', an alias for the command '%s', "
+       printf_filtered (_("Warning: '%ps', an alias for the command '%ps', "
                           "is deprecated.\n"),
-                        tmp_alias_str.c_str (), tmp_cmd_str.c_str ());
+                        styled_string (title_style.style (),
+                                       tmp_alias_str.c_str ()),
+                        styled_string (title_style.style (),
+                                       tmp_cmd_str.c_str ()));
     }
   else
-    printf_filtered (_("Warning: command '%s' is deprecated.\n"),
-                    tmp_cmd_str.c_str ());
+    printf_filtered (_("Warning: command '%ps' is deprecated.\n"),
+                    styled_string (title_style.style (),
+                                   tmp_cmd_str.c_str ()));
 
   /* Now display a second line indicating what the user should use instead.
      If it is only the alias that is deprecated, we want to indicate the
   else
     replacement = cmd->replacement;
   if (replacement != nullptr)
-    printf_filtered (_("Use '%s'.\n\n"), replacement);
+    printf_filtered (_("Use '%ps'.\n\n"),
+                    styled_string (title_style.style (),
+                                   replacement));
   else
     printf_filtered (_("No alternative known.\n\n"));
 
 
        "warning: [style .*? file] is not a directory\\..*"
     gdb_test "show data-directory" \
        "GDB's data directory is \"[style .*? file]\"\\..*"
+
+    # Check that deprecation styles command names.
+    gdb_test_no_output "maintenance deprecate p \"new_p\"" \
+       "maintenance deprecate p \"new_p\" /1/"
+    gdb_test "p 5" \
+       "Warning: '[style p title]', an alias for the command '[style print title]', is deprecated.*Use '[style new_p title]'.*" \
+       "p deprecated warning, with replacement"
 }