Make remote.c ptid constants "const"
authorTom Tromey <tromey@adacore.com>
Tue, 12 Mar 2019 17:03:03 +0000 (11:03 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 12 Mar 2019 17:07:43 +0000 (11:07 -0600)
This changes magic_null_ptid, not_sent_ptid, and any_thread_ptid to be
"const".  This is a minor improvement that makes it so these can't be
accidentally modified.

Tested by rebuilding.  I'm checking this in.

gdb/ChangeLog
2019-03-12  Tom Tromey  <tromey@adacore.com>

* remote.c (magic_null_ptid, not_sent_ptid, any_thread_ptid): Now
const.  Add initializers.
(_initialize_remote): Don't initialize ptid globals.

gdb/ChangeLog
gdb/remote.c

index 2ca2493c0e116e50f77ef7c2f44bca2272496109..8d72d38cea4bf7c2dbd3a49549e786bbb85da6a4 100644 (file)
@@ -1,3 +1,9 @@
+2019-03-12  Tom Tromey  <tromey@adacore.com>
+
+       * remote.c (magic_null_ptid, not_sent_ptid, any_thread_ptid): Now
+       const.  Add initializers.
+       (_initialize_remote): Don't initialize ptid globals.
+
 2019-03-12  Pedro Alves  <palves@redhat.com>
 
        * yy-remap.h [TEST_CPNAMES] (YYFPRINTF): Don't define.
index ef12fe9a3b42b0d7ddfa3ffe521198ca59b38a3f..d113f99e48cb0a7940149af09991f1a540ad8bf1 100644 (file)
@@ -2297,9 +2297,11 @@ remote_target::remove_exec_catchpoint (int pid)
 
 \f
 
-static ptid_t magic_null_ptid;
-static ptid_t not_sent_ptid;
-static ptid_t any_thread_ptid;
+/* Take advantage of the fact that the TID field is not used, to tag
+   special ptids with it set to != 0.  */
+static const ptid_t magic_null_ptid (42000, -1, 1);
+static const ptid_t not_sent_ptid (42000, -2, 1);
+static const ptid_t any_thread_ptid (42000, 0, 1);
 
 /* Find out if the stub attached to PID (and hence GDB should offer to
    detach instead of killing it when bailing out).  */
@@ -14754,10 +14756,4 @@ stepping is supported by the target.  The default is on."),
 
   /* Eventually initialize fileio.  See fileio.c */
   initialize_remote_fileio (remote_set_cmdlist, remote_show_cmdlist);
-
-  /* Take advantage of the fact that the TID field is not used, to tag
-     special ptids with it set to != 0.  */
-  magic_null_ptid = ptid_t (42000, -1, 1);
-  not_sent_ptid = ptid_t (42000, -2, 1);
-  any_thread_ptid = ptid_t (42000, 0, 1);
 }
This page took 0.031199 seconds and 4 git commands to generate.