Modify

Opened 7 years ago

Closed 6 years ago

#4297 closed Patches (fixed)

[PATCH] Fix for warning: enumeral and non-enumeral type in conditional expression

Reported by: Lénaïc Huard <lhuard@…> 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)

boost_interprocess_2.patch (12.6 KB) - added by Lénaïc Huard <lhuard@…> 7 years ago.
Patch fixing the warnings: enumeral and non-enumeral type in conditional expression
mtc-4297.patch (509 bytes) - added by Marshall Clow 7 years ago.

Download all attachments as: .zip

Change History (12)

Changed 7 years ago by Lénaïc Huard <lhuard@…>

Attachment: boost_interprocess_2.patch added

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

comment:1 Changed 7 years ago by Ion Gaztañaga

Milestone: Boost 1.44.0Boost-1.45.0
Resolution: fixed
Status: newclosed

Fixed for Boost 1.45 in release branch

comment:2 Changed 7 years ago by visionofarun@…

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 Changed 7 years ago by visionofarun@…

Cc: visionofarun@… added
Keywords: interprocess added
Resolution: fixed
Status: closedreopened
Version: Boost Development TrunkBoost 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'

Changed 7 years ago by Marshall Clow

Attachment: mtc-4297.patch added

comment:4 Changed 7 years ago by Marshall Clow

Here's a patch that silences this warning.

comment:5 Changed 7 years ago by Ion Gaztañaga

Resolution: fixed
Status: reopenedclosed

Fixed in Boost 1.47

comment:6 Changed 6 years ago by anonymous

i have installed Boost 1.47 right in this moment and it seems like this warning is still persistent...

comment:7 Changed 6 years ago by Lénaïc Huard <lhuard@…>

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 Changed 6 years ago by Lénaïc Huard <lhuard@…>

Milestone: Boost 1.45.0Boost 1.48.0
Resolution: fixed
Status: closedreopened

As mentioned above, the warning is still present. The provided patch has not been applied.

comment:9 Changed 6 years ago by anonymous

this is an incredibly, massively annoying bug.

comment:10 Changed 6 years ago by Ion Gaztañaga

Resolution: fixed
Status: reopenedclosed

Fixed in trunk, replaced all enum uses with static const values.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.