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
|
||||
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_compile_options(/W4 /EHsc)
|
||||
# Warning level, exceptions, compile-multiple-files
|
||||
add_compile_options(/W4 /EHsc /MP)
|
||||
else()
|
||||
add_compile_options(-Wno-unknown-warning -Wno-unknown-warning-option -Wall -Wextra -Wpedantic -pedantic -pedantic-errors)
|
||||
endif()
|
||||
|
|
27
appveyor.yml
27
appveyor.yml
|
@ -35,11 +35,16 @@ environment:
|
|||
matrix:
|
||||
- LUA_VERSION: 5.3.4
|
||||
MINGW_VERSION: 6.3.0
|
||||
PARALLELISM:
|
||||
- LUA_VERSION: 5.3.4
|
||||
MINGW_VERSION: 5.3.0
|
||||
PARALLELISM:
|
||||
- LUA_VERSION: 5.3.4
|
||||
PARALLELISM: -- /maxcpucount
|
||||
- LUA_VERSION: 5.2.4
|
||||
PARALLELISM: -- /maxcpucount
|
||||
- LUA_VERSION: 5.1.5
|
||||
PARALLELISM: -- /maxcpucount
|
||||
|
||||
platform:
|
||||
- x86
|
||||
|
@ -52,22 +57,23 @@ matrix:
|
|||
# 32-bit builds are temperamental with exceptions
|
||||
- platform: x86
|
||||
exclude:
|
||||
- platform: x86
|
||||
LUA_VERSION: 5.2.4
|
||||
- platform: x86
|
||||
LUA_VERSION: 5.1.5
|
||||
- platform: x86
|
||||
MINGW_VERSION: 6.3.0
|
||||
# Necessary: MinGW doesn't exist on VS 2017 images
|
||||
- image: Visual Studio 2017
|
||||
MINGW_VERSION: 6.3.0
|
||||
- image: Visual Studio 2017
|
||||
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
|
||||
LUA_VERSION: 5.1.5
|
||||
- image: Visual Studio 2015
|
||||
LUA_VERSION: 5.2.4
|
||||
- image: Visual Studio 2015
|
||||
platform: x86
|
||||
|
||||
init:
|
||||
# make sure we have Ninja
|
||||
|
@ -101,6 +107,7 @@ before_build:
|
|||
- set python_path=C:\Python36
|
||||
- set mingw_path=
|
||||
- set build_type=
|
||||
- set parallelism=
|
||||
- if "%CMAKE_GENERATOR%"=="MinGW Makefiles" (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)
|
||||
|
@ -116,8 +123,8 @@ before_build:
|
|||
# generates too much debug info for MinGW to handle
|
||||
# TODO: fix the damn compilation space and time already
|
||||
build_script:
|
||||
- if NOT "%build_type%"=="-DCMAKE_BUILD_TYPE=Release" (cmake --build . --config Debug)
|
||||
- cmake --build . --config Release
|
||||
- if NOT "%build_type%"=="-DCMAKE_BUILD_TYPE=Release" (cmake --build . --config Debug %PARALLELISM%)
|
||||
- cmake --build . --config Release %PARALLELISM%
|
||||
|
||||
test_script:
|
||||
- if NOT "%build_type%"=="-DCMAKE_BUILD_TYPE=Release" (ctest -C Debug --output-on-failure)
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#ifndef MY_ASSERT_HPP
|
||||
#define MY_ASSERT_HPP
|
||||
#ifndef EXAMPLES_ASSERT_HPP
|
||||
#define EXAMPLES_ASSERT_HPP
|
||||
|
||||
#ifndef NDEBUG
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
|
||||
# define m_assert(condition, message) \
|
||||
do { \
|
||||
if (! (condition)) { \
|
||||
|
@ -20,11 +23,8 @@
|
|||
} \
|
||||
} 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
|
||||
#endif // EXAMPLES_ASSERT_HPP
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
#include <LuaBridge/LuaBridge.h>
|
||||
|
||||
#include <iostream>
|
||||
#include "assert.hpp"
|
||||
#include "../assert.hpp"
|
||||
|
||||
// LuaBridge,
|
||||
// no longer maintained by VinnieFalco:
|
||||
// no longer maintained, by VinnieFalco:
|
||||
// https://github.com/vinniefalco/LuaBridge
|
||||
|
||||
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 <iostream>
|
||||
#include "assert.hpp"
|
||||
#include "../assert.hpp"
|
||||
|
||||
// kaguya code lifted from README.md,
|
||||
// written by satoren:
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <luwra.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include "assert.hpp"
|
||||
#include "../assert.hpp"
|
||||
|
||||
// luwra,
|
||||
// another C++ wrapper library:
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "tolua_Player.h"
|
||||
|
||||
#include <iostream>
|
||||
#include "assert.hpp"
|
||||
#include "../assert.hpp"
|
||||
|
||||
// tolua code lifted from some blog, if the link dies
|
||||
// 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 "my_object.hpp"
|
||||
#include "assert.hpp"
|
||||
#include "../assert.hpp"
|
||||
|
||||
#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
|
||||
#include <sol.hpp>
|
||||
|
||||
#include "assert.hpp"
|
||||
#include "../../assert.hpp"
|
||||
#include <iostream>
|
||||
|
||||
void some_function() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define SOL_CHECK_ARGUMENTS 1
|
||||
#include <sol.hpp>
|
||||
|
||||
#include "assert.hpp"
|
||||
#include "../../assert.hpp"
|
||||
|
||||
int main(int, char*[]) {
|
||||
sol::state lua;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define SOL_CHECK_ARGUMENTS 1
|
||||
#include <sol.hpp>
|
||||
|
||||
#include "assert.hpp"
|
||||
#include "../../assert.hpp"
|
||||
|
||||
int main(int, char* []) {
|
||||
sol::state lua;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define SOL_CHECK_ARGUMENTS 1
|
||||
#include <sol.hpp>
|
||||
|
||||
#include "assert.hpp"
|
||||
#include "../../assert.hpp"
|
||||
|
||||
int main(int, char* []) {
|
||||
sol::state lua;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define SOL_CHECK_ARGUMENTS 1
|
||||
#include <sol.hpp>
|
||||
|
||||
#include "assert.hpp"
|
||||
#include "../../assert.hpp"
|
||||
|
||||
int main(int, char* []) {
|
||||
sol::state lua;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <sol.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include "assert.hpp"
|
||||
#include "../../assert.hpp"
|
||||
|
||||
int main() {
|
||||
std::cout << "=== namespacing example ===" << std::endl;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <sol.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include "assert.hpp"
|
||||
#include "../../assert.hpp"
|
||||
|
||||
int main(int, char*[]) {
|
||||
std::cout << "=== opening a state example ===" << std::endl;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include "assert.hpp"
|
||||
#include "../../assert.hpp"
|
||||
|
||||
int main(int, char*[]) {
|
||||
std::cout << "=== running lua code example ===" << std::endl;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include "assert.hpp"
|
||||
#include "../../assert.hpp"
|
||||
|
||||
int main(int, char*[]) {
|
||||
std::cout << "=== running lua code (low level) example ===" << std::endl;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define SOL_CHECK_ARGUMENTS 1
|
||||
#include <sol.hpp>
|
||||
|
||||
#include "assert.hpp"
|
||||
#include "../../assert.hpp"
|
||||
|
||||
int main(int, char*[]) {
|
||||
sol::state lua;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define SOL_CHECK_ARGUMENTS 1
|
||||
#include <sol.hpp>
|
||||
|
||||
#include "assert.hpp"
|
||||
#include "../../assert.hpp"
|
||||
|
||||
int main(int, char*[]) {
|
||||
sol::state lua;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define SOL_CHECK_ARGUMENTS 1
|
||||
#include <sol.hpp>
|
||||
|
||||
#include "assert.hpp"
|
||||
#include "../../assert.hpp"
|
||||
|
||||
int main(int, char*[]) {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define SOL_CHECK_ARGUMENTS 1
|
||||
#include <sol.hpp>
|
||||
|
||||
#include "assert.hpp"
|
||||
#include "../../assert.hpp"
|
||||
#include <iostream>
|
||||
|
||||
struct Doge {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define SOL_CHECK_ARGUMENTS 1
|
||||
#include <sol.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include "../assert.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main(int, char*[]) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user