Opened 12 years ago
Closed 11 years ago
#4297 closed Patches (fixed)
[PATCH] Fix for warning: enumeral and non-enumeral type in conditional expression
| Reported by: | Owned by: | Ion Gaztañaga | |
|---|---|---|---|
| Milestone: | Boost 1.48.0 | Component: | interprocess |
| Version: | Boost 1.45.0 | Severity: | Cosmetic |
| Keywords: | interprocess | Cc: | visionofarun@… |
Description
Hello,
When compiling some programs using boost.interprocess with gcc, we get a bunch of warning messages like:
include/boost/interprocess/mem_algo/rbtree_best_fit.hpp:323: warning: enumeral and non-enumeral type in conditional expression
The attached patch aims at fixing those warnings.
BRgds, Lénaïc.
Attachments (2)
Change History (12)
by , 12 years ago
| Attachment: | boost_interprocess_2.patch added |
|---|
comment:1 by , 12 years ago
| Milestone: | Boost 1.44.0 → Boost-1.45.0 |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
Fixed for Boost 1.45 in release branch
comment:2 by , 12 years ago
Hi,
I'm reopening the ticket. This ticket appears in Boost 1.45.0 release notes. But seems like its not fixed yet. There are still warning messages with "g++ -W".
#include <boost/interprocess/managed_shared_memory.hpp>
int main()
{
boost::interprocess::managed_shared_memory *mem;
return 0;
}
g++ -c -W -fvisibility=hidden -g -Wall 1.cpp -o 1 -I/usr/local/include/boost-1.45.0/
In file included from /usr/local/include/boost-1.45.0/boost/interprocess/detail/managed_memory_impl.hpp:22,
from /usr/local/include/boost-1.45.0/boost/interprocess/managed_shared_memory.hpp:21,
from 1.cpp:1:
/usr/local/include/boost-1.45.0/boost/interprocess/mem_algo/rbtree_best_fit.hpp:321: warning: enumeral and non-enumeral type in conditional expression
1.cpp: In function 'int main()':
1.cpp:5: warning: unused variable 'mem'
comment:3 by , 12 years ago
| Cc: | added |
|---|---|
| Keywords: | interprocess added |
| Resolution: | fixed |
| Status: | closed → reopened |
| Version: | Boost Development Trunk → Boost 1.45.0 |
Hi,
Sorry for posting above.
I'm reopening the ticket. This ticket appears in Boost 1.45.0 release notes. But seems like its not fixed yet. There are still warning messages with "g++ -W".
#include <boost/interprocess/managed_shared_memory.hpp>
int main()
{
boost::interprocess::managed_shared_memory *mem;
return 0;
}
g++ -c -W -fvisibility=hidden -g -Wall 1.cpp -o 1 -I/usr/local/include/boost-1.45.0/
In file included from /usr/local/include/boost-1.45.0/boost/interprocess/detail/managed_memory_impl.hpp:22,
from /usr/local/include/boost-1.45.0/boost/interprocess/managed_shared_memory.hpp:21,
from 1.cpp:1:
/usr/local/include/boost-1.45.0/boost/interprocess/mem_algo/rbtree_best_fit.hpp:321: warning: enumeral and non-enumeral type in conditional expression
1.cpp: In function 'int main()':
1.cpp:5: warning: unused variable 'mem'
by , 12 years ago
| Attachment: | mtc-4297.patch added |
|---|
comment:6 by , 11 years ago
i have installed Boost 1.47 right in this moment and it seems like this warning is still persistent...
comment:7 by , 11 years ago
Indeed, I confirm that the warning is still present with Boost 1.47.
The clean way to fix it is definitely to replace all the enums in metafunctions by the usage of BOOST_STATIC_CONSTANT as recommended in the Coding Guidelines for Integral Constant Expressions page and as I proposed in boost_interprocess_2.patch.
But as far as I can see, my patch has still not been applied in Boost 1.47.
Ex: type_traits.hpp of Boost 1.47
There are still enums whereas I replaced them by BOOST_STATIC_CONSTANT in boost_interprocess_2.patch.
comment:8 by , 11 years ago
| Milestone: | Boost 1.45.0 → Boost 1.48.0 |
|---|---|
| Resolution: | fixed |
| Status: | closed → reopened |
As mentioned above, the warning is still present. The provided patch has not been applied.
comment:10 by , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
Fixed in trunk, replaced all enum uses with static const values.

Patch fixing the warnings: enumeral and non-enumeral type in conditional expression