]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: change return type of check_quit_flag to bool
authorSimon Marchi <simon.marchi@polymtl.ca>
Tue, 23 Apr 2024 13:22:57 +0000 (09:22 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Tue, 23 Apr 2024 15:26:14 +0000 (11:26 -0400)
Change the return type of the check_quit_flag function to bool.  Update
a few related spots.

Change-Id: I9d3a15d3f8651efb02c7d211f06222a592bd4184
Approved-By: Tom Tromey <tom@tromey.com>
gdb/extension-priv.h
gdb/extension.c
gdb/extension.h
gdb/python/python.c
gdb/remote-fileio.c

index cb00cb6ff7b9abe6e6403c47bd9754e42d1a2523..1365988b40ddb850b7e9dcd684fc4ae7f19416c3 100644 (file)
@@ -229,9 +229,9 @@ struct extension_language_ops
      This is called by GDB's SIGINT handler and must be async-safe.  */
   void (*set_quit_flag) (const struct extension_language_defn *);
 
-  /* Return non-zero if a SIGINT has occurred.
+  /* Return true if a SIGINT has occurred.
      This is expected to also clear the indicator.  */
-  int (*check_quit_flag) (const struct extension_language_defn *);
+  bool (*check_quit_flag) (const struct extension_language_defn *);
 
   /* Called before gdb prints its prompt, giving extension languages an
      opportunity to change it with set_prompt.
index 2d692d054315fa9be0e4b5528a3935203d6cd597..82d37fb09aea92eef4c29ed8b6adea1ac8dcdd64 100644 (file)
@@ -890,21 +890,21 @@ set_quit_flag ()
 
 /* See extension.h.  */
 
-int
+bool
 check_quit_flag ()
 {
 #if CXX_STD_THREAD
   std::lock_guard guard (ext_lang_mutex);
 #endif /* CXX_STD_THREAD */
 
-  int result = 0;
+  bool result = false;
 
   for (const struct extension_language_defn *extlang : extension_languages)
     {
       if (extlang->ops != nullptr
          && extlang->ops->check_quit_flag != NULL)
-       if (extlang->ops->check_quit_flag (extlang) != 0)
-         result = 1;
+       if (extlang->ops->check_quit_flag (extlang))
+         result = true;
     }
 
   /* This is written in a particular way to avoid races.  */
@@ -915,7 +915,7 @@ check_quit_flag ()
         request.  */
       quit_serial_event_clear ();
       quit_flag = 0;
-      result = 1;
+      result = true;
     }
 
   return result;
index 94a500d745860735ecb0ce05a3234020cc43a555..258a77dbfccb9a421626c27cff828faab78afdce 100644 (file)
@@ -447,7 +447,7 @@ private:
    The flag is checked in all extension languages that support cooperative
    SIGINT handling, not just the current one.  This simplifies transitions.  */
 
-extern int check_quit_flag ();
+extern bool check_quit_flag ();
 
 /* Set the quit flag.
    This only sets the flag in the currently active extension language.
index d6e5883476e1ddb7e0822921b25eb502ffde2292..a6875af63db74625cc8c47b0757a4b1973c42dce 100644 (file)
@@ -121,7 +121,7 @@ static enum ext_lang_rc gdbpy_apply_type_printers
 static void gdbpy_free_type_printers (const struct extension_language_defn *,
                                      struct ext_lang_type_printers *);
 static void gdbpy_set_quit_flag (const struct extension_language_defn *);
-static int gdbpy_check_quit_flag (const struct extension_language_defn *);
+static bool gdbpy_check_quit_flag (const struct extension_language_defn *);
 static enum ext_lang_rc gdbpy_before_prompt_hook
   (const struct extension_language_defn *, const char *current_gdb_prompt);
 static std::optional<std::string> gdbpy_colorize
@@ -275,11 +275,11 @@ gdbpy_set_quit_flag (const struct extension_language_defn *extlang)
 
 /* Return true if the quit flag has been set, false otherwise.  */
 
-static int
+static bool
 gdbpy_check_quit_flag (const struct extension_language_defn *extlang)
 {
   if (!gdb_python_initialized)
-    return 0;
+    return false;
 
   gdbpy_gil gil;
   return PyOS_InterruptOccurred ();
index 9615dedaebd5f6b66c6157bb29f172f6366405cb..934ba3f8281d5b48c66a6ea98dc7a5cb364b5ee2 100644 (file)
@@ -316,7 +316,7 @@ static void
 remote_fileio_reply (remote_target *remote, int retcode, int error)
 {
   char buf[32];
-  int ctrl_c = check_quit_flag ();
+  bool ctrl_c = check_quit_flag ();
 
   strcpy (buf, "F");
   if (retcode < 0)