#6139 closed Bugs (fixed)
error: "BOOST_CLANG" is not defined
Reported by: | Owned by: | Daniel James | |
---|---|---|---|
Milestone: | Boost 1.49.0 | Component: | None |
Version: | Boost 1.47.0 | Severity: | Problem |
Keywords: | Cc: |
Description
boost/detail/container_fwd.hpp:72:9: error: "BOOST_CLANG" is not defined
This header file at line 72 contains the following:
#if BOOST_CLANG
But BOOST_CLANG is not even defined in my environment (gcc 4.1.2 on RHEL 5.x). I've checked all other occurrences of BOOST_CLANG in boost header files and all contain construct such as
defined(BOOST_CLANG)
The problem is present in boost 1.48.0 as well. I changed line 72 to:
#if defined(BOOST_CLANG) && (BOOST_CLANG)
and it seems to work now.
Perhaps it could be changed just to:
#if defined(BOOST_CLANG)
Should you need more information, just ping me.
Ivo Raisr
Attachments (4)
Change History (16)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Component: | any → None |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Sorry I'd meant to revert that change before, but forgot to.
by , 11 years ago
Attachment: | container_fwd_guarded.diff added |
---|
by , 11 years ago
Attachment: | container_fwd_simple.diff added |
---|
comment:3 by , 11 years ago
Revision https://svn.boost.org/trac/boost/changeset/75544 just broke my clang builds. The correct solution would be to either
- use #if defined(BOOST_CLANG) see container_fwd_guarded.diff
- change "class" to struct see containner_fwd_simple.diff
The interesting thing is that container_fwd.hpp contains a msvc-suppression for struct/class mismatch: line 104ff:
#if defined(BOOST_MSVC) #pragma warning(push) #pragma warning(disable:4099) // struct/class mismatch in fwd declarations #endif
So the "correct" solution depends on how the corresponding standard library declares struct or class "complex". At least the guarded approach prevents clang from emitting a warning.
comment:4 by , 11 years ago
Detecting clang is not the right thing to do, it should be based on the standard library not the compiler. How did it break your build?
comment:5 by , 11 years ago
clang issues a "-Wmismatched-tags" warning for struct/class mismatches. This is C4099 in msvc as mentioned before.
To be compatible with the msvc-settings, we have -Werror=mismatched-tags to reduce the noise in our sources.
The proper way seems to be do "struct complex;" for all and be happy.
If all standard libraries do it that way, of course.
comment:6 by , 11 years ago
I tried to fix this in [75561], although I'm not sure if it will work as I don't have clang on windows. If it doesn't, can you build and run config_info
(from libs/config/test/config_info.cpp
) and attach the output.
I might just change it to always disable forwarding for clang, clang parses the standard headers pretty quickly so it shouldn't make any real difference.
comment:7 by , 11 years ago
Does not work. You should #define BOOST_CONTAINER_FWD_COMPLEX_STRUCT for #if defined(BOOST_CLANG). And this is on Linux, my settings are just for reducing cross-plattform compiler/stdlib inconsistencies. I think I'll #define BOOST_DETAIL_NO_CONTAINER_FWD in the meantime.
comment:8 by , 11 years ago
Sorry, I'm not going to do anything until I have a better idea of what your setup is. If you attach the output of config_info.cpp
that would help. Or if that's too difficult, you could just tell me.
It'd also help if you explained why you think that the definition of complex
is determined by the compiler and not the standard library. I'm not making a change just because it happens to work on one particular setup without understanding the reason behind wanting that change.
On my linux box clang uses gcc's standard library by default, and in that complex
is defined as class complex
. There must be some reason why it isn't on yours, but without more information I can only guess. At the moment, I don't know which standard library you're using or which version of clang you're using.
comment:9 by , 11 years ago
Yes, makes sense. I've attached the output of config_info (threaded) and my full clang backtrace of the error. If you need more information or more tests, please ping me again.
comment:10 by , 11 years ago
(In [75600]) Detail: Fix BOOST_CONTAINER_FWD_COMPLEX_STRUCT
. Refs #6139.
My last change was wrong, it isn't struct for Dinkumware. In GCC's standard library it's declared as a class, but later defined as a struct. This is so far untested as I'm building the latest trunk version of clang (the warning doesn't show for the current clang release).
comment:11 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:12 by , 11 years ago
Oops, the subject of that changeset should have started with 'Detail' not 'Unordered'.
(In [75544]) Detail: Revert [67484] in container_fwd. Refs #6139