update single and improve safety config documentation

This commit is contained in:
ThePhD 2019-05-21 21:28:18 -04:00
parent f701fd2de7
commit 017b2cfac1
No known key found for this signature in database
GPG Key ID: 1509DB1C0F702BFA
4 changed files with 27 additions and 10 deletions

View File

@ -47,6 +47,10 @@ Safety Config
* 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*
``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:
* 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
@ -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*
``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:
* 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*
@ -72,6 +72,10 @@ Safety Config
* Overrides safety and always applies if it is turned on
* **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:
Feature Config

View File

@ -2,6 +2,7 @@
#include <sol/sol.hpp>
#include "assert.hpp"
#include <iostream>
void create_namespace_sf(sol::state& lua) {
// this would explode

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script.
// Generated 2019-05-21 07:55:59.916335 UTC
// This header was generated with sol v3.0.1-beta2 (revision ad1b966)
// Generated 2019-05-21 23:28:10.944171 UTC
// This header was generated with sol v3.0.2 (revision f701fd2)
// https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
@ -99,6 +99,12 @@
#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
// Checks low-level getter function

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script.
// Generated 2019-05-21 07:55:59.198915 UTC
// This header was generated with sol v3.0.1-beta2 (revision ad1b966)
// Generated 2019-05-21 23:28:10.673891 UTC
// This header was generated with sol v3.0.2 (revision f701fd2)
// https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP
@ -126,6 +126,12 @@
#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
// Checks low-level getter function
// (and thusly, affects nearly entire framework)
@ -4726,7 +4732,7 @@ namespace sol {
/// \exclude
constexpr optional(const T& u) : base(in_place, u) {
}
#endif // sol2 modification
#endif // sol3 modification
/// Converting copy constructor.
/// \synopsis template <class U> optional(const optional<U> &rhs);
@ -11818,7 +11824,7 @@ namespace sol { namespace stack {
// Because additional lambdas / functions which serve as
// capture-all-and-then-invoke bloat binary sizes
// 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)
// This would really be solved by having break N;