VxWorks support in boost 1.41

Having recently upgraded to just released 1.41 version of boost, I noticed the new support for the VxWorks platform. I am now in the process of porting over a body of code using boost to a VxWorks/PPC platform and obviously want to take advantage of the builtin support, but I've run into a problem and would like advice on the "boost" way of rectifying the problem. I am using VxWorks 6.7 to be running on an MPC8548 PPC. When I try to compile my project files in the standard manner for incorporating boost with tr1 support (.../boost/boost/tr1/tr1 and .../boost first in the header search paths, #include <memory> as first thing in files), I am getting a compile warning. The complaint is for already defined preprocessor macros -- in boost/config/vxworks.hpp at lines 23 and 24 there are definitions: #define _POSIX_TIMERS 1 #define _POSIX_THREADS 1 A little further down, this header file includes boilerplate code in boost/config/posix_features.hpp and that header file then includes unistd.h, a system file. For VxWorks 6.7, unistd.h also has defines for the above preprocessor macros, but sets their values to 200112L. While the warning may be able to ignored and is probably benign, IF unistd.h is always included after vxworks.hpp (I am not sure this will be the case for all of our files), I would rather see this fixed. What would be the best way to fix this so as to remain conformant with the "boost" philosophy for platform independence?

AMDG Geoff Shapiro wrote:
Having recently upgraded to just released 1.41 version of boost, I noticed the new support for the VxWorks platform. I am now in the process of porting over a body of code using boost to a VxWorks/PPC platform and obviously want to take advantage of the builtin support, but I've run into a problem and would like advice on the "boost" way of rectifying the problem.
I am using VxWorks 6.7 to be running on an MPC8548 PPC. When I try to compile my project files in the standard manner for incorporating boost with tr1 support (.../boost/boost/tr1/tr1 and .../boost first in the header search paths, #include <memory> as first thing in files), I am getting a compile warning. The complaint is for already defined preprocessor macros -- in boost/config/vxworks.hpp at lines 23 and 24 there are definitions:
#define _POSIX_TIMERS 1 #define _POSIX_THREADS 1
A little further down, this header file includes boilerplate code in boost/config/posix_features.hpp and that header file then includes unistd.h, a system file. For VxWorks 6.7, unistd.h also has defines for the above preprocessor macros, but sets their values to 200112L.
While the warning may be able to ignored and is probably benign, IF unistd.h is always included after vxworks.hpp (I am not sure this will be the case for all of our files), I would rather see this fixed. What would be the best way to fix this so as to remain conformant with the "boost" philosophy for platform independence?
Would something like this work:
#include

Steven Watanabe
Would something like this work:
#include
#ifndef _POSIX_TIMERS #define _POSIX_TIMERS 1 #endif
#ifndef _POSIX_THREADS #define _POSIX_THREADS 1 #endif
Hi Steve - yes, this would work fine for my situation. It is one of the possibilities I had considered, but before I went ahead with it I was curious as to what the more experienced boost community would consider the "right" way to apply a fix for this. I'll make the changes for my builds as shown but I would think that this needs to be on the boost bug lists. I'll look into submitting one... Thanks for your reply, Geoff Shapiro
participants (2)
-
Geoff Shapiro
-
Steven Watanabe