You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by jeking3 <gi...@git.apache.org> on 2017/08/05 17:05:16 UTC

[GitHub] thrift pull request #1328: THRIFT-2221: detect C++11 and use std namespace f...

GitHub user jeking3 opened a pull request:

    https://github.com/apache/thrift/pull/1328

    THRIFT-2221: detect C++11 and use std namespace for memory operations (smart_ptr)

    I had to close my older pull request because the history got tainted, so I am reopening it with the suggestions from Jira.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jeking3/thrift THRIFT-2221

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/1328.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1328
    
----
commit 95f90ecde41fd60e99779c472a24480a39672060
Author: James E. King, III <ji...@simplivity.com>
Date:   2017-08-05T16:23:54Z

    THRIFT-2221: detect C++11 and use std namespace for memory operations (smart_ptr)

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request #1328: THRIFT-2221: detect C++11 and use std namespace f...

Posted by jeking3 <gi...@git.apache.org>.
Github user jeking3 commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1328#discussion_r132013921
  
    --- Diff: lib/cpp/src/thrift/stdcxx.h ---
    @@ -0,0 +1,137 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements. See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership. The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License. You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied. See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +#ifndef _THRIFT_STDCXX_H_
    +#define _THRIFT_STDCXX_H_ 1
    +
    +#include <boost/config.hpp>
    +
    +///////////////////////////////////////////////////////////////////
    +//
    +// functional (function, bind)
    +//
    +///////////////////////////////////////////////////////////////////
    +
    +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
    +#include <boost/tr1/functional.hpp>
    +#define _THRIFT_FUNCTIONAL_TR1_ 1
    +#endif
    +
    +#if _MSC_VER == 1600
    +#include <functional>
    +#define _THRIFT_FUNCTIONAL_TR1_ 1
    +#endif
    +
    +#if _THRIFT_FUNCTIONAL_TR1_
    +
    +  namespace apache { namespace thrift { namespace stdcxx {
    +
    +    using ::std::tr1::bind;
    +    using ::std::tr1::function;
    +
    +    namespace placeholders {
    +      using ::std::tr1::placeholders::_1;
    +      using ::std::tr1::placeholders::_2;
    +      using ::std::tr1::placeholders::_3;
    +      using ::std::tr1::placeholders::_4;
    +      using ::std::tr1::placeholders::_5;
    +      using ::std::tr1::placeholders::_6;
    +    } // apache::thrift::stdcxx::placeholders
    +  }}} // apache::thrift::stdcxx
    +
    +#else
    +
    +  #include <functional>
    +
    +  namespace apache { namespace thrift { namespace stdcxx {
    +    using ::std::bind;
    +    using ::std::function;
    +
    +    namespace placeholders {
    +      using ::std::placeholders::_1;
    +      using ::std::placeholders::_2;
    +      using ::std::placeholders::_3;
    +      using ::std::placeholders::_4;
    +      using ::std::placeholders::_5;
    +      using ::std::placeholders::_6;
    +    } // apache::thrift::stdcxx::placeholders
    +  }}} // apache::thrift::stdcxx
    +
    +#endif
    +
    +///////////////////////////////////////////////////////////////////
    +//
    +// Smart Pointers
    +//
    +///////////////////////////////////////////////////////////////////
    +
    +//
    +// This is for debugging build issues in CI:
    +//
    +#if 0
    +#define STRING2(x) #x
    +#define STRING(x) STRING2(x)
    +#pragma message(STRING(__clang__))
    +#pragma message(STRING(__clang_version__))
    +#pragma message(STRING(__cplusplus))
    +#pragma message(STRING(__GNUC__))
    +#pragma message(STRING(__GNUC_MINOR__))
    +#pragma message(STRING(__GNUC_PATCHLEVEL__))
    +#pragma message(STRING(__cpp_alias_templates))
    +#endif
    +
    +#if defined(BOOST_NO_CXX11_SMART_PTR) || defined(FORCE_BOOST_SMART_PTR)
    +#include <boost/smart_ptr.hpp>
    +#else
    +#include <memory>
    +  #if __cplusplus < 201103L
    --- End diff --
    
    Cleaned up in the last push.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift issue #1328: THRIFT-2221: detect C++11 and use std namespace for memo...

Posted by jeking3 <gi...@git.apache.org>.
Github user jeking3 commented on the issue:

    https://github.com/apache/thrift/pull/1328
  
    The lone build failure is a "D" language/test issue that appears sporadically.  All other builds passed.   As such, I am going to merge this in given it was already reviewed, and the follow-on changes were fairly trivial.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request #1328: THRIFT-2221: detect C++11 and use std namespace f...

Posted by jeking3 <gi...@git.apache.org>.
Github user jeking3 commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1328#discussion_r132013676
  
    --- Diff: lib/cpp/README.md ---
    @@ -55,15 +54,22 @@ you are using libthriftnb you will also need libevent.
     
     ## Dependencies
     
    -boost shared pointers
    -http://www.boost.org/libs/smart_ptr/smart_ptr.htm
    +If your C++ environment implements C++11 or later, boost will automatically use
    --- End diff --
    
    Got it, I can correct this.  I'm still dealing with aligning the stars on this one.  Lots of namespace and using cleanup, and we will no longer work with Visual Studio 2010 and 2012 in C++0x/C++11 mode; 2013 will be required for C++11 because the solution requires template aliases.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request #1328: THRIFT-2221: detect C++11 and use std namespace f...

Posted by hcorg <gi...@git.apache.org>.
Github user hcorg commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1328#discussion_r131968203
  
    --- Diff: lib/cpp/README.md ---
    @@ -55,15 +54,22 @@ you are using libthriftnb you will also need libevent.
     
     ## Dependencies
     
    -boost shared pointers
    -http://www.boost.org/libs/smart_ptr/smart_ptr.htm
    +If your C++ environment implements C++11 or later, boost will automatically use
    --- End diff --
    
    Even if boost itself provides mapping to `std::` pointers, next sentence suggests that boost is not needed. Some little clean up could help confused users ;) (this is also first place in README.md where boost is mentioned, hence the potential confusion)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request #1328: THRIFT-2221: detect C++11 and use std namespace f...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/thrift/pull/1328


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request #1328: THRIFT-2221: detect C++11 and use std namespace f...

Posted by hcorg <gi...@git.apache.org>.
Github user hcorg commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1328#discussion_r131968863
  
    --- Diff: lib/cpp/src/thrift/stdcxx.h ---
    @@ -0,0 +1,137 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements. See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership. The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License. You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied. See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +#ifndef _THRIFT_STDCXX_H_
    +#define _THRIFT_STDCXX_H_ 1
    +
    +#include <boost/config.hpp>
    +
    +///////////////////////////////////////////////////////////////////
    +//
    +// functional (function, bind)
    +//
    +///////////////////////////////////////////////////////////////////
    +
    +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
    +#include <boost/tr1/functional.hpp>
    +#define _THRIFT_FUNCTIONAL_TR1_ 1
    +#endif
    +
    +#if _MSC_VER == 1600
    +#include <functional>
    +#define _THRIFT_FUNCTIONAL_TR1_ 1
    +#endif
    +
    +#if _THRIFT_FUNCTIONAL_TR1_
    +
    +  namespace apache { namespace thrift { namespace stdcxx {
    +
    +    using ::std::tr1::bind;
    +    using ::std::tr1::function;
    +
    +    namespace placeholders {
    +      using ::std::tr1::placeholders::_1;
    +      using ::std::tr1::placeholders::_2;
    +      using ::std::tr1::placeholders::_3;
    +      using ::std::tr1::placeholders::_4;
    +      using ::std::tr1::placeholders::_5;
    +      using ::std::tr1::placeholders::_6;
    +    } // apache::thrift::stdcxx::placeholders
    +  }}} // apache::thrift::stdcxx
    +
    +#else
    +
    +  #include <functional>
    +
    +  namespace apache { namespace thrift { namespace stdcxx {
    +    using ::std::bind;
    +    using ::std::function;
    +
    +    namespace placeholders {
    +      using ::std::placeholders::_1;
    +      using ::std::placeholders::_2;
    +      using ::std::placeholders::_3;
    +      using ::std::placeholders::_4;
    +      using ::std::placeholders::_5;
    +      using ::std::placeholders::_6;
    +    } // apache::thrift::stdcxx::placeholders
    +  }}} // apache::thrift::stdcxx
    +
    +#endif
    +
    +///////////////////////////////////////////////////////////////////
    +//
    +// Smart Pointers
    +//
    +///////////////////////////////////////////////////////////////////
    +
    +//
    +// This is for debugging build issues in CI:
    +//
    +#if 0
    +#define STRING2(x) #x
    +#define STRING(x) STRING2(x)
    +#pragma message(STRING(__clang__))
    +#pragma message(STRING(__clang_version__))
    +#pragma message(STRING(__cplusplus))
    +#pragma message(STRING(__GNUC__))
    +#pragma message(STRING(__GNUC_MINOR__))
    +#pragma message(STRING(__GNUC_PATCHLEVEL__))
    +#pragma message(STRING(__cpp_alias_templates))
    +#endif
    +
    +#if defined(BOOST_NO_CXX11_SMART_PTR) || defined(FORCE_BOOST_SMART_PTR)
    +#include <boost/smart_ptr.hpp>
    +#else
    +#include <memory>
    +  #if __cplusplus < 201103L
    +    #include <boost/scoped_ptr.hpp>
    +  #endif
    +#endif
    +
    +namespace apache { namespace thrift { namespace stdcxx {
    +
    +#if defined(BOOST_NO_CXX11_SMART_PTR) || defined(FORCE_BOOST_SMART_PTR)
    +
    +  using ::boost::const_pointer_cast;
    +  using ::boost::dynamic_pointer_cast;
    +  using ::boost::enable_shared_from_this;
    +  using ::boost::make_shared;
    +  using ::boost::scoped_ptr;
    +  using ::boost::shared_ptr;
    +  using ::boost::static_pointer_cast;
    +  using ::boost::weak_ptr;
    +
    +#else
    +
    +  using ::std::const_pointer_cast;
    +  using ::std::dynamic_pointer_cast;
    +  using ::std::enable_shared_from_this;
    +  using ::std::make_shared;
    +  // yes, they renamed in in std:: for some reason...
    --- End diff --
    
    unnecessary comment - `scoped_ptr` and `unique_ptr` are quite different (`scoped_ptr` can't be moved) so it's not like standard committee did something wrong ;) (at least with naming it `unique_ptr`)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift issue #1328: THRIFT-2221: detect C++11 and use std namespace for memo...

Posted by jeking3 <gi...@git.apache.org>.
Github user jeking3 commented on the issue:

    https://github.com/apache/thrift/pull/1328
  
    ![image](https://user-images.githubusercontent.com/11771245/29127276-a0e3e7da-7cee-11e7-9149-0e2c6f143f91.png)
    
    Still pushing changes here.  Microsoft didn't make things easy by leaving __cplusplus at an old value even in the latest compilers.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request #1328: THRIFT-2221: detect C++11 and use std namespace f...

Posted by octopus-prime <gi...@git.apache.org>.
Github user octopus-prime commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1328#discussion_r131985807
  
    --- Diff: lib/cpp/src/thrift/stdcxx.h ---
    @@ -0,0 +1,137 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements. See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership. The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License. You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied. See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +#ifndef _THRIFT_STDCXX_H_
    +#define _THRIFT_STDCXX_H_ 1
    +
    +#include <boost/config.hpp>
    +
    +///////////////////////////////////////////////////////////////////
    +//
    +// functional (function, bind)
    +//
    +///////////////////////////////////////////////////////////////////
    +
    +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
    +#include <boost/tr1/functional.hpp>
    +#define _THRIFT_FUNCTIONAL_TR1_ 1
    +#endif
    +
    +#if _MSC_VER == 1600
    +#include <functional>
    +#define _THRIFT_FUNCTIONAL_TR1_ 1
    +#endif
    +
    +#if _THRIFT_FUNCTIONAL_TR1_
    +
    +  namespace apache { namespace thrift { namespace stdcxx {
    +
    +    using ::std::tr1::bind;
    +    using ::std::tr1::function;
    +
    +    namespace placeholders {
    +      using ::std::tr1::placeholders::_1;
    +      using ::std::tr1::placeholders::_2;
    +      using ::std::tr1::placeholders::_3;
    +      using ::std::tr1::placeholders::_4;
    +      using ::std::tr1::placeholders::_5;
    +      using ::std::tr1::placeholders::_6;
    +    } // apache::thrift::stdcxx::placeholders
    +  }}} // apache::thrift::stdcxx
    +
    +#else
    +
    +  #include <functional>
    +
    +  namespace apache { namespace thrift { namespace stdcxx {
    +    using ::std::bind;
    +    using ::std::function;
    +
    +    namespace placeholders {
    +      using ::std::placeholders::_1;
    +      using ::std::placeholders::_2;
    +      using ::std::placeholders::_3;
    +      using ::std::placeholders::_4;
    +      using ::std::placeholders::_5;
    +      using ::std::placeholders::_6;
    +    } // apache::thrift::stdcxx::placeholders
    +  }}} // apache::thrift::stdcxx
    +
    +#endif
    +
    +///////////////////////////////////////////////////////////////////
    +//
    +// Smart Pointers
    +//
    +///////////////////////////////////////////////////////////////////
    +
    +//
    +// This is for debugging build issues in CI:
    +//
    +#if 0
    +#define STRING2(x) #x
    +#define STRING(x) STRING2(x)
    +#pragma message(STRING(__clang__))
    +#pragma message(STRING(__clang_version__))
    +#pragma message(STRING(__cplusplus))
    +#pragma message(STRING(__GNUC__))
    +#pragma message(STRING(__GNUC_MINOR__))
    +#pragma message(STRING(__GNUC_PATCHLEVEL__))
    +#pragma message(STRING(__cpp_alias_templates))
    +#endif
    +
    +#if defined(BOOST_NO_CXX11_SMART_PTR) || defined(FORCE_BOOST_SMART_PTR)
    +#include <boost/smart_ptr.hpp>
    +#else
    +#include <memory>
    +  #if __cplusplus < 201103L
    --- End diff --
    
    What is this test/include for? BOOST_NO_CXX11_SMART_PTR told us above that c++11 smart pointers are available.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request #1328: THRIFT-2221: detect C++11 and use std namespace f...

Posted by hcorg <gi...@git.apache.org>.
Github user hcorg commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1328#discussion_r131966861
  
    --- Diff: lib/cpp/README.md ---
    @@ -55,15 +54,22 @@ you are using libthriftnb you will also need libevent.
     
     ## Dependencies
     
    -boost shared pointers
    -http://www.boost.org/libs/smart_ptr/smart_ptr.htm
    +If your C++ environment implements C++11 or later, boost will automatically use
    --- End diff --
    
    `If your C++ environment implements C++11 or later, boost will automatically use` - boost or Thrift?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request #1328: THRIFT-2221: detect C++11 and use std namespace f...

Posted by octopus-prime <gi...@git.apache.org>.
Github user octopus-prime commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1328#discussion_r131985042
  
    --- Diff: lib/cpp/src/thrift/stdcxx.h ---
    @@ -0,0 +1,137 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements. See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership. The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License. You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied. See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +#ifndef _THRIFT_STDCXX_H_
    +#define _THRIFT_STDCXX_H_ 1
    +
    +#include <boost/config.hpp>
    +
    +///////////////////////////////////////////////////////////////////
    +//
    +// functional (function, bind)
    +//
    +///////////////////////////////////////////////////////////////////
    +
    +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
    +#include <boost/tr1/functional.hpp>
    +#define _THRIFT_FUNCTIONAL_TR1_ 1
    +#endif
    +
    +#if _MSC_VER == 1600
    +#include <functional>
    +#define _THRIFT_FUNCTIONAL_TR1_ 1
    +#endif
    +
    +#if _THRIFT_FUNCTIONAL_TR1_
    +
    +  namespace apache { namespace thrift { namespace stdcxx {
    +
    +    using ::std::tr1::bind;
    +    using ::std::tr1::function;
    +
    +    namespace placeholders {
    +      using ::std::tr1::placeholders::_1;
    +      using ::std::tr1::placeholders::_2;
    +      using ::std::tr1::placeholders::_3;
    +      using ::std::tr1::placeholders::_4;
    +      using ::std::tr1::placeholders::_5;
    +      using ::std::tr1::placeholders::_6;
    +    } // apache::thrift::stdcxx::placeholders
    +  }}} // apache::thrift::stdcxx
    +
    +#else
    +
    +  #include <functional>
    +
    +  namespace apache { namespace thrift { namespace stdcxx {
    +    using ::std::bind;
    +    using ::std::function;
    +
    +    namespace placeholders {
    +      using ::std::placeholders::_1;
    +      using ::std::placeholders::_2;
    +      using ::std::placeholders::_3;
    +      using ::std::placeholders::_4;
    +      using ::std::placeholders::_5;
    +      using ::std::placeholders::_6;
    +    } // apache::thrift::stdcxx::placeholders
    +  }}} // apache::thrift::stdcxx
    +
    +#endif
    +
    +///////////////////////////////////////////////////////////////////
    +//
    +// Smart Pointers
    +//
    +///////////////////////////////////////////////////////////////////
    +
    +//
    +// This is for debugging build issues in CI:
    +//
    +#if 0
    +#define STRING2(x) #x
    +#define STRING(x) STRING2(x)
    +#pragma message(STRING(__clang__))
    +#pragma message(STRING(__clang_version__))
    +#pragma message(STRING(__cplusplus))
    +#pragma message(STRING(__GNUC__))
    +#pragma message(STRING(__GNUC_MINOR__))
    +#pragma message(STRING(__GNUC_PATCHLEVEL__))
    +#pragma message(STRING(__cpp_alias_templates))
    +#endif
    +
    +#if defined(BOOST_NO_CXX11_SMART_PTR) || defined(FORCE_BOOST_SMART_PTR)
    +#include <boost/smart_ptr.hpp>
    +#else
    +#include <memory>
    +  #if __cplusplus < 201103L
    --- End diff --
    
    What is this test for? BOOST_NO_CXX11_SMART_PTR told us above that c++11 samart pointers are available.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request #1328: THRIFT-2221: detect C++11 and use std namespace f...

Posted by jeking3 <gi...@git.apache.org>.
Github user jeking3 commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1328#discussion_r132013793
  
    --- Diff: lib/cpp/src/thrift/stdcxx.h ---
    @@ -0,0 +1,137 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements. See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership. The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License. You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied. See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +#ifndef _THRIFT_STDCXX_H_
    +#define _THRIFT_STDCXX_H_ 1
    +
    +#include <boost/config.hpp>
    +
    +///////////////////////////////////////////////////////////////////
    +//
    +// functional (function, bind)
    +//
    +///////////////////////////////////////////////////////////////////
    +
    +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
    +#include <boost/tr1/functional.hpp>
    +#define _THRIFT_FUNCTIONAL_TR1_ 1
    +#endif
    +
    +#if _MSC_VER == 1600
    +#include <functional>
    +#define _THRIFT_FUNCTIONAL_TR1_ 1
    +#endif
    +
    +#if _THRIFT_FUNCTIONAL_TR1_
    +
    +  namespace apache { namespace thrift { namespace stdcxx {
    +
    +    using ::std::tr1::bind;
    +    using ::std::tr1::function;
    +
    +    namespace placeholders {
    +      using ::std::tr1::placeholders::_1;
    +      using ::std::tr1::placeholders::_2;
    +      using ::std::tr1::placeholders::_3;
    +      using ::std::tr1::placeholders::_4;
    +      using ::std::tr1::placeholders::_5;
    +      using ::std::tr1::placeholders::_6;
    +    } // apache::thrift::stdcxx::placeholders
    +  }}} // apache::thrift::stdcxx
    +
    +#else
    +
    +  #include <functional>
    +
    +  namespace apache { namespace thrift { namespace stdcxx {
    +    using ::std::bind;
    +    using ::std::function;
    +
    +    namespace placeholders {
    +      using ::std::placeholders::_1;
    +      using ::std::placeholders::_2;
    +      using ::std::placeholders::_3;
    +      using ::std::placeholders::_4;
    +      using ::std::placeholders::_5;
    +      using ::std::placeholders::_6;
    +    } // apache::thrift::stdcxx::placeholders
    +  }}} // apache::thrift::stdcxx
    +
    +#endif
    +
    +///////////////////////////////////////////////////////////////////
    +//
    +// Smart Pointers
    +//
    +///////////////////////////////////////////////////////////////////
    +
    +//
    +// This is for debugging build issues in CI:
    +//
    +#if 0
    +#define STRING2(x) #x
    +#define STRING(x) STRING2(x)
    +#pragma message(STRING(__clang__))
    +#pragma message(STRING(__clang_version__))
    +#pragma message(STRING(__cplusplus))
    +#pragma message(STRING(__GNUC__))
    +#pragma message(STRING(__GNUC_MINOR__))
    +#pragma message(STRING(__GNUC_PATCHLEVEL__))
    +#pragma message(STRING(__cpp_alias_templates))
    +#endif
    +
    +#if defined(BOOST_NO_CXX11_SMART_PTR) || defined(FORCE_BOOST_SMART_PTR)
    +#include <boost/smart_ptr.hpp>
    +#else
    +#include <memory>
    +  #if __cplusplus < 201103L
    +    #include <boost/scoped_ptr.hpp>
    +  #endif
    +#endif
    +
    +namespace apache { namespace thrift { namespace stdcxx {
    +
    +#if defined(BOOST_NO_CXX11_SMART_PTR) || defined(FORCE_BOOST_SMART_PTR)
    +
    +  using ::boost::const_pointer_cast;
    +  using ::boost::dynamic_pointer_cast;
    +  using ::boost::enable_shared_from_this;
    +  using ::boost::make_shared;
    +  using ::boost::scoped_ptr;
    +  using ::boost::shared_ptr;
    +  using ::boost::static_pointer_cast;
    +  using ::boost::weak_ptr;
    +
    +#else
    +
    +  using ::std::const_pointer_cast;
    +  using ::std::dynamic_pointer_cast;
    +  using ::std::enable_shared_from_this;
    +  using ::std::make_shared;
    +  // yes, they renamed in in std:: for some reason...
    --- End diff --
    
    I removed it in the last PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request #1328: THRIFT-2221: detect C++11 and use std namespace f...

Posted by jeking3 <gi...@git.apache.org>.
Github user jeking3 commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1328#discussion_r132017398
  
    --- Diff: lib/cpp/README.md ---
    @@ -55,15 +54,22 @@ you are using libthriftnb you will also need libevent.
     
     ## Dependencies
     
    -boost shared pointers
    -http://www.boost.org/libs/smart_ptr/smart_ptr.htm
    +If your C++ environment implements C++11 or later, boost will automatically use
    --- End diff --
    
    Fixed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift issue #1328: THRIFT-2221: detect C++11 and use std namespace for memo...

Posted by jeking3 <gi...@git.apache.org>.
Github user jeking3 commented on the issue:

    https://github.com/apache/thrift/pull/1328
  
    I added a TPipe test because I changed one line of code in TPipe to work around a build issue, and I didn't see a TTransportTest test for TPipe.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---