1. 10 Sep, 2021 1 commit
  2. 09 Sep, 2021 1 commit
    • Ralf W. Grosse-Kunstleve's avatar
      CodeHealth: Enabling clang-tidy google-explicit-constructor (#3250) · 6abf2baa
      Ralf W. Grosse-Kunstleve authored
      * Adding google-explicit-constructor to .clang-tidy
      
      * clang-tidy explicit attr.h (all automatic)
      
      * clang-tidy explicit cast.h (all automatic)
      
      * clang-tidy detail/init.h (1 NOLINT)
      
      * clang-tidy detail/type_caster_base.h (2 NOLINT)
      
      * clang-tidy pybind11.h (7 NOLINT)
      
      * clang-tidy detail/common.h (3 NOLINT)
      
      * clang-tidy detail/descr.h (2 NOLINT)
      
      * clang-tidy pytypes.h (23 NOLINT, only 1 explicit)
      
      * clang-tidy eigen.h (7 NOLINT, 0 explicit)
      
      * Adding 2 explicit in functional.h
      
      * Adding 4 explicit in iostream.h
      
      * clang-tidy numpy.h (1 NOLINT, 1 explicit)
      
      * clang-tidy embed.h (0 NOLINT, 1 explicit)
      
      * clang-tidy tests/local_bindings.h (0 NOLINT, 4 explicit)
      
      * clang-tidy tests/pybind11_cross_module_tests.cpp (0 NOLINT, 1 explicit)
      
      * clang-tidy tests/pybind11_tests.h (0 NOLINT, 2 explicit)
      
      * clang-tidy tests/test_buffers.cpp (0 NOLINT, 2 explicit)
      
      * clang-tidy tests/test_builtin_casters.cpp (0 NOLINT, 4 explicit)
      
      * clang-tidy tests/test_class.cpp (0 NOLINT, 6 explicit)
      
      * clang-tidy tests/test_copy_move.cpp (0 NOLINT, 7 explicit)
      
      * clang-tidy tests/test_embed/external_module.cpp (0 NOLINT, 1 explicit)
      
      * clang-tidy tests/test_embed/test_interpreter.cpp (0 NOLINT, 1 explicit)
      
      * clang-tidy tests/object.h (0 NOLINT, 2 explicit)
      
      * clang-tidy batch of fully automatic fixes.
      
      * Workaround for MSVC 19.16.27045.0 C++17 Python 2 C++ syntax error.
      6abf2baa
  3. 29 Jul, 2021 1 commit
    • Ralf W. Grosse-Kunstleve's avatar
      Removing MSVC C4100 from pragma block at the top of pybind11.h (#3150) · b72ca7d1
      Ralf W. Grosse-Kunstleve authored
      * Removing pragma for 4100 (to see what is still broken with the latest code).
      
      * Adding --keep-going
      
      * Revert "Adding --keep-going"
      
      This reverts commit 1c844c6ffd07a6111b644811e7e3b0a50b9d44bb.
      
      * Introducing PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100.
      
      * _MSC_VER <= 1916
      
      * Replacing simple variadic function with variadic template (attempt to resolve MSVC 2017 failures).
      
      * Preserving existing comment (moved from pybind11.h to detail/common.h).
      
      * Adding blank lines for readability.
      b72ca7d1
  4. 21 Jun, 2021 1 commit
  5. 08 Jul, 2020 1 commit
  6. 16 Sep, 2017 2 commits
    • Dean Moldovan's avatar
      Use semi-constexpr signatures on MSVC · 56613945
      Dean Moldovan authored
      MSCV does not allow `&typeid(T)` in constexpr contexts, but the string
      part of the type signature can still be constexpr. In order to avoid
      `typeid` as long as possible, `descr` is modified to collect type
      information as template parameters instead of constexpr `typeid`.
      The actual `std::type_info` pointers are only collected in the end,
      as a `constexpr` (gcc/clang) or regular (MSVC) function call.
      
      Not only does it significantly reduce binary size on MSVC, gcc/clang
      benefit a little bit as well, since they can skip some intermediate
      `std::type_info*` arrays.
      56613945
    • Dean Moldovan's avatar
      Make it possible to generate constexpr signatures in C++11 mode · c10ac6cf
      Dean Moldovan authored
      The current C++14 constexpr signatures don't require relaxed constexpr,
      but only `auto` return type deduction. To get around this in C++11,
      the type caster's `name()` static member functions are turned into
      `static constexpr auto` variables.
      c10ac6cf
  7. 17 Aug, 2017 1 commit
  8. 14 Aug, 2017 1 commit
    • Jason Rhinelander's avatar
      Force hidden visibility on pybind code · a859dd67
      Jason Rhinelander authored
      This adds a PYBIND11_NAMESPACE macro that expands to the `pybind11`
      namespace with hidden visibility under gcc-type compilers, and otherwise
      to the plain `pybind11`.  This then forces hidden visibility on
      everything in pybind, solving the visibility issues discussed at end
      end of #949.
      a859dd67
  9. 10 May, 2017 1 commit
    • Jason Rhinelander's avatar
      Fix gcc 7 warning · 7fb01ecd
      Jason Rhinelander authored
      Under gcc 7 with -std=c++11, compilation results in several of the
      following warnings:
      
          In file included from /home/jagerman/src/pybind11/tests/test_sequences_and_iterators.cpp:13:0:
          /home/jagerman/src/pybind11/include/pybind11/operators.h: In function ‘pybind11::detail::op_<(pybind11::detail::op_id)0, (pybind11::detail::op_type)0, pybind11::detail::self_t, pybind11::detail::self_t> pybind11::detail::operator+(const pybind11::detail::self_t&, const pybind11::detail::self_t&)’:
          /home/jagerman/src/pybind11/include/pybind11/operators.h:78:76: warning: inline declaration of ‘pybind11::detail::op_<(pybind11::detail::op_id)0, (pybind11::detail::op_type)0, pybind11::detail::self_t, pybind11::detail::self_t> pybind11::detail::operator+(const pybind11::detail::self_t&, const pybind11::detail::self_t&)’ follows declaration with attribute noinline [-Wattributes]
           inline op_<op_##id, op_l, self_t, self_t> op(const self_t &, const self_t &) {         \
                                                                                      ^
          /home/jagerman/src/pybind11/include/pybind11/operators.h:109:1: note: in expansion of macro ‘PYBIND11_BINARY_OPERATOR’
           PYBIND11_BINARY_OPERATOR(add,       radd,         operator+,    l + r)
           ^~~~~~~~~~~~~~~~~~~~~~~~
          In file included from /home/jagerman/src/pybind11/include/pybind11/cast.h:15:0,
                           from /home/jagerman/src/pybind11/include/pybind11/attr.h:13,
                           from /home/jagerman/src/pybind11/include/pybind11/pybind11.h:36,
                           from /home/jagerman/src/pybind11/tests/pybind11_tests.h:2,
                           from /home/jagerman/src/pybind11/tests/test_sequences_and_iterators.cpp:11:
          /home/jagerman/src/pybind11/include/pybind11/descr.h:116:36: note: previous definition of ‘pybind11::detail::descr pybind11::detail::operator+(pybind11::detail::descr&&, pybind11::detail::descr&&)’ was here
               PYBIND11_NOINLINE descr friend operator+(descr &&d1, descr &&d2) {
                                              ^~~~~~~~
      
      This appears to be happening because gcc is considering implicit
      construction of `descr` in some places using addition of two
      `descr`-compatible arguments in the `descr.h` c++11 fallback code.
      There's no particular reason that this operator needs to be a friend
      function: this commit changes it to an rvalue-context member function
      operator, which avoids the warning.
      7fb01ecd
  10. 09 May, 2017 1 commit
    • Jason Rhinelander's avatar
      Update PYBIND11_CPP1{4,7} macros for MSVC · ca0e82b7
      Jason Rhinelander authored
      The PYBIND11_CPP14 macro started out as a guard for the compile-time
      path code in `descr.h`, but has since come to mean other things.  This
      means that while the `descr.h` check has just checked the
      `PYBIND11_CPP14` macro, various other places now check `PYBIND11_CPP14
      || _MSC_VER`.  This reverses that by now setting the CPP14 macro when
      MSVC is trying to support C++14, but disabling the `descr.h` C++14 code
      (which still fails under MSVC 2017).
      
      The CPP17 macro also gets enabled when MSVC 2017 is compiling with
      /std:c++latest (the default is /std:c++14), which enables
      `std::optional` and `std::variant` support under MSVC.
      ca0e82b7
  11. 07 Dec, 2016 1 commit
    • Jason Rhinelander's avatar
      std::valarray support for stl.h (#545) · ae185b7f
      Jason Rhinelander authored
      * Added ternary support with descr args
      
      Current the `_<bool>(a, b)` ternary support only works for `char[]` `a`
      and `b`; this commit allows it to work for `descr` `a` and `b` arguments
      as well.
      
      * Add support for std::valarray to stl.h
      
      This abstracts the std::array into a `array_caster` which can then be
      used with either std::array or std::valarray, the main difference being
      that std::valarray is resizable.  (It also lets the array_caster be
      potentially used for other std::array-like interfaces, much as the
      list_caster and map_caster currently provide).
      
      * Small stl.h cleanups
      
      - Remove redundant `type` typedefs
      - make internal list_caster methods private
      ae185b7f
  12. 03 Dec, 2016 1 commit
    • Dean Moldovan's avatar
      Use C++14 index_sequence when possible · 8c85a857
      Dean Moldovan authored
      Newer standard libraries use compiler intrinsics for std::index_sequence
      which makes it ‘free’. This prevents hitting instantiation limits for
      recursive templates (-ftemplate-depth).
      8c85a857
  13. 04 Nov, 2016 1 commit
    • Jason Rhinelander's avatar
      <optional> requires -std=c++17 (#479) · f1b44a05
      Jason Rhinelander authored
      There are now more places than just descr.h that make use of these.
      The new macro isn't quite the same: the old one only tested for a
      couple features, while the new one checks for the __cplusplus version
      (but doesn't even try to enable C++14 for MSVC/ICC).
      
      g++ 7 adds <optional>, but including it in C++14 mode isn't allowed
      (just as including <experimental/optional> isn't allowed in C++11 mode).
      (This wasn't triggered in g++-6 because it doesn't provide <optional>
      yet.)
      f1b44a05
  14. 19 Sep, 2016 1 commit
  15. 07 Sep, 2016 1 commit
  16. 13 Aug, 2016 1 commit
  17. 19 Jul, 2016 1 commit
  18. 06 Jul, 2016 1 commit
    • Jason Rhinelander's avatar
      Add _<bool>("s1", "s2") ternary & use TYPE_CASTER · 8469f751
      Jason Rhinelander authored
      This commit adds an additional _ template function for compile-time
      selection between two description strings.  This in turn allows the
      elimination of needing two name() methods in type_caster<arithmetic
      types> and type_caster<eigen types>, which allows them to start using
      PYBIND11_TYPE_CASTER instead, simplifying their code by eliminating all
      the code that they are duplicating from the macro.
      8469f751
  19. 01 Jun, 2016 1 commit
  20. 18 Apr, 2016 1 commit
  21. 07 Feb, 2016 1 commit
  22. 17 Jan, 2016 1 commit
    • Wenzel Jakob's avatar
      Much more efficient generation of function signatures, updated docs · 66c9a402
      Wenzel Jakob authored
      This modification taps into some newer C++14 features (if present) to
      generate function signatures considerably more efficiently at compile
      time rather than at run time.
      
      With this change, pybind11 binaries are now *2.1 times* smaller compared
      to the Boost.Python baseline in the benchmark. Compilation times get a
      nice improvement as well.
      
      Visual Studio 2015 unfortunately doesn't implement 'constexpr' well
      enough yet to support this change and uses a runtime fallback.
      66c9a402