Opened 10 years ago

Closed 10 years ago

#6843 closed Patches (fixed)

[Intel C++] Compile Errors with '#include <atomic>'

Reported by: raptorfactor@… Owned by: viboes
Milestone: Boost 1.54.0 Component: thread
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:

Description

Under Intel C++ (12.1) on Windows, in C++0x mode, the following fails to compile:

#include <atomic>
#include <boost/thread.hpp>
int main() { }

The problem has been discovered previously:

http://software.intel.com/en-us/forums/showpost.php?p=160114

However there seems to be no forthcoming fix on Intel's part.

Attached is a patch to fix this problem. It will probably require a bit of extra wrapping though (to check for Intel version and C++0x mode).

Attachments (1)

boost-future-intel-fix-20120421-0519.patch (1.6 KB ) - added by Joshua Boyce <raptorfactor@…> 10 years ago.
Fist patch. Massive hack. Needs improvement.

Download all attachments as: .zip

Change History (8)

by Joshua Boyce <raptorfactor@…>, 10 years ago

Fist patch. Massive hack. Needs improvement.

comment:1 by viboes, 10 years ago

Component: threadsmart_ptr
Owner: changed from Anthony Williams to Peter Dimov

Hi,

I guess this problem is related to Boost.SmartPtr as the functions atomic_xxx are defined in smart_ptr/shared_ptr.hpp.

comment:2 by Joshua Boyce <raptorfactor@…>, 10 years ago

Right, but doesn't it need to be worked around at the call site (like I've done in my patch)? How would you propose to fix it in shared_ptr at the point where it's declared/defined? I'd love to hear if you have a better way to fix it.

Thanks for taking the time to read and respond to the ticket.

comment:3 by viboes, 10 years ago

Component: smart_ptrthread
Owner: changed from Peter Dimov to viboes
Status: newassigned

An alternative could be to use a file that does the undef of all the concerned macros and another that does the redef.

#include <boost/detail/atomic/undef_macros.hpp>
if(!atomic_load(&future_)) 
{ 
  future_ptr blank; 
  atomic_compare_exchange(&future_,&blank,future_ptr(new detail::future_object<R>)); 
} 
#include <boost/detail/atomic/redef_macros.hpp>

This has the advantage to have less noise. The same kind of patch can be applied to #6842

comment:4 by Joshua Boyce <raptorfactor@…>, 10 years ago

Yep, that would work great. Like I said originally, my first patch was a massive hack because I just wanted to get my development unblocked.

Your solution looks much nicer, and I look forward to not having to patch my copy locally in the future. :)

Thanks for looking into it again.

in reply to:  4 comment:5 by viboes, 10 years ago

Replying to Joshua Boyce <raptorfactor@…>:

Yep, that would work great. Like I said originally, my first patch was a massive hack because I just wanted to get my development unblocked.

Your solution looks much nicer, and I look forward to not having to patch my copy locally in the future. :)

Thanks for looking into it again.

It will be too late for 1.54. I will try it very soon.

comment:6 by viboes, 10 years ago

Milestone: To Be DeterminedBoost 1.54.0

Committed revision [83903] including new files. Committed revision 83904 specific thread patch.

Last edited 10 years ago by viboes (previous) (diff)

comment:7 by viboes, 10 years ago

Resolution: fixed
Status: assignedclosed

(In [83938]) Thread: merge from trunk to fix #6843,#6966.

Note: See TracTickets for help on using tickets.