Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1047

MSVC warning C4714, bsoncxx operator <<, view() etc. marked as __forceinline not inlined

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.0.2
    • Fix Version/s: 3.1.0
    • Component/s: BSON
    • Labels:
      None
    • Story Points:
      1
    • Sprint:
      Platforms 2016-10-10, Platforms 2016-10-31, Perl/CXX 2016-12-02

      Description

      In MSVC 2015U3, the compiler is unable to inline some bsoncxx functions.

      Try compiling the following with /O2 /W4 (warning level 4):

      #include <bsoncxx/builder/stream/document.hpp>
      #include <bsoncxx/json.hpp>
      #include <iostream>
       
      using namespace bsoncxx::builder::stream;
       
      int main() {
        document doc;
        doc << "test" << "test";
        auto doc_val = doc << finalize;
        std::cout << bsoncxx::to_json(doc_val.view()) << std::endl;
      }
      

      Output:

      1>ctest.cpp(13): warning C4714: function 'bsoncxx::v_noabi::document::value bsoncxx::v_noabi::builder::stream::key_context<bsoncxx::v_noabi::builder::stream::closed_context>::operator <<<const bsoncxx::v_noabi::builder::stream::finalize_type&>(T)' marked as __forceinline not inlined
      1>          with
      1>          [
      1>              T=const bsoncxx::v_noabi::builder::stream::finalize_type &
      1>          ]
      1>  ..\bsoncxx/builder/stream/key_context.hpp(131): note: see declaration of 'bsoncxx::v_noabi::builder::stream::key_context<bsoncxx::v_noabi::builder::stream::closed_context>::operator <<'
      1>  Generating code
      1>..\bsoncxx\document\value.hpp(109): warning C4714: function 'class bsoncxx::v_noabi::document::view __cdecl bsoncxx::v_noabi::document::value::view(void)const __ptr64' marked as __forceinline not inlined
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              david.golden David Golden
              Reporter:
              rustyx Rustam Abdullaev
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: