Opened 9 years ago

Closed 9 years ago

#9482 closed Bugs (fixed)

MSVC macros not undefined in boost/move/detail/config_end.hpp

Reported by: Matthias R Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: move
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

Boost.Move defines several macros in boost/move/detail/config_begin.hpp to silence MSVC warnings. The corresponding cleanup code in boost/move/detail/config_end.hpp is incorrect and fails to properly undefine these macros:

#if defined BOOST_MSVC
   #pragma warning (pop)
   #ifdef BOOST_MOVE_DETAIL_CRT_SECURE_NO_DEPRECATE
      #undef BOOST_MOVE_DETAIL_CRT_SECURE_NO_DEPRECATE
      #undef _CRT_SECURE_NO_DEPRECATE
   #endif
   #ifndef BOOST_MOVE_SCL_SECURE_NO_WARNINGS
      #undef  BOOST_MOVE_SCL_SECURE_NO_WARNINGS
      #undef _SCL_SECURE_NO_WARNINGS
   #endif
#endif

A correct implementation would be

#if defined BOOST_MSVC
   #pragma warning (pop)
   #ifdef BOOST_MOVE_CRT_SECURE_NO_DEPRECATE
      #undef  BOOST_MOVE_CRT_SECURE_NO_DEPRECATE
      #undef _CRT_SECURE_NO_DEPRECATE
   #endif
   #ifdef BOOST_MOVE_SCL_SECURE_NO_WARNINGS
      #undef  BOOST_MOVE_SCL_SECURE_NO_WARNINGS
      #undef _SCL_SECURE_NO_WARNINGS
   #endif
#endif

This is quite problematic as the current version either undefines a previously defined macro, or leaks the macro definition, both of which lead to surprising behavior.

A patch against current trunk is attached.

Attachments (1)

boost_move_detail_config_end.patch (807 bytes ) - added by Matthias R 9 years ago.

Download all attachments as: .zip

Change History (2)

by Matthias R, 9 years ago

comment:1 by Ion Gaztañaga, 9 years ago

Resolution: fixed
Status: newclosed

Sorry for the delay and thanks for the patch. Fixed in commit

SHA-1: 688955ab9b1e022a49c027a8fc6f56ada3ff8e0f

Note: See TracTickets for help on using tickets.