aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-12-21 09:16:48 -0800
committerNathan Sidwell <nathan@acm.org>2020-12-21 09:20:15 -0800
commit1467a5c5ab0dfbae3175b4a326467f939864dadb (patch)
tree145a40d6af3151cf30d62eceb25a91d34c382717 /gcc
parentcf22f78ff6ead2b1f022d7e7367daedf459aa355 (diff)
downloadgcc-1467a5c5ab0dfbae3175b4a326467f939864dadb.zip
gcc-1467a5c5ab0dfbae3175b4a326467f939864dadb.tar.gz
gcc-1467a5c5ab0dfbae3175b4a326467f939864dadb.tar.bz2
bootstrap: std:stoul non-portable [PR 98412]
Fix some more system-specific issues. Not everyone's C++11 is the same :( PR bootstrap/98412 libcody/ * client.cc: Include cstdlib. * server.cc: Include cstdlib. gcc/cp/ * mapper-client.cc: INCLUDE_STRING, INCLUDE_VECTOR. (module_client::open_module_client): Avoid std::stoul. * mapper-resolver.cc: INCLUDE_STRING, INCLUDE_VECTOR.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/mapper-client.cc20
-rw-r--r--gcc/cp/mapper-resolver.cc2
2 files changed, 16 insertions, 6 deletions
diff --git a/gcc/cp/mapper-client.cc b/gcc/cp/mapper-client.cc
index 2ad770b..df821ba 100644
--- a/gcc/cp/mapper-client.cc
+++ b/gcc/cp/mapper-client.cc
@@ -24,6 +24,8 @@ along with GCC; see the file COPYING3. If not see
// will include it later under the above check
#include <sys/socket.h>
#endif
+#define INCLUDE_STRING
+#define INCLUDE_VECTOR
#include "system.h"
#include "line-map.h"
@@ -171,14 +173,18 @@ module_client::open_module_client (location_t loc, const char *o,
}
else
{
+ char *ptr;
if (!from.empty ())
{
- fd_from = std::stoul (from, &pos, 10);
- if (pos != from.size ())
+ /* Sadly str::stoul is not portable. */
+ const char *cstr = from.c_str ();
+ fd_from = strtoul (cstr, &ptr, 10);
+ if (*ptr)
{
+ /* Not a number -- a named pipe. */
int dir = to.empty ()
? O_RDWR | O_CLOEXEC : O_RDONLY | O_CLOEXEC;
- fd_from = open (from.c_str (), dir);
+ fd_from = open (cstr, dir);
}
if (to.empty ())
fd_to = fd_from;
@@ -190,12 +196,14 @@ module_client::open_module_client (location_t loc, const char *o,
;
else
{
- fd_to = std::stoul (to, &pos, 10);
- if (pos != to.size ())
+ const char *cstr = to.c_str ();
+ fd_to = strtoul (cstr, &ptr, 10);
+ if (*ptr)
{
+ /* Not a number, a named pipe. */
int dir = from.empty ()
? O_RDWR | O_CLOEXEC : O_WRONLY | O_CLOEXEC;
- fd_to = open (to.c_str (), dir);
+ fd_to = open (cstr, dir);
if (fd_to < 0)
close (fd_from);
}
diff --git a/gcc/cp/mapper-resolver.cc b/gcc/cp/mapper-resolver.cc
index 53c4824..e348757 100644
--- a/gcc/cp/mapper-resolver.cc
+++ b/gcc/cp/mapper-resolver.cc
@@ -21,6 +21,8 @@ along with GCC; see the file COPYING3. If not see
/* Forward to the resolver in c++tools. */
#include "config.h"
+#define INCLUDE_STRING
+#define INCLUDE_VECTOR
#define INCLUDE_ALGORITHM
#include "system.h"