Opened 9 years ago

Closed 9 years ago

#257 closed defect (fixed)

src/lib/cc/session_unittests.cc and #include <unistd.h> for pipe, close, read, write, gethostbyname, ioctl

Reported by: jreed Owned by:
Priority: low Milestone:
Component: Unclassified Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity:
Sub-Project: Feature Depending on Ticket:
Estimated Difficulty: 0.0 Add Hours to Ticket:
Total Hours: Internal?: no

Description

Noticed using linker with Sunstudio:

CC -DHAVE_CONFIG_H -I. -I../../..  -I../../../src/lib -I../../../src/lib  
-I../../../src/lib/dns -I../../../src/lib/dns 
-I/export/home/users/jreed/opt/sunstudio-built/gtest-1.5.0/include 
-I/export/home/users/jreed/opt/sunstudio-built/gtest-1.5.0/include 
-D_XPG4_2 -D__EXTENSIONS__ -I/udir/jreed/pkg/include -I../../../ext/asio   
-g -library=stlport4 -features=tmplife -features=tmplrefstatic -c -o 
run_unittests-session_unittests.o `test -f 'session_unittests.cc' || 
echo './'`session_unittests.cc
"../../../ext/asio/asio/detail/pipe_select_interrupter.hpp", line 45: 
Error: The function "pipe" must have a prototype.
"../../../ext/asio/asio/detail/pipe_select_interrupter.hpp", line 65: 
Error: close is not a member of file level.
...

and read, write, gethostname, and ioctl ...

These are all defined in unistd.h on SunOS 5.10.

Index: src/lib/cc/session_unittests.cc
===================================================================
--- src/lib/cc/session_unittests.cc	(revision 2316)
+++ src/lib/cc/session_unittests.cc	(working copy)
@@ -16,6 +16,8 @@
 
 #include "config.h"
 
+// provides pipe(2) used by ext/asio/asio/detail/pipe_select_interrupter.hpp
+#include <unistd.h>
 // XXX: the ASIO header must be included before others.  See session.cc.
 #include <asio.hpp>
 

Okay to commit above? I didn't notice any problem with g++ on NetBSD.

Subtickets

Change History (2)

comment:1 Changed 9 years ago by jinmei

go ahead.

I suspect in other env the necessary header file is implicitly included.

comment:2 Changed 9 years ago by jreed

  • billable set to 0
  • Estimated Difficulty set to 0.0
  • Internal? unset
  • Resolution set to fixed
  • Status changed from new to closed

Handled this over a month ago. r2391 (for trac #270)

Note: See TracTickets for help on using tickets.