mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
update assert implementation
This commit is contained in:
parent
002303d52b
commit
6000dcd490
|
@ -53,7 +53,8 @@ set(CXX_FEATURES
|
||||||
# # # General project flags
|
# # # General project flags
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
add_definitions(/DUNICODE /D_UNICODE /D_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING /D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
|
add_definitions(/DUNICODE /D_UNICODE /D_SILENCE_CXX17_UNCAUGHT_EXCEPTION_DEPRECATION_WARNING /D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING /D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_DEPRECATE)
|
||||||
add_compile_options(/W4 /EHsc)
|
# Warning level, exceptions, compile-multiple-files
|
||||||
|
add_compile_options(/W4 /EHsc /MP)
|
||||||
else()
|
else()
|
||||||
add_compile_options(-Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
|
add_compile_options(-Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
|
||||||
endif()
|
endif()
|
||||||
|
|
27
appveyor.yml
27
appveyor.yml
|
@ -35,11 +35,16 @@ environment:
|
||||||
matrix:
|
matrix:
|
||||||
- LUA_VERSION: 5.3.4
|
- LUA_VERSION: 5.3.4
|
||||||
MINGW_VERSION: 6.3.0
|
MINGW_VERSION: 6.3.0
|
||||||
|
PARALLELISM:
|
||||||
- LUA_VERSION: 5.3.4
|
- LUA_VERSION: 5.3.4
|
||||||
MINGW_VERSION: 5.3.0
|
MINGW_VERSION: 5.3.0
|
||||||
|
PARALLELISM:
|
||||||
- LUA_VERSION: 5.3.4
|
- LUA_VERSION: 5.3.4
|
||||||
|
PARALLELISM: -- /maxcpucount
|
||||||
- LUA_VERSION: 5.2.4
|
- LUA_VERSION: 5.2.4
|
||||||
|
PARALLELISM: -- /maxcpucount
|
||||||
- LUA_VERSION: 5.1.5
|
- LUA_VERSION: 5.1.5
|
||||||
|
PARALLELISM: -- /maxcpucount
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
- x86
|
- x86
|
||||||
|
@ -52,22 +57,23 @@ matrix:
|
||||||
# 32-bit builds are temperamental with exceptions
|
# 32-bit builds are temperamental with exceptions
|
||||||
- platform: x86
|
- platform: x86
|
||||||
exclude:
|
exclude:
|
||||||
- platform: x86
|
# Necessary: MinGW doesn't exist on VS 2017 images
|
||||||
LUA_VERSION: 5.2.4
|
|
||||||
- platform: x86
|
|
||||||
LUA_VERSION: 5.1.5
|
|
||||||
- platform: x86
|
|
||||||
MINGW_VERSION: 6.3.0
|
|
||||||
- image: Visual Studio 2017
|
- image: Visual Studio 2017
|
||||||
MINGW_VERSION: 6.3.0
|
MINGW_VERSION: 6.3.0
|
||||||
- image: Visual Studio 2017
|
- image: Visual Studio 2017
|
||||||
MINGW_VERSION: 5.3.0
|
MINGW_VERSION: 5.3.0
|
||||||
|
# Get rid of x86 builds
|
||||||
|
- platform: x86
|
||||||
|
LUA_VERSION: 5.2.4
|
||||||
|
- platform: x86
|
||||||
|
LUA_VERSION: 5.1.5
|
||||||
|
- platform: x86
|
||||||
|
MINGW_VERSION: 5.3.0
|
||||||
|
# Get rid of redundant Visual Studio 2015 builds
|
||||||
- image: Visual Studio 2015
|
- image: Visual Studio 2015
|
||||||
LUA_VERSION: 5.1.5
|
LUA_VERSION: 5.1.5
|
||||||
- image: Visual Studio 2015
|
- image: Visual Studio 2015
|
||||||
LUA_VERSION: 5.2.4
|
LUA_VERSION: 5.2.4
|
||||||
- image: Visual Studio 2015
|
|
||||||
platform: x86
|
|
||||||
|
|
||||||
init:
|
init:
|
||||||
# make sure we have Ninja
|
# make sure we have Ninja
|
||||||
|
@ -101,6 +107,7 @@ before_build:
|
||||||
- set python_path=C:\Python36
|
- set python_path=C:\Python36
|
||||||
- set mingw_path=
|
- set mingw_path=
|
||||||
- set build_type=
|
- set build_type=
|
||||||
|
- set parallelism=
|
||||||
- if "%CMAKE_GENERATOR%"=="MinGW Makefiles" (set build_type=-DCMAKE_BUILD_TYPE=Release)
|
- if "%CMAKE_GENERATOR%"=="MinGW Makefiles" (set build_type=-DCMAKE_BUILD_TYPE=Release)
|
||||||
- if "%CMAKE_GENERATOR%"=="Ninja" (set build_type=-DCMAKE_BUILD_TYPE=Release)
|
- if "%CMAKE_GENERATOR%"=="Ninja" (set build_type=-DCMAKE_BUILD_TYPE=Release)
|
||||||
- if "%MINGW_VERSION%"=="5.3.0" (set mingw_path=C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0)
|
- if "%MINGW_VERSION%"=="5.3.0" (set mingw_path=C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0)
|
||||||
|
@ -116,8 +123,8 @@ before_build:
|
||||||
# generates too much debug info for MinGW to handle
|
# generates too much debug info for MinGW to handle
|
||||||
# TODO: fix the damn compilation space and time already
|
# TODO: fix the damn compilation space and time already
|
||||||
build_script:
|
build_script:
|
||||||
- if NOT "%build_type%"=="-DCMAKE_BUILD_TYPE=Release" (cmake --build . --config Debug)
|
- if NOT "%build_type%"=="-DCMAKE_BUILD_TYPE=Release" (cmake --build . --config Debug %PARALLELISM%)
|
||||||
- cmake --build . --config Release
|
- cmake --build . --config Release %PARALLELISM%
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- if NOT "%build_type%"=="-DCMAKE_BUILD_TYPE=Release" (ctest -C Debug --output-on-failure)
|
- if NOT "%build_type%"=="-DCMAKE_BUILD_TYPE=Release" (ctest -C Debug --output-on-failure)
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
#ifndef MY_ASSERT_HPP
|
#ifndef EXAMPLES_ASSERT_HPP
|
||||||
#define MY_ASSERT_HPP
|
#define EXAMPLES_ASSERT_HPP
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
#include <exception>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
# define m_assert(condition, message) \
|
# define m_assert(condition, message) \
|
||||||
do { \
|
do { \
|
||||||
if (! (condition)) { \
|
if (! (condition)) { \
|
||||||
|
@ -20,11 +23,8 @@
|
||||||
} \
|
} \
|
||||||
} while (false)
|
} while (false)
|
||||||
#else
|
#else
|
||||||
#include <exception>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
# define m_c_assert(condition, message) do { (void)sizeof(condition); (void)sizeof(message); } while (false)
|
# define m_c_assert(condition, message) do { (void)sizeof(condition); (void)sizeof(message); } while (false)
|
||||||
# define c_assert(condition) do { (void)sizeof(condition); } while (false)
|
# define c_assert(condition) do { (void)sizeof(condition); } while (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // MY_ASSERT_HPP
|
#endif // EXAMPLES_ASSERT_HPP
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
#include <LuaBridge/LuaBridge.h>
|
#include <LuaBridge/LuaBridge.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "assert.hpp"
|
#include "../assert.hpp"
|
||||||
|
|
||||||
// LuaBridge,
|
// LuaBridge,
|
||||||
// no longer maintained by VinnieFalco:
|
// no longer maintained, by VinnieFalco:
|
||||||
// https://github.com/vinniefalco/LuaBridge
|
// https://github.com/vinniefalco/LuaBridge
|
||||||
|
|
||||||
struct A {
|
struct A {
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
#ifndef MY_ASSERT_HPP
|
|
||||||
#define MY_ASSERT_HPP
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
# define m_assert(condition, message) \
|
|
||||||
do { \
|
|
||||||
if (! (condition)) { \
|
|
||||||
std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \
|
|
||||||
<< " line " << __LINE__ << ": " << message << std::endl; \
|
|
||||||
std::terminate(); \
|
|
||||||
} \
|
|
||||||
} while (false)
|
|
||||||
|
|
||||||
# define c_assert(condition) \
|
|
||||||
do { \
|
|
||||||
if (! (condition)) { \
|
|
||||||
std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \
|
|
||||||
<< " line " << __LINE__ << std::endl; \
|
|
||||||
std::terminate(); \
|
|
||||||
} \
|
|
||||||
} while (false)
|
|
||||||
#else
|
|
||||||
#include <exception>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
# define m_c_assert(condition, message) do { (void)sizeof(condition); (void)sizeof(message); } while (false)
|
|
||||||
# define c_assert(condition) do { (void)sizeof(condition); } while (false)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // MY_ASSERT_HPP
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <kaguya/kaguya.hpp>
|
#include <kaguya/kaguya.hpp>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "assert.hpp"
|
#include "../assert.hpp"
|
||||||
|
|
||||||
// kaguya code lifted from README.md,
|
// kaguya code lifted from README.md,
|
||||||
// written by satoren:
|
// written by satoren:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <luwra.hpp>
|
#include <luwra.hpp>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "assert.hpp"
|
#include "../assert.hpp"
|
||||||
|
|
||||||
// luwra,
|
// luwra,
|
||||||
// another C++ wrapper library:
|
// another C++ wrapper library:
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "tolua_Player.h"
|
#include "tolua_Player.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "assert.hpp"
|
#include "../assert.hpp"
|
||||||
|
|
||||||
// tolua code lifted from some blog, if the link dies
|
// tolua code lifted from some blog, if the link dies
|
||||||
// I don't know where else you're gonna find the reference,
|
// I don't know where else you're gonna find the reference,
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
#ifndef MY_ASSERT_HPP
|
|
||||||
#define MY_ASSERT_HPP
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
# define m_assert(condition, message) \
|
|
||||||
do { \
|
|
||||||
if (! (condition)) { \
|
|
||||||
std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \
|
|
||||||
<< " line " << __LINE__ << ": " << message << std::endl; \
|
|
||||||
std::terminate(); \
|
|
||||||
} \
|
|
||||||
} while (false)
|
|
||||||
|
|
||||||
# define c_assert(condition) \
|
|
||||||
do { \
|
|
||||||
if (! (condition)) { \
|
|
||||||
std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \
|
|
||||||
<< " line " << __LINE__ << std::endl; \
|
|
||||||
std::terminate(); \
|
|
||||||
} \
|
|
||||||
} while (false)
|
|
||||||
#else
|
|
||||||
#include <exception>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
# define m_c_assert(condition, message) do { (void)sizeof(condition); (void)sizeof(message); } while (false)
|
|
||||||
# define c_assert(condition) do { (void)sizeof(condition); } while (false)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // MY_ASSERT_HPP
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|
||||||
#include "my_object.hpp"
|
#include "my_object.hpp"
|
||||||
#include "assert.hpp"
|
#include "../assert.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
#ifndef MY_ASSERT_HPP
|
|
||||||
#define MY_ASSERT_HPP
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
# define m_assert(condition, message) \
|
|
||||||
do { \
|
|
||||||
if (! (condition)) { \
|
|
||||||
std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \
|
|
||||||
<< " line " << __LINE__ << ": " << message << std::endl; \
|
|
||||||
std::terminate(); \
|
|
||||||
} \
|
|
||||||
} while (false)
|
|
||||||
|
|
||||||
# define c_assert(condition) \
|
|
||||||
do { \
|
|
||||||
if (! (condition)) { \
|
|
||||||
std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \
|
|
||||||
<< " line " << __LINE__ << std::endl; \
|
|
||||||
std::terminate(); \
|
|
||||||
} \
|
|
||||||
} while (false)
|
|
||||||
#else
|
|
||||||
#include <exception>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
# define m_c_assert(condition, message) do { (void)sizeof(condition); (void)sizeof(message); } while (false)
|
|
||||||
# define c_assert(condition) do { (void)sizeof(condition); } while (false)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // MY_ASSERT_HPP
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define SOL_CHECK_ARGUMENTS 1
|
#define SOL_CHECK_ARGUMENTS 1
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|
||||||
#include "assert.hpp"
|
#include "../../assert.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
void some_function() {
|
void some_function() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define SOL_CHECK_ARGUMENTS 1
|
#define SOL_CHECK_ARGUMENTS 1
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|
||||||
#include "assert.hpp"
|
#include "../../assert.hpp"
|
||||||
|
|
||||||
int main(int, char*[]) {
|
int main(int, char*[]) {
|
||||||
sol::state lua;
|
sol::state lua;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define SOL_CHECK_ARGUMENTS 1
|
#define SOL_CHECK_ARGUMENTS 1
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|
||||||
#include "assert.hpp"
|
#include "../../assert.hpp"
|
||||||
|
|
||||||
int main(int, char* []) {
|
int main(int, char* []) {
|
||||||
sol::state lua;
|
sol::state lua;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define SOL_CHECK_ARGUMENTS 1
|
#define SOL_CHECK_ARGUMENTS 1
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|
||||||
#include "assert.hpp"
|
#include "../../assert.hpp"
|
||||||
|
|
||||||
int main(int, char* []) {
|
int main(int, char* []) {
|
||||||
sol::state lua;
|
sol::state lua;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define SOL_CHECK_ARGUMENTS 1
|
#define SOL_CHECK_ARGUMENTS 1
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|
||||||
#include "assert.hpp"
|
#include "../../assert.hpp"
|
||||||
|
|
||||||
int main(int, char* []) {
|
int main(int, char* []) {
|
||||||
sol::state lua;
|
sol::state lua;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "assert.hpp"
|
#include "../../assert.hpp"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
std::cout << "=== namespacing example ===" << std::endl;
|
std::cout << "=== namespacing example ===" << std::endl;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "assert.hpp"
|
#include "../../assert.hpp"
|
||||||
|
|
||||||
int main(int, char*[]) {
|
int main(int, char*[]) {
|
||||||
std::cout << "=== opening a state example ===" << std::endl;
|
std::cout << "=== opening a state example ===" << std::endl;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "assert.hpp"
|
#include "../../assert.hpp"
|
||||||
|
|
||||||
int main(int, char*[]) {
|
int main(int, char*[]) {
|
||||||
std::cout << "=== running lua code example ===" << std::endl;
|
std::cout << "=== running lua code example ===" << std::endl;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include "assert.hpp"
|
#include "../../assert.hpp"
|
||||||
|
|
||||||
int main(int, char*[]) {
|
int main(int, char*[]) {
|
||||||
std::cout << "=== running lua code (low level) example ===" << std::endl;
|
std::cout << "=== running lua code (low level) example ===" << std::endl;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define SOL_CHECK_ARGUMENTS 1
|
#define SOL_CHECK_ARGUMENTS 1
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|
||||||
#include "assert.hpp"
|
#include "../../assert.hpp"
|
||||||
|
|
||||||
int main(int, char*[]) {
|
int main(int, char*[]) {
|
||||||
sol::state lua;
|
sol::state lua;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define SOL_CHECK_ARGUMENTS 1
|
#define SOL_CHECK_ARGUMENTS 1
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|
||||||
#include "assert.hpp"
|
#include "../../assert.hpp"
|
||||||
|
|
||||||
int main(int, char*[]) {
|
int main(int, char*[]) {
|
||||||
sol::state lua;
|
sol::state lua;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define SOL_CHECK_ARGUMENTS 1
|
#define SOL_CHECK_ARGUMENTS 1
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|
||||||
#include "assert.hpp"
|
#include "../../assert.hpp"
|
||||||
|
|
||||||
int main(int, char*[]) {
|
int main(int, char*[]) {
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define SOL_CHECK_ARGUMENTS 1
|
#define SOL_CHECK_ARGUMENTS 1
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|
||||||
#include "assert.hpp"
|
#include "../../assert.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
struct Doge {
|
struct Doge {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define SOL_CHECK_ARGUMENTS 1
|
#define SOL_CHECK_ARGUMENTS 1
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|
||||||
#include <cassert>
|
#include "../assert.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main(int, char*[]) {
|
int main(int, char*[]) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user