mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
update single and improve safety config documentation
This commit is contained in:
parent
f701fd2de7
commit
017b2cfac1
@ -47,6 +47,10 @@ Safety Config
|
|||||||
* Affects nearly the entire library for safety (with some blind spots covered by the other definitions)
|
* Affects nearly the entire library for safety (with some blind spots covered by the other definitions)
|
||||||
* **Not** turned on by default under any settings: *this MUST be turned on manually*
|
* **Not** turned on by default under any settings: *this MUST be turned on manually*
|
||||||
|
|
||||||
|
``SOL_ALL_SAFETIES_ON`` triggers the following changes:
|
||||||
|
* If ``SOL_SAFE_USERTYPE``, ``SOL_SAFE_REFERENCES``, ``SOL_SAFE_FUNCTION``, ``SOL_SAFE_NUMERICS``, ``SOL_SAFE_GETTER``, and ``SOL_SAFE_FUNCTION_CALLS`` are not defined, they get defined and the effects described above kick in
|
||||||
|
* **Not** turned on by default under any settings: *this MUST be turned on manually*
|
||||||
|
|
||||||
``SOL_DEFAULT_PASS_ON_ERROR`` triggers the following changes:
|
``SOL_DEFAULT_PASS_ON_ERROR`` triggers the following changes:
|
||||||
* The default error handler for ``sol::state_view::script_`` functions is ``sol::script_pass_on_error`` rather than ``sol::script_throw_on_error``
|
* The default error handler for ``sol::state_view::script_`` functions is ``sol::script_pass_on_error`` rather than ``sol::script_throw_on_error``
|
||||||
* Passes errors on through: **very dangerous** as you can ignore or never be warned about errors if you don't catch the return value of specific functions
|
* Passes errors on through: **very dangerous** as you can ignore or never be warned about errors if you don't catch the return value of specific functions
|
||||||
@ -54,10 +58,6 @@ Safety Config
|
|||||||
* Don't turn this on unless you have an extremely good reason
|
* Don't turn this on unless you have an extremely good reason
|
||||||
* *DON'T TURN THIS ON UNLESS YOU HAVE AN EXTREMELY GOOD REASON*
|
* *DON'T TURN THIS ON UNLESS YOU HAVE AN EXTREMELY GOOD REASON*
|
||||||
|
|
||||||
``SOL_ALL_SAFETIES_ON`` triggers the following changes:
|
|
||||||
* If ``SOL_SAFE_USERTYPE``, ``SOL_SAFE_REFERENCES``, ``SOL_SAFE_FUNCTION``, ``SOL_SAFE_NUMERICS``, ``SOL_SAFE_GETTER``, and ``SOL_SAFE_FUNCTION_CALLS`` are not defined, they get defined and the effects described above kick in
|
|
||||||
* **Not** turned on by default under any settings: *this MUST be turned on manually*
|
|
||||||
|
|
||||||
``SOL_NO_CHECK_NUMBER_PRECISION`` triggers the following changes:
|
``SOL_NO_CHECK_NUMBER_PRECISION`` triggers the following changes:
|
||||||
* If ``SOL_SAFE_NUMERICS`` is defined, turns off number precision and integer precision fitting when pushing numbers into sol2
|
* If ``SOL_SAFE_NUMERICS`` is defined, turns off number precision and integer precision fitting when pushing numbers into sol2
|
||||||
* **Not** turned on by default under any settings: *this MUST be turned on manually*
|
* **Not** turned on by default under any settings: *this MUST be turned on manually*
|
||||||
@ -72,6 +72,10 @@ Safety Config
|
|||||||
* Overrides safety and always applies if it is turned on
|
* Overrides safety and always applies if it is turned on
|
||||||
* **Not** turned on by default under any settings: *this MUST be turned on manually*
|
* **Not** turned on by default under any settings: *this MUST be turned on manually*
|
||||||
|
|
||||||
|
``SOL_CHECK_ARGUMENTS`` is a deprecated define that will be removed soon:
|
||||||
|
* It is simply an alias for ``SOL_ALL_SAFETIES_ON``
|
||||||
|
* Please change all your code to use ``SOL_ALL_SAFETIES_ON``
|
||||||
|
|
||||||
.. _config-feature:
|
.. _config-feature:
|
||||||
|
|
||||||
Feature Config
|
Feature Config
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include <sol/sol.hpp>
|
#include <sol/sol.hpp>
|
||||||
|
|
||||||
#include "assert.hpp"
|
#include "assert.hpp"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
void create_namespace_sf(sol::state& lua) {
|
void create_namespace_sf(sol::state& lua) {
|
||||||
// this would explode
|
// this would explode
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// This file was generated with a script.
|
// This file was generated with a script.
|
||||||
// Generated 2019-05-21 07:55:59.916335 UTC
|
// Generated 2019-05-21 23:28:10.944171 UTC
|
||||||
// This header was generated with sol v3.0.1-beta2 (revision ad1b966)
|
// This header was generated with sol v3.0.2 (revision f701fd2)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||||
@ -99,6 +99,12 @@
|
|||||||
|
|
||||||
#endif // vc++ || clang++/g++
|
#endif // vc++ || clang++/g++
|
||||||
|
|
||||||
|
#if defined(SOL_CHECK_ARGUMENTS) && SOL_CHECK_ARGUMENTS
|
||||||
|
#if defined(SOL_ALL_SAFETIES_ON)
|
||||||
|
#define SOL_ALL_SAFETIES_ON 1
|
||||||
|
#endif // turn all the safeties on
|
||||||
|
#endif // Compatibility define
|
||||||
|
|
||||||
#if defined(SOL_ALL_SAFETIES_ON) && SOL_ALL_SAFETIES_ON
|
#if defined(SOL_ALL_SAFETIES_ON) && SOL_ALL_SAFETIES_ON
|
||||||
|
|
||||||
// Checks low-level getter function
|
// Checks low-level getter function
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// This file was generated with a script.
|
// This file was generated with a script.
|
||||||
// Generated 2019-05-21 07:55:59.198915 UTC
|
// Generated 2019-05-21 23:28:10.673891 UTC
|
||||||
// This header was generated with sol v3.0.1-beta2 (revision ad1b966)
|
// This header was generated with sol v3.0.2 (revision f701fd2)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||||
@ -126,6 +126,12 @@
|
|||||||
#endif // vc++ || clang++/g++
|
#endif // vc++ || clang++/g++
|
||||||
|
|
||||||
#if defined(SOL_CHECK_ARGUMENTS) && SOL_CHECK_ARGUMENTS
|
#if defined(SOL_CHECK_ARGUMENTS) && SOL_CHECK_ARGUMENTS
|
||||||
|
#if defined(SOL_ALL_SAFETIES_ON)
|
||||||
|
#define SOL_ALL_SAFETIES_ON 1
|
||||||
|
#endif // turn all the safeties on
|
||||||
|
#endif // Compatibility define
|
||||||
|
|
||||||
|
#if defined(SOL_ALL_SAFETIES_ON) && SOL_ALL_SAFETIES_ON
|
||||||
|
|
||||||
// Checks low-level getter function
|
// Checks low-level getter function
|
||||||
// (and thusly, affects nearly entire framework)
|
// (and thusly, affects nearly entire framework)
|
||||||
@ -4726,7 +4732,7 @@ namespace sol {
|
|||||||
/// \exclude
|
/// \exclude
|
||||||
constexpr optional(const T& u) : base(in_place, u) {
|
constexpr optional(const T& u) : base(in_place, u) {
|
||||||
}
|
}
|
||||||
#endif // sol2 modification
|
#endif // sol3 modification
|
||||||
|
|
||||||
/// Converting copy constructor.
|
/// Converting copy constructor.
|
||||||
/// \synopsis template <class U> optional(const optional<U> &rhs);
|
/// \synopsis template <class U> optional(const optional<U> &rhs);
|
||||||
@ -11818,7 +11824,7 @@ namespace sol { namespace stack {
|
|||||||
// Because additional lambdas / functions which serve as
|
// Because additional lambdas / functions which serve as
|
||||||
// capture-all-and-then-invoke bloat binary sizes
|
// capture-all-and-then-invoke bloat binary sizes
|
||||||
// by an actually detectable amount
|
// by an actually detectable amount
|
||||||
// (one user uses sol3 pretty heavily and 22 MB of binary size
|
// (one user uses sol2 pretty heavily and 22 MB of binary size
|
||||||
// was saved by reducing reliance on lambdas in templates)
|
// was saved by reducing reliance on lambdas in templates)
|
||||||
|
|
||||||
// This would really be solved by having break N;
|
// This would really be solved by having break N;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user