#3061 closed defect (invalid)

including 'unistd.h' in C++ does not build.

Reported by: Chris Johns Owned by: chrisj@…
Priority: highest Milestone: 5.1
Component: tool Version: 5
Severity: blocker Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by Chris Johns)

Including unistd.h in a C++ program does not compile with the RSB for today:

$ /opt/work/rtems/4.12/bin/arm-rtems4.12-g++ -B/opt/work/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib -B/opt/work/si/rtems/4.12/arm-rtems4.12/xilinx_zynq_zc706/lib -specs bsp_specs -qrtems -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -mtune=cortex-a9 -g -O2 u.cpp                                                                                     
In file included from /opt/work/rtems/4.12/arm-rtems4.12/include/sys/_pthreadtypes.h:24:0,
                 from /opt/work/rtems/4.12/arm-rtems4.12/include/sys/types.h:239,
                 from /opt/work/rtems/4.12/arm-rtems4.12/include/sys/unistd.h:12,
                 from /opt/work/rtems/4.12/arm-rtems4.12/include/unistd.h:4,
                 from u.cpp:6:
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h: In function 'void CPU_AND_S(size_t, cpu_set_t*, const cpu_set_t*, const cpu_set_t*)':
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h:147:3: error: 'BIT_AND2' was not declared in this scope
   BIT_AND2(_cpu_set_bits(setsize), destset, srcset1, srcset2);
   ^~~~~~~~
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h:147:3: note: suggested alternative: 'BIT_AND'
   BIT_AND2(_cpu_set_bits(setsize), destset, srcset1, srcset2);
   ^~~~~~~~
   BIT_AND
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h: In function 'void CPU_OR_S(size_t, cpu_set_t*, const cpu_set_t*, const cpu_set_t*)':
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h:159:3: error: 'BIT_OR2' was not declared in this scope
   BIT_OR2(_cpu_set_bits(setsize), destset, srcset1, srcset2);
   ^~~~~~~
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h:159:3: note: suggested alternative: 'BIT_OR'
   BIT_OR2(_cpu_set_bits(setsize), destset, srcset1, srcset2);
   ^~~~~~~
   BIT_OR
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h: In function 'void CPU_XOR_S(size_t, cpu_set_t*, const cpu_set_t*, const cpu_set_t*)':
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h:171:3: error: 'BIT_XOR2' was not declared in this scope
   BIT_XOR2(_cpu_set_bits(setsize), destset, srcset1, srcset2);
   ^~~~~~~~
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h:171:3: note: suggested alternative: 'BIT_OR'
   BIT_XOR2(_cpu_set_bits(setsize), destset, srcset1, srcset2);
   ^~~~~~~~
   BIT_OR
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h: In function 'void CPU_NAND_S(size_t, cpu_set_t*, const cpu_set_t*, const cpu_set_t*)':
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h:183:3: error: 'BIT_NAND2' was not declared in this scope
   BIT_NAND2(_cpu_set_bits(setsize), destset, srcset1, srcset2);
   ^~~~~~~~~
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h:183:3: note: suggested alternative: 'BIT_NAND'
   BIT_NAND2(_cpu_set_bits(setsize), destset, srcset1, srcset2);
   ^~~~~~~~~
   BIT_NAND
In file included from /opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h:46:0,
                 from /opt/work/rtems/4.12/arm-rtems4.12/include/sys/_pthreadtypes.h:24,
                 from /opt/work/rtems/4.12/arm-rtems4.12/include/sys/types.h:239,
                 from /opt/work/rtems/4.12/arm-rtems4.12/include/sys/unistd.h:12,
                 from /opt/work/rtems/4.12/arm-rtems4.12/include/unistd.h:4,
                 from u.cpp:6:
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h: In function 'int CPU_COUNT_S(size_t, const cpu_set_t*)':
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h:194:10: error: '__bitcountl' was not declared in this scope
   return BIT_COUNT(_cpu_set_bits(setsize), set);
          ^
/opt/work/rtems/4.12/arm-rtems4.12/include/sys/cpuset.h:194:10: note: suggested alternative: '__count'

Attachments (1)

u.cpp (325 bytes) - added by Chris Johns on 07/05/17 at 03:23:40.
Sample code to generate the error.

Download all attachments as: .zip

Change History (7)

Changed on 07/05/17 at 03:23:40 by Chris Johns

Attachment: u.cpp added

Sample code to generate the error.

comment:1 Changed on 07/05/17 at 03:24:41 by Chris Johns

Description: modified (diff)

comment:2 Changed on 07/05/17 at 03:42:13 by Chris Johns

Maybe we need a test for C++ that just includes a number of standard headers.

comment:3 Changed on 07/05/17 at 11:46:37 by Sebastian Huber

I guess this xilinx_zynq_zc706 installation has an installed libbsd? I removed some header files from libbsd which may in in your installation tree (e.g. you have now two bitset.h).

comment:4 Changed on 07/05/17 at 11:56:05 by Joel Sherrill

It may be worth it to duplicate psxhdr for C++

comment:5 in reply to:  3 Changed on 07/06/17 at 00:08:21 by Chris Johns

Resolution: invalid
Status: newclosed

Replying to Sebastian Huber:

I guess this xilinx_zynq_zc706 installation has an installed libbsd? I removed some header files from libbsd which may in in your installation tree (e.g. you have now two bitset.h).

Doh! Yes it does. Removing the installed BSP and then installing again allowed libbsd to build.

Thanks.

comment:6 Changed on 11/09/17 at 06:27:14 by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.