diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/wave/test | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
253 files changed, 16214 insertions, 0 deletions
diff --git a/src/boost/libs/wave/test/Jamfile b/src/boost/libs/wave/test/Jamfile new file mode 100644 index 000000000..d840874d4 --- /dev/null +++ b/src/boost/libs/wave/test/Jamfile @@ -0,0 +1,3 @@ +import testing ; + +build-project build ; diff --git a/src/boost/libs/wave/test/build/Jamfile.v2 b/src/boost/libs/wave/test/build/Jamfile.v2 new file mode 100644 index 000000000..ddbd5d666 --- /dev/null +++ b/src/boost/libs/wave/test/build/Jamfile.v2 @@ -0,0 +1,177 @@ +# Boost.Wave: A Standard compliant C++ preprocessor library +# +# Boost Wave Library Test Jamfile +# +# http://www.boost.org/ +# +# Copyright (c) 2001-2011 Hartmut Kaiser. Distributed under the Boost +# Software License, Version 1.0. (See accompanying file +# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + +# +# These are the sources to compile for the testwave application +# +SOURCES_STATIC = testwave testwave_app + ; + +SOURCES_DYNAMIC = testwave_dll testwave_app_dll + ; + +SOURCES = $(SOURCE_STATIC) $(SOURCES_DYNAMIC) + ; + +path-constant TESTWAVE_DIR : $(BOOST_ROOT)/libs/wave/test/testwave/testfiles + ; + +# +# This are the arguments for the testwave executable +# +TESTWAVE_ARGUMENTS = + -d4 # use -d4 for verbose results + --hooks=1 # test hooks as well + -S$(TESTWAVE_DIR) + -S$(BOOST_ROOT) -I$(BOOST_ROOT) + ; + +# +# These are the names of the different unit tests to run +# +TESTWAVE_FILES = test.cfg + ; + +project wave/test + ; + +for local source in $(SOURCES) +{ + local requirements ; + requirements += <toolset-msvc:version>7.1:<rtti>off ; # workaround for compiler bug + requirements += <toolset-msvc:version>7.1_stlport4:<rtti>off ; + obj $(source) : ../testwave/$(source).cpp : $(requirements) ; +} + +# +# Wave test suite +# +test-suite wave + : + [ + run + # sources + ../testwave/$(SOURCES_DYNAMIC).cpp + /boost/wave//boost_wave + /boost/program_options//boost_program_options + /boost/filesystem//boost_filesystem + /boost/system//boost_system + /boost/thread//boost_thread + /boost/date_time//boost_date_time + : + # arguments + $(TESTWAVE_ARGUMENTS) + --config-file $(TESTWAVE_DIR)/$(TESTWAVE_FILES) + : + # input files + : + # requirements + <threading>multi + <variant>debug + <link>shared:<define>BOOST_ALL_DYN_LINK=1 + <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE + <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE +# <define>BOOST_LIB_DIAGNOSTIC=1 + : + # name + testwave_dll + ] + + [ + run + # sources + ../testwave/$(SOURCES_STATIC).cpp + /boost/wave//boost_wave/<link>static + /boost/program_options//boost_program_options/<link>static + /boost/filesystem//boost_filesystem/<link>static + /boost/system//boost_system/<link>static + /boost/thread//boost_thread/<link>static + /boost/date_time//boost_date_time/<link>static + : + # arguments + $(TESTWAVE_ARGUMENTS) + --config-file $(TESTWAVE_DIR)/$(TESTWAVE_FILES) + : + # input files + : + # requirements + <threading>multi + <variant>debug + <link>static # Linking to DLL tested by testwave_dll + <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE + <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE +# <define>BOOST_LIB_DIAGNOSTIC=1 + : + # name + testwave + ] + + # test the Slex wave lexing component + [ + run + # sources + ../testlexers/test_slex_lexer.cpp + /boost/wave//boost_wave + /boost/program_options//boost_program_options + /boost/filesystem//boost_filesystem + /boost/thread//boost_thread + /boost/system//boost_system + /boost/date_time//boost_date_time + : + # arguments + : + # input files + : + # requirements + <threading>multi + <variant>debug + <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE + <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE + : + # name + test_slex_lexer + ] + # test the Re2C wave lexing component + [ + run + # sources + ../testlexers/test_re2c_lexer.cpp + /boost/wave//boost_wave + /boost/program_options//boost_program_options + /boost/filesystem//boost_filesystem + /boost/thread//boost_thread + /boost/system//boost_system + /boost/date_time//boost_date_time + : + # arguments + : + # input files + : + # requirements + <threading>multi + <variant>debug + <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE + <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE + : + # name + test_re2c_lexer + ] + + [ + run + # sources + ../testwave/quick.cpp + /boost/wave//boost_wave + /boost/thread//boost_thread + /boost/filesystem//boost_filesystem + ] + ; + diff --git a/src/boost/libs/wave/test/testlexers/cpp_tokens.hpp b/src/boost/libs/wave/test/testlexers/cpp_tokens.hpp new file mode 100644 index 000000000..8d3ce37e9 --- /dev/null +++ b/src/boost/libs/wave/test/testlexers/cpp_tokens.hpp @@ -0,0 +1,254 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#include <boost/wave/wave_config.hpp> +#include <boost/wave/token_ids.hpp> + +/////////////////////////////////////////////////////////////////////////////// +struct lexem +{ + char const*token; + boost::wave::token_id id; +}; + +/////////////////////////////////////////////////////////////////////////////// +lexem const lexems[] = +{ + { "bitand", boost::wave::T_AND_ALT }, + { "and", boost::wave::T_ANDAND_ALT }, + { "and_eq", boost::wave::T_ANDASSIGN_ALT }, + { "bitor", boost::wave::T_OR_ALT }, + { "or_eq", boost::wave::T_ORASSIGN_ALT }, + { "or", boost::wave::T_OROR_ALT }, + { "xor", boost::wave::T_XOR_ALT }, + { "xor_eq", boost::wave::T_XORASSIGN_ALT }, + { "not", boost::wave::T_NOT_ALT }, + { "not_eq", boost::wave::T_NOTEQUAL_ALT }, + { "compl", boost::wave::T_COMPL_ALT }, + { "->*", boost::wave::T_ARROWSTAR }, + { ".*", boost::wave::T_DOTSTAR }, + { "::", boost::wave::T_COLON_COLON }, + + { "/* some C comment */", boost::wave::T_CCOMMENT }, + { "/* some multiline \n C comment \n */", boost::wave::T_CCOMMENT }, + { "// some c++ comment\n", boost::wave::T_CPPCOMMENT }, + { " ", boost::wave::T_SPACE }, + { "\t\v\f", boost::wave::T_SPACE }, + { "'c'", boost::wave::T_CHARLIT }, + { "'\\n'", boost::wave::T_CHARLIT }, + { "'\\u1234'", boost::wave::T_CHARLIT }, + { "'\\U12345678'", boost::wave::T_CHARLIT }, + { "\"string literal\"", boost::wave::T_STRINGLIT }, + { "\"string literal \\n \\u1234 \\U12345678\"", boost::wave::T_STRINGLIT }, + { "&&", boost::wave::T_ANDAND }, + { "&=", boost::wave::T_ANDASSIGN }, + { "==", boost::wave::T_EQUAL }, + { "=", boost::wave::T_ASSIGN }, + { "|=", boost::wave::T_ORASSIGN }, + { "\?\?!=", boost::wave::T_ORASSIGN_TRIGRAPH }, + { "||", boost::wave::T_OROR }, + { "|\?\?!", boost::wave::T_OROR_TRIGRAPH }, + { "\?\?!|", boost::wave::T_OROR_TRIGRAPH }, + { "\?\?!\?\?!", boost::wave::T_OROR_TRIGRAPH }, + { "|", boost::wave::T_OR }, + { "\?\?!", boost::wave::T_OR_TRIGRAPH }, + { "^=", boost::wave::T_XORASSIGN }, + { "\?\?'=", boost::wave::T_XORASSIGN_TRIGRAPH }, + { "^", boost::wave::T_XOR }, + { "\?\?'", boost::wave::T_XOR_TRIGRAPH }, + { ",", boost::wave::T_COMMA }, + { ":>", boost::wave::T_RIGHTBRACKET_ALT }, + { ":", boost::wave::T_COLON }, + { "/=", boost::wave::T_DIVIDEASSIGN }, + { "/", boost::wave::T_DIVIDE }, + { "...", boost::wave::T_ELLIPSIS }, + { ".", boost::wave::T_DOT }, + { ">>=", boost::wave::T_SHIFTRIGHTASSIGN }, + { ">>", boost::wave::T_SHIFTRIGHT }, + { ">=", boost::wave::T_GREATEREQUAL }, + { ">", boost::wave::T_GREATER }, + { "{", boost::wave::T_LEFTBRACE }, + { "<<=", boost::wave::T_SHIFTLEFTASSIGN }, + { "<<", boost::wave::T_SHIFTLEFT }, + { "<=", boost::wave::T_LESSEQUAL }, + { "<%", boost::wave::T_LEFTBRACE_ALT }, + { "<:", boost::wave::T_LEFTBRACKET_ALT }, + { "<", boost::wave::T_LESS }, + { "\?\?<", boost::wave::T_LEFTBRACE_TRIGRAPH }, + { "(", boost::wave::T_LEFTPAREN }, + { "[", boost::wave::T_LEFTBRACKET }, + { "\?\?(", boost::wave::T_LEFTBRACKET_TRIGRAPH }, + { "--", boost::wave::T_MINUSMINUS }, + { "-=", boost::wave::T_MINUSASSIGN }, + { "->", boost::wave::T_ARROW }, + { "-", boost::wave::T_MINUS }, + { "%:%:", boost::wave::T_POUND_POUND_ALT }, + { "%=", boost::wave::T_PERCENTASSIGN }, + { "%>", boost::wave::T_RIGHTBRACE_ALT }, + { "%:", boost::wave::T_POUND_ALT }, + { "%", boost::wave::T_PERCENT }, + { "!=", boost::wave::T_NOTEQUAL }, + { "!", boost::wave::T_NOT }, + { "+=", boost::wave::T_PLUSASSIGN }, + { "++", boost::wave::T_PLUSPLUS }, + { "+", boost::wave::T_PLUS }, + { "}", boost::wave::T_RIGHTBRACE }, + { "\?\?>", boost::wave::T_RIGHTBRACE_TRIGRAPH }, + { ")", boost::wave::T_RIGHTPAREN }, + { "]", boost::wave::T_RIGHTBRACKET }, + { "\?\?)", boost::wave::T_RIGHTBRACKET_TRIGRAPH }, + { ";", boost::wave::T_SEMICOLON }, + { "*=", boost::wave::T_STARASSIGN }, + { "*", boost::wave::T_STAR }, + { "~", boost::wave::T_COMPL }, + { "\?\?-", boost::wave::T_COMPL_TRIGRAPH }, + { "asm", boost::wave::T_ASM }, + { "auto", boost::wave::T_AUTO }, + { "bool", boost::wave::T_BOOL }, + { "false", boost::wave::T_FALSE }, + { "true", boost::wave::T_TRUE }, + { "break", boost::wave::T_BREAK }, + { "case", boost::wave::T_CASE }, + { "catch", boost::wave::T_CATCH }, + { "char", boost::wave::T_CHAR }, + { "class", boost::wave::T_CLASS }, + { "const_cast", boost::wave::T_CONSTCAST }, + { "const", boost::wave::T_CONST }, + { "continue", boost::wave::T_CONTINUE }, + { "default", boost::wave::T_DEFAULT }, + { "delete", boost::wave::T_DELETE }, + { "do", boost::wave::T_DO }, + { "double", boost::wave::T_DOUBLE }, + { "dynamic_cast", boost::wave::T_DYNAMICCAST }, + { "else", boost::wave::T_ELSE }, + { "enum", boost::wave::T_ENUM }, + { "explicit", boost::wave::T_EXPLICIT }, + { "export", boost::wave::T_EXPORT }, + { "extern", boost::wave::T_EXTERN }, + { "float", boost::wave::T_FLOAT }, + { "for", boost::wave::T_FOR }, + { "friend", boost::wave::T_FRIEND }, + { "goto", boost::wave::T_GOTO }, + { "if", boost::wave::T_IF }, +#if BOOST_WAVE_SUPPORT_IMPORT_KEYWORD != 0 + { "import", boost::wave::T_IMPORT}, +#endif + { "inline", boost::wave::T_INLINE }, + { "int", boost::wave::T_INT }, + { "long", boost::wave::T_LONG }, + { "mutable", boost::wave::T_MUTABLE }, + { "namespace", boost::wave::T_NAMESPACE }, + { "new", boost::wave::T_NEW }, + { "operator", boost::wave::T_OPERATOR }, + { "private", boost::wave::T_PRIVATE }, + { "protected", boost::wave::T_PROTECTED }, + { "public", boost::wave::T_PUBLIC }, + { "register", boost::wave::T_REGISTER }, + { "reinterpret_cast", boost::wave::T_REINTERPRETCAST }, + { "return", boost::wave::T_RETURN }, + { "short", boost::wave::T_SHORT }, + { "signed", boost::wave::T_SIGNED }, + { "sizeof", boost::wave::T_SIZEOF }, + { "static_cast", boost::wave::T_STATICCAST }, + { "static", boost::wave::T_STATIC }, + { "struct", boost::wave::T_STRUCT }, + { "switch", boost::wave::T_SWITCH }, + { "template", boost::wave::T_TEMPLATE }, + { "this", boost::wave::T_THIS }, + { "throw", boost::wave::T_THROW }, + { "try", boost::wave::T_TRY }, + { "typedef", boost::wave::T_TYPEDEF }, + { "typeid", boost::wave::T_TYPEID }, + { "typename", boost::wave::T_TYPENAME }, + { "union", boost::wave::T_UNION }, + { "unsigned", boost::wave::T_UNSIGNED }, + { "using", boost::wave::T_USING }, + { "virtual", boost::wave::T_VIRTUAL }, + { "void", boost::wave::T_VOID }, + { "volatile", boost::wave::T_VOLATILE }, + { "wchar_t", boost::wave::T_WCHART }, + { "while", boost::wave::T_WHILE }, +#if BOOST_WAVE_SUPPORT_MS_EXTENSIONS != 0 + { "__int8", boost::wave::T_MSEXT_INT8 }, + { "__int16", boost::wave::T_MSEXT_INT16 }, + { "__int32", boost::wave::T_MSEXT_INT32 }, + { "__int64", boost::wave::T_MSEXT_INT64 }, + { "__based", boost::wave::T_MSEXT_BASED }, + { "_based", boost::wave::T_MSEXT_BASED }, + { "__declspec", boost::wave::T_MSEXT_DECLSPEC }, + { "_declspec", boost::wave::T_MSEXT_DECLSPEC }, + { "__fastcall", boost::wave::T_MSEXT_FASTCALL }, + { "_fastcall", boost::wave::T_MSEXT_FASTCALL }, + { "__stdcall", boost::wave::T_MSEXT_STDCALL }, + { "_stdcall", boost::wave::T_MSEXT_STDCALL }, + { "__try", boost::wave::T_MSEXT_TRY }, + { "__except", boost::wave::T_MSEXT_EXCEPT }, + { "__finally", boost::wave::T_MSEXT_FINALLY }, + { "__leave", boost::wave::T_MSEXT_LEAVE }, + { "__inline", boost::wave::T_MSEXT_INLINE }, + { "_inline", boost::wave::T_MSEXT_INLINE }, + { "__asm", boost::wave::T_MSEXT_ASM }, + { "_asm", boost::wave::T_MSEXT_ASM }, + { "#region", boost::wave::T_MSEXT_PP_REGION }, + { "#endregion", boost::wave::T_MSEXT_PP_ENDREGION }, +#endif // BOOST_WAVE_SUPPORT_MS_EXTENSIONS != 0 + { "#define", boost::wave::T_PP_DEFINE }, + { "#ifdef", boost::wave::T_PP_IFDEF }, + { "#ifndef", boost::wave::T_PP_IFNDEF }, + { "#if", boost::wave::T_PP_IF }, + { "#else", boost::wave::T_PP_ELSE }, + { "#elif", boost::wave::T_PP_ELIF }, + { "#endif", boost::wave::T_PP_ENDIF }, + { "#error", boost::wave::T_PP_ERROR }, + { "#include \"some_header\"", boost::wave::T_PP_QHEADER }, + { "#include <some_header>", boost::wave::T_PP_HHEADER }, +// { "#include SOME_HEADER", boost::wave::T_PP_INCLUDE }, + { "#line", boost::wave::T_PP_LINE }, + { "#pragma", boost::wave::T_PP_PRAGMA }, + { "#undef", boost::wave::T_PP_UNDEF }, + { "#warning", boost::wave::T_PP_WARNING }, + { "some_identifier_1234", boost::wave::T_IDENTIFIER }, + { "some_identifier_\\u00d4", boost::wave::T_IDENTIFIER }, + { "some_identifier_\\U000000d4", boost::wave::T_IDENTIFIER }, + { ".1", boost::wave::T_FLOATLIT }, + { "1.1", boost::wave::T_FLOATLIT }, + { "1.", boost::wave::T_FLOATLIT }, + { ".1e+1", boost::wave::T_FLOATLIT }, + { ".1E-1", boost::wave::T_FLOATLIT }, + { ".1e1", boost::wave::T_FLOATLIT }, + { "1e1", boost::wave::T_FLOATLIT }, + { "1e1f", boost::wave::T_FLOATLIT }, + { "1e1L", boost::wave::T_FLOATLIT }, + { "1.1e1fl", boost::wave::T_FLOATLIT }, + { "1.e1LF", boost::wave::T_FLOATLIT }, + { "1234LL", boost::wave::T_LONGINTLIT }, + { "1234Ll", boost::wave::T_LONGINTLIT }, + { "1234ll", boost::wave::T_LONGINTLIT }, + { "1234llu", boost::wave::T_LONGINTLIT }, + { "1234ull", boost::wave::T_LONGINTLIT }, +#if BOOST_WAVE_SUPPORT_MS_EXTENSIONS != 0 + { "1234i64", boost::wave::T_LONGINTLIT }, +#endif + { "1234L", boost::wave::T_INTLIT }, + { "1234l", boost::wave::T_INTLIT }, + { "1234ul", boost::wave::T_INTLIT }, + { "1234LU", boost::wave::T_INTLIT }, + { "1234", boost::wave::T_INTLIT }, + { " ", boost::wave::T_SPACE }, + { "\t", boost::wave::T_SPACE }, + { "\n", boost::wave::T_NEWLINE }, + { "##", boost::wave::T_POUND_POUND }, + { "\?\?=\?\?=", boost::wave::T_POUND_POUND_TRIGRAPH }, + { "#", boost::wave::T_POUND }, + { "\?\?=", boost::wave::T_POUND_TRIGRAPH }, + { "\?\?/", boost::wave::T_ANY_TRIGRAPH }, + { "?", boost::wave::T_QUESTION_MARK }, + { NULL, boost::wave::token_id(0) } +}; + diff --git a/src/boost/libs/wave/test/testlexers/test_lexertl_lexer.cpp b/src/boost/libs/wave/test/testlexers/test_lexertl_lexer.cpp new file mode 100644 index 000000000..bef602f97 --- /dev/null +++ b/src/boost/libs/wave/test/testlexers/test_lexertl_lexer.cpp @@ -0,0 +1,91 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// system headers +#include <string> +#include <iostream> +#include <limits> + +#include <boost/wave/wave_config.hpp> +#undef BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION + +#include <boost/detail/lightweight_test.hpp> +#if defined(TESTLEXERS_TIMING) +#include "high_resolution_timer.hpp" +#endif + +// include the lexertl lexer related stuff +#include <boost/wave/cpplexer/cpp_lex_token.hpp> // token type +#include <libs/wave/samples/list_includes/lexertl/lexertl_lexer.hpp> // lexer type + +typedef boost::wave::cpplexer::lex_token<> token_type; +typedef boost::wave::cpplexer::lexertl::lex_iterator<token_type> lexer_type; + +/////////////////////////////////////////////////////////////////////////////// +// include test data +#include "cpp_tokens.hpp" + +/////////////////////////////////////////////////////////////////////////////// +int +main(int argc, char *argv[]) +{ + try { + token_type::position_type pos("<testdata>"); + +#if defined(TESTLEXERS_TIMING) + boost::high_resolution_timer tim; + for (int i = 0; i < 1000; ++i) { +#endif + + for (lexem const* data = lexems; NULL != data->token; ++data) { + // feed the token to the lexer + token_type::string_type instr(data->token); + + lexer_type it = lexer_type(instr.begin(), instr.end(), pos, + boost::wave::support_option_long_long); + lexer_type end = lexer_type(); + + // verify the correct outcome of the tokenization +#if defined(TESTLEXERS_VERBOSE) + std::cerr << boost::wave::get_token_name(data->id) << std::endl; +#endif + + if (data->id != boost::wave::token_id(*it)) { + BOOST_TEST(data->id == boost::wave::token_id(*it)); + std::cerr << data->token << ": expected: " + << boost::wave::get_token_name(data->id); + std::cerr << ", found: " + << boost::wave::get_token_name(boost::wave::token_id(*it)) + << std::endl; + } + BOOST_TEST(++it != end); + if (boost::wave::T_EOF != boost::wave::token_id(*it)) { + BOOST_TEST(boost::wave::T_EOF == boost::wave::token_id(*it)); + std::cerr << data->token << ": not fully matched, " + << "first non-matched token was: " << (*it).get_value() + << std::endl; + } + } + +#if defined(TESTLEXERS_TIMING) + } + std::cout << tim.elapsed() << " [s]" << std::endl; +#endif + } + catch (boost::wave::cpplexer::lexing_exception &e) { + // some lexing error + std::cerr + << "test_lexertl_lexer: " + << e.description() << std::endl; + return (std::numeric_limits<int>::max)() - 1; + } + + return boost::report_errors(); +} + diff --git a/src/boost/libs/wave/test/testlexers/test_re2c_lexer.cpp b/src/boost/libs/wave/test/testlexers/test_re2c_lexer.cpp new file mode 100644 index 000000000..344d8c487 --- /dev/null +++ b/src/boost/libs/wave/test/testlexers/test_re2c_lexer.cpp @@ -0,0 +1,97 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// disable stupid compiler warnings +#include <boost/config/warning_disable.hpp> + +// system headers +#include <string> +#include <iostream> +#include <limits> + +#include <boost/wave/wave_config.hpp> +#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580) +#undef BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION +#endif + +#include <boost/detail/lightweight_test.hpp> +#if defined(TESTLEXERS_TIMING) +#include "high_resolution_timer.hpp" +#endif + +// include the Re2C lexer related stuff +#include <boost/wave/cpplexer/cpp_lex_token.hpp> // token type +#include <boost/wave/cpplexer/cpp_lex_iterator.hpp> +#include <boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp> // lexer type + +typedef boost::wave::cpplexer::lex_token<> token_type; +typedef boost::wave::cpplexer::lex_iterator<token_type> lexer_type; + +/////////////////////////////////////////////////////////////////////////////// +// include test data +#include "cpp_tokens.hpp" + +/////////////////////////////////////////////////////////////////////////////// +int +main(int argc, char *argv[]) +{ + try { + token_type::position_type pos("<testdata>"); + +#if defined(TESTLEXERS_TIMING) + boost::high_resolution_timer tim; + for (int i = 0; i < 1000; ++i) { +#endif + + for (lexem const* data = lexems; NULL != data->token; ++data) { + // feed the token to the lexer + token_type::string_type instr(data->token); + + lexer_type it = lexer_type(instr.begin(), instr.end(), pos, + boost::wave::support_option_long_long); + lexer_type end = lexer_type(); + + // verify the correct outcome of the tokenization +#if defined(TESTLEXERS_VERBOSE) + std::cerr << boost::wave::get_token_name(data->id) << std::endl; +#endif + + if (data->id != boost::wave::token_id(*it)) { + BOOST_TEST(data->id == boost::wave::token_id(*it)); + std::cerr << data->token << ": expected: " + << boost::wave::get_token_name(data->id); + std::cerr << ", found: " + << boost::wave::get_token_name(boost::wave::token_id(*it)) + << std::endl; + } + BOOST_TEST(++it != end); + if (boost::wave::T_EOF != boost::wave::token_id(*it)) { + BOOST_TEST(boost::wave::T_EOF == boost::wave::token_id(*it)); + std::cerr << data->token << ": not fully matched, " + << "first non-matched token was: " << (*it).get_value() + << std::endl; + } + } + +#if defined(TESTLEXERS_TIMING) + } + std::cout << tim.elapsed() << " [s]" << std::endl; +#endif + } + catch (boost::wave::cpplexer::lexing_exception &e) { + // some lexing error + std::cerr + << "test_re2c_lexer: " + << e.description() << std::endl; + return (std::numeric_limits<int>::max)() - 1; + } + + return boost::report_errors(); +} + diff --git a/src/boost/libs/wave/test/testlexers/test_slex_lexer.cpp b/src/boost/libs/wave/test/testlexers/test_slex_lexer.cpp new file mode 100644 index 000000000..a0754a36d --- /dev/null +++ b/src/boost/libs/wave/test/testlexers/test_slex_lexer.cpp @@ -0,0 +1,100 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// disable stupid compiler warnings +#include <boost/config/warning_disable.hpp> + +// system headers +#include <string> +#include <iostream> +#include <limits> + +#include <boost/wave/wave_config.hpp> +#undef BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION + +#include <boost/detail/lightweight_test.hpp> +#if defined(TESTLEXERS_TIMING) +#include "high_resolution_timer.hpp" +#endif + +/////////////////////////////////////////////////////////////////////////////// +// include the Slex lexer related stuff +#include <libs/wave/samples/cpp_tokens/slex_token.hpp> // token type +#include <libs/wave/samples/cpp_tokens/slex/cpp_slex_lexer.hpp> // lexer type + +typedef boost::wave::cpplexer::slex_token<> token_type; +typedef boost::wave::cpplexer::slex::slex_iterator<token_type> lexer_type; + +// This instantiates the correct 'new_lexer' function, which generates the +// C++ lexer used in this test. +template struct boost::wave::cpplexer::slex::new_lexer_gen< + std::string::iterator>; + +/////////////////////////////////////////////////////////////////////////////// +// include test data +#include "cpp_tokens.hpp" + +/////////////////////////////////////////////////////////////////////////////// +int +main(int argc, char *argv[]) +{ + try { + token_type::position_type pos("<testdata>"); + +#if defined(TESTLEXERS_TIMING) + boost::high_resolution_timer tim; + for (int i = 0; i < 1000; ++i) { +#endif + + for (lexem const* data = lexems; NULL != data->token; ++data) { + // feed the token to the lexer + token_type::string_type instr(data->token); + + lexer_type it = lexer_type(instr.begin(), instr.end(), pos, + boost::wave::support_option_long_long); + lexer_type end = lexer_type(); + + // verify the correct outcome of the tokenization +#if defined(TESTLEXERS_VERBOSE) + std::cerr << boost::wave::get_token_name(data->id) << std::endl; +#endif + + if (data->id != boost::wave::token_id(*it)) { + BOOST_TEST(data->id == boost::wave::token_id(*it)); + std::cerr << data->token << ": expected: " + << boost::wave::get_token_name(data->id); + std::cerr << ", found: " + << boost::wave::get_token_name(boost::wave::token_id(*it)) + << std::endl; + } + BOOST_TEST(++it != end); + if (boost::wave::T_EOF != boost::wave::token_id(*it)) { + BOOST_TEST(boost::wave::T_EOF == boost::wave::token_id(*it)); + std::cerr << data->token << ": not fully matched, " + << "first non-matched token was: " << (*it).get_value() + << std::endl; + } + } + +#if defined(TESTLEXERS_TIMING) + } + std::cout << tim.elapsed() << " [s]" << std::endl; +#endif + } + catch (boost::wave::cpplexer::lexing_exception &e) { + // some lexing error + std::cerr + << "test_slex_lexer: " + << e.description() << std::endl; + return (std::numeric_limits<int>::max)() - 1; + } + + return boost::report_errors(); +} + diff --git a/src/boost/libs/wave/test/testlexers/test_xlex_lexer.cpp b/src/boost/libs/wave/test/testlexers/test_xlex_lexer.cpp new file mode 100644 index 000000000..12eb76428 --- /dev/null +++ b/src/boost/libs/wave/test/testlexers/test_xlex_lexer.cpp @@ -0,0 +1,92 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// disable stupid compiler warnings +#include <boost/config/warning_disable.hpp> + +// system headers +#include <string> +#include <iostream> +#include <limits> + +#include <boost/wave/wave_config.hpp> +#include <boost/detail/lightweight_test.hpp> +#if defined(TESTLEXERS_TIMING) +#include "high_resolution_timer.hpp" +#endif + +/////////////////////////////////////////////////////////////////////////////// +// include the Xpressive lexer related stuff +#include <boost/wave/cpplexer/cpp_lex_token.hpp> // token type +#include <libs/wave/samples/token_statistics/xlex/xlex_lexer.hpp> // lexer type + +typedef boost::wave::cpplexer::lex_token<> token_type; +typedef boost::wave::cpplexer::xlex::xlex_iterator<token_type> lexer_type; + +// This instantiates the correct 'new_lexer' function, which generates the +// C++ lexer used in this test. +template struct boost::wave::cpplexer::xlex::new_lexer_gen<std::string::iterator>; + +/////////////////////////////////////////////////////////////////////////////// +// include test data +#include "cpp_tokens.hpp" + +/////////////////////////////////////////////////////////////////////////////// +int +main(int argc, char *argv[]) +{ + try { + token_type::position_type pos("<testdata>"); + +#if defined(TESTLEXERS_TIMING) + boost::high_resolution_timer tim; + for (int i = 0; i < 10; ++i) { +#endif + + for (lexem const* data = lexems; NULL != data->token; ++data) { + // feed the token to the lexer + token_type::string_type instr(data->token); + + lexer_type it = lexer_type(instr.begin(), instr.end(), pos, + boost::wave::support_option_long_long); + lexer_type end = lexer_type(); + + // verify the correct outcome of the tokenisation +#if defined(TESTLEXERS_VERBOSE) + std::cerr << boost::wave::get_token_name(data->id) << std::endl; +#endif + + if (data->id != boost::wave::token_id(*it)) { + BOOST_TEST(data->id == boost::wave::token_id(*it)); + std::cerr << data->token << ": expected: " + << boost::wave::get_token_name(data->id); + std::cerr << ", found: " + << boost::wave::get_token_name(boost::wave::token_id(*it)) + << std::endl; + } + BOOST_TEST(++it != end); + BOOST_TEST(boost::wave::T_EOF == boost::wave::token_id(*it)); + } + +#if defined(TESTLEXERS_TIMING) + } + std::cout << tim.elapsed() << " [s]" << std::endl; +#endif + } + catch (boost::wave::cpplexer::lexing_exception &e) { + // some lexing error + std::cerr + << "test_xlex_lexer: " + << e.description() << std::endl; + return (std::numeric_limits<int>::max)() - 1; + } + + return boost::report_errors(); +} + diff --git a/src/boost/libs/wave/test/testwave/cmd_line_utils.hpp b/src/boost/libs/wave/test/testwave/cmd_line_utils.hpp new file mode 100644 index 000000000..8d674aefe --- /dev/null +++ b/src/boost/libs/wave/test/testwave/cmd_line_utils.hpp @@ -0,0 +1,235 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#if !defined(BOOST_WAVE_LIBS_WAVE_TEST_CMD_LINE_UTILS_HPP) +#define BOOST_WAVE_LIBS_WAVE_TEST_CMD_LINE_UTILS_HPP + +#include <string> +#include <fstream> +#include <vector> + +#include <boost/config.hpp> +#include <boost/assert.hpp> +#include <boost/any.hpp> + +/////////////////////////////////////////////////////////////////////////////// +// forward declarations only +namespace cmd_line_utils +{ + class include_paths; +} + +namespace boost { namespace program_options +{ + void validate(boost::any &v, std::vector<std::string> const &s, + cmd_line_utils::include_paths *, int); +}} // boost::program_options + +/////////////////////////////////////////////////////////////////////////////// +#include <boost/program_options.hpp> + +/////////////////////////////////////////////////////////////////////////////// +namespace cmd_line_utils { + + namespace po = boost::program_options; + + /////////////////////////////////////////////////////////////////////////// + // Additional command line parser which interprets '@something' as an + // option "config-file" with the value "something". + inline std::pair<std::string, std::string> + at_option_parser(std::string const& s) + { + if ('@' == s[0]) + return std::make_pair(std::string("config-file"), s.substr(1)); + else + return std::pair<std::string, std::string>(); + } + + /////////////////////////////////////////////////////////////////////////// + // class, which keeps the include file information read from the options + class include_paths + { + public: + include_paths() : seen_separator(false) {} + + std::vector<std::string> paths; // stores user paths + std::vector<std::string> syspaths; // stores system paths + bool seen_separator; // options contain a '-I-' option + + // Function which validates additional tokens from the given option. + static void + validate(boost::any &v, std::vector<std::string> const &tokens) + { + if (v.empty()) + v = boost::any(include_paths()); + + include_paths *p = boost::any_cast<include_paths>(&v); + BOOST_ASSERT(NULL != p); + + // Assume only one path per '-I' occurrence. + std::string const& t = po::validators::get_single_string(tokens); + if (t == "-") { + // found -I- option, so switch behaviour + p->seen_separator = true; + } + else if (p->seen_separator) { + // store this path as a system path + p->syspaths.push_back(t); + } + else { + // store this path as an user path + p->paths.push_back(t); + } + } + }; + + /////////////////////////////////////////////////////////////////////////// + // Read all options from a given config string, parse and add them to the + // given variables_map + inline void + read_config_options(int debuglevel, std::string const &indata, + po::options_description const &desc, po::variables_map &vm) + { + if (9 == debuglevel) { + std::cerr << "read_config_options: reading config options" + << std::endl; + } + + std::istringstream istrm(indata); + + std::vector<std::string> options; + std::string line; + + while (std::getline(istrm, line)) { + // skip empty lines + std::string::size_type pos = line.find_first_not_of(" \t"); + if (pos == std::string::npos) + continue; + + // skip comment lines + if ('#' != line[pos]) + options.push_back(line); + } + + if (options.size() > 0) { + if (9 == debuglevel) { + std::cerr << "read_config_options: options size is: " + << (int)options.size() << std::endl; + } + + // (the (int) cast is to make the True64 compiler happy) + using namespace boost::program_options::command_line_style; + po::store(po::command_line_parser(options) + .options(desc).style((int)unix_style).run(), vm); + po::notify(vm); + } + + if (9 == debuglevel) { + std::cerr << "read_config_options: succeeded to read config options" + << std::endl; + } + } + + /////////////////////////////////////////////////////////////////////////// + // Read all options from a given config file, parse and add them to the + // given variables_map + inline bool + read_config_file(int debuglevel, std::string const &filename, + po::options_description const &desc, po::variables_map &vm) + { + if (9 == debuglevel) { + std::cerr << "read_config_file: reading config options" + << std::endl; + } + + std::ifstream ifs(filename.c_str()); + + if (!ifs.is_open()) { + std::cerr + << "testwave: " << filename + << ": command line warning: config file not found" + << std::endl; + return false; + } + + // parse the file and extract all given arguments and options + std::vector<std::string> options; + std::string line; + + while (std::getline(ifs, line)) { + // skip empty lines + std::string::size_type pos = line.find_first_not_of(" \t"); + if (pos == std::string::npos) + continue; + + // skip comment lines + if ('#' != line[pos]) + options.push_back(line); + } + + if (options.size() > 0) { + if (9 == debuglevel) { + std::cerr << "read_config_file: options size is: " + << (int)options.size() << std::endl; + } + + // treat positional arguments as --input parameters + po::positional_options_description p; + p.add("input", -1); + + // parse the vector of lines and store the results into the given + // variables map + // (the (int) cast is to make the True64 compiler happy) + using namespace boost::program_options::command_line_style; + po::store(po::command_line_parser(options) + .options(desc).positional(p).style((int)unix_style).run(), vm); + po::notify(vm); + } + + + if (9 == debuglevel) { + std::cerr << "read_config_file: succeeded to read config options" + << std::endl; + } + return true; + } + + /////////////////////////////////////////////////////////////////////////// + // predicate to extract all positional arguments from the command line + struct is_argument + { + bool operator()(po::option const &opt) + { + return (opt.position_key == -1) ? true : false; + } + }; + +/////////////////////////////////////////////////////////////////////////////// +} // namespace cmd_line_utils + +/////////////////////////////////////////////////////////////////////////////// +// +// Special validator overload, which allows to handle the -I- syntax for +// switching the semantics of an -I option. +// +// This must be injected into the boost::program_options namespace +// +/////////////////////////////////////////////////////////////////////////////// +namespace boost { namespace program_options { + + inline void + validate(boost::any &v, std::vector<std::string> const &s, + cmd_line_utils::include_paths *, int) + { + cmd_line_utils::include_paths::validate(v, s); + } + +}} // namespace boost::program_options + +#endif // !defined(BOOST_WAVE_LIBS_WAVE_TEST_CMD_LINE_UTILS_HPP) diff --git a/src/boost/libs/wave/test/testwave/collect_hooks_information.hpp b/src/boost/libs/wave/test/testwave/collect_hooks_information.hpp new file mode 100644 index 000000000..17f17adee --- /dev/null +++ b/src/boost/libs/wave/test/testwave/collect_hooks_information.hpp @@ -0,0 +1,873 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#if !defined(BOOST_WAVE_LIBS_WAVE_TEST_COLLECT_HOOKS_INFORMATION_HPP) +#define BOOST_WAVE_LIBS_WAVE_TEST_COLLECT_HOOKS_INFORMATION_HPP + +#include <boost/config.hpp> +#include <boost/lexical_cast.hpp> +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/operations.hpp> + +/////////////////////////////////////////////////////////////////////////////// +// workaround for missing ostringstream +#ifdef BOOST_NO_STRINGSTREAM +#include <strstream> +#define BOOST_WAVETEST_OSSTREAM std::ostrstream +std::string BOOST_WAVETEST_GETSTRING(std::ostrstream& ss) +{ + ss << ends; + std::string rval = ss.str(); + ss.freeze(false); + return rval; +} +#else +#include <sstream> +#define BOOST_WAVETEST_GETSTRING(ss) ss.str() +#define BOOST_WAVETEST_OSSTREAM std::ostringstream +#endif + +/////////////////////////////////////////////////////////////////////////////// +template <typename String> +String handle_filepath(String const &name) +{ + using boost::wave::util::impl::unescape_lit; + + String unesc_name (unescape_lit(name)); + typename String::size_type p = unesc_name.find_last_of("/\\"); + if (p != unesc_name.npos) + unesc_name = unesc_name.substr(p+1); + return unesc_name; +} + +/////////////////////////////////////////////////////////////////////////////// +template <typename String> +inline String repr(boost::wave::util::file_position<String> const& pos) +{ + std::string linenum = boost::lexical_cast<std::string>(pos.get_line()); + return handle_filepath(pos.get_file()) + String("(") + linenum.c_str() + ")"; +} + +template <typename String> +inline String repr(String const& value) +{ + String result; + typename String::const_iterator end = value.end(); + for (typename String::const_iterator it = value.begin(); it != end; ++it) + { + typedef typename String::value_type char_type; + char_type c = *it; + if (c == static_cast<char_type>('\a')) + result.append("\\a"); + else if (c == static_cast<char_type>('\b')) + result.append("\\b"); + else if (c == static_cast<char_type>('\f')) + result.append("\\f"); + else if (c == static_cast<char_type>('\n')) + result.append("\\n"); + else if (c == static_cast<char_type>('\r')) + result.append("\\r"); + else if (c == static_cast<char_type>('\t')) + result.append("\\t"); + else if (c == static_cast<char_type>('\v')) + result.append("\\v"); + else + result += static_cast<char_type>(c); + } + return result; +} + +#if defined(BOOST_WINDOWS) +template <typename String> +inline String replace_slashes(String value, char const* lookfor = "\\", + char replace_with = '/') +{ + typename String::size_type p = value.find_first_of(lookfor); + while (p != value.npos) { + value[p] = replace_with; + p = value.find_first_of(lookfor, p+1); + } + return value; +} +#endif + +/////////////////////////////////////////////////////////////////////////////// +template <typename Token> +class collect_hooks_information + : public boost::wave::context_policies::eat_whitespace<Token> +{ + typedef boost::wave::context_policies::eat_whitespace<Token> base_type; + +public: + collect_hooks_information(std::string& trace) + : hooks_trace(trace), skipped_token_hooks(false) + {} + + void set_skipped_token_hooks(bool flag) + { + skipped_token_hooks = flag; + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'expanding_function_like_macro' is called, whenever a + // function-like macro is to be expanded. + // + // The parameter 'macrodef' marks the position, where the macro to expand + // is defined. + // + // The parameter 'formal_args' holds the formal arguments used during the + // definition of the macro. + // + // The parameter 'definition' holds the macro definition for the macro to + // trace. + // + // The parameter 'macro_call' marks the position, where this macro invoked. + // + // The parameter 'arguments' holds the macro arguments used during the + // invocation of the macro + // + // The parameters 'seqstart' and 'seqend' point into the input token + // stream allowing to access the whole token sequence comprising the macro + // invocation (starting with the opening parenthesis and ending after the + // closing one). + // + // The return value defines, whether the corresponding macro will be + // expanded (return false) or will be copied to the output (return true). + // Note: the whole argument list is copied unchanged to the output as well + // without any further processing. + // + /////////////////////////////////////////////////////////////////////////// + + template <typename Context, typename Container, typename Iterator> + bool + expanding_function_like_macro(Context const& ctx, + Token const& macro, std::vector<Token> const& formal_args, + Container const& definition, + Token const& macrocall, std::vector<Container> const& arguments, + Iterator const& seqstart, Iterator const& seqend) + { + BOOST_WAVETEST_OSSTREAM strm; + // trace real macro call + strm << "00: " << repr(macrocall.get_position()) << ": " + << macrocall.get_value() << "("; + for (typename std::vector<Token>::size_type i = 0; + i < arguments.size(); ++i) + { + strm << boost::wave::util::impl::as_string(arguments[i]); + if (i < arguments.size()-1) + strm << ","; + } + strm << "), "; + + // trace macro definition + strm << "[" << repr(macro.get_position()) << ": " + << macro.get_value() << "("; + for (typename std::vector<Token>::size_type i = 0; + i < formal_args.size(); ++i) + { + strm << formal_args[i].get_value(); + if (i < formal_args.size()-1) + strm << ", "; + } + strm << ")=" << boost::wave::util::impl::as_string(definition) << "]" + << std::endl; + + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + return false; // default is to normally expand the macro + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'expanding_object_like_macro' is called, whenever a + // object-like macro is to be expanded . + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'macro' marks the position, where the macro to expand + // is defined. + // + // The definition 'definition' holds the macro definition for the macro to + // trace. + // + // The parameter 'macrocall' marks the position, where this macro invoked. + // + // The return value defines, whether the corresponding macro will be + // expanded (return false) or will be copied to the output (return true). + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context, typename Container> + bool + expanding_object_like_macro(Context const& ctx, Token const& macro, + Container const& definition, Token const& macrocall) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "01: " << repr(macro.get_position()) << ": " + << macro.get_value() << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + return false; // default is to normally expand the macro + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'expanded_macro' is called, whenever the expansion of a + // macro is finished but before the rescanning process starts. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'result' contains the token sequence generated as the + // result of the macro expansion. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context, typename Container> + void expanded_macro(Context const& ctx, Container const& result) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "02: " << boost::wave::util::impl::as_string(result) << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'rescanned_macro' is called, whenever the rescanning of a + // macro is finished. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'result' contains the token sequence generated as the + // result of the rescanning. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context, typename Container> + void rescanned_macro(Context const& ctx, Container const& result) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "03: " << boost::wave::util::impl::as_string(result) << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'found_include_directive' is called, whenever a #include + // directive was located. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'filename' contains the (expanded) file name found after + // the #include directive. This has the format '<file>', '"file"' or + // 'file'. + // The formats '<file>' or '"file"' are used for #include directives found + // in the preprocessed token stream, the format 'file' is used for files + // specified through the --force_include command line argument. + // + // The parameter 'include_next' is set to true if the found directive was + // a #include_next directive and the BOOST_WAVE_SUPPORT_INCLUDE_NEXT + // preprocessing constant was defined to something != 0. + // + // The return value defines, whether the found file will be included + // (return false) or will be skipped (return true). + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context> + bool + found_include_directive(Context const& ctx, std::string filename, + bool include_next) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "04: " << filename; + if (include_next) + strm << " (include_next)"; + strm << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + return false; // ok to include this file + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'opened_include_file' is called, whenever a file referred + // by an #include directive was successfully located and opened. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'filename' contains the file system path of the + // opened file (this is relative to the directory of the currently + // processed file or a absolute path depending on the paths given as the + // include search paths). + // + // The include_depth parameter contains the current include file depth. + // + // The is_system_include parameter denotes, whether the given file was + // found as a result of a #include <...> directive. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context> + void + opened_include_file(Context const& ctx, std::string relname, + std::string absname, bool is_system_include) + { + using boost::wave::util::impl::escape_lit; + +#if defined(BOOST_WINDOWS) + relname = replace_slashes(relname); + absname = replace_slashes(absname); +#endif + + BOOST_WAVETEST_OSSTREAM strm; + strm << "05: " << escape_lit(relname) + << " (" << escape_lit(absname) << ")" << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'returning_from_include_file' is called, whenever an + // included file is about to be closed after it's processing is complete. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context> + void + returning_from_include_file(Context const& ctx) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "06: " << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'interpret_pragma' is called, whenever a #pragma command + // directive is found which isn't known to the core Wave library, where + // command is the value defined as the BOOST_WAVE_PRAGMA_KEYWORD constant + // which defaults to "wave". + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'pending' may be used to push tokens back into the input + // stream, which are to be used as the replacement text for the whole + // #pragma directive. + // + // The parameter 'option' contains the name of the interpreted pragma. + // + // The parameter 'values' holds the values of the parameter provided to + // the pragma operator. + // + // The parameter 'act_token' contains the actual #pragma token, which may + // be used for error output. + // + // If the return value is 'false', the whole #pragma directive is + // interpreted as unknown and a corresponding error message is issued. A + // return value of 'true' signs a successful interpretation of the given + // #pragma. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context, typename Container> + bool + interpret_pragma(Context const& ctx, Container &pending, + Token const& option, Container const& values, Token const& act_token) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "07: " << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + return false; + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'defined_macro' is called, whenever a macro was defined + // successfully. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'name' is a reference to the token holding the macro name. + // + // The parameter 'is_functionlike' is set to true, whenever the newly + // defined macro is defined as a function like macro. + // + // The parameter 'parameters' holds the parameter tokens for the macro + // definition. If the macro has no parameters or if it is a object like + // macro, then this container is empty. + // + // The parameter 'definition' contains the token sequence given as the + // replacement sequence (definition part) of the newly defined macro. + // + // The parameter 'is_predefined' is set to true for all macros predefined + // during the initialization phase of the library. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context, typename Container> + void + defined_macro(Context const& ctx, Token const& macro, + bool is_functionlike, std::vector<Token> const& pars, + Container const& definition, bool is_predefined) + { + // do not trace the definition of the internal helper macros + if (!is_predefined) { + BOOST_WAVETEST_OSSTREAM strm; + strm << "08: " << repr(macro.get_position()) << ": " + << macro.get_value(); + if (is_functionlike) { + // list the parameter names for function style macros + strm << "("; + for (typename std::vector<Token>::size_type i = 0; + i < pars.size(); ++i) + { + strm << pars[i].get_value(); + if (i < pars.size()-1) + strm << ", "; + } + strm << ")"; + } + strm << "=" << boost::wave::util::impl::as_string(definition) + << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + } + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'undefined_macro' is called, whenever a macro definition + // was removed successfully. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'name' holds the name of the macro, which definition was + // removed. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context> + void + undefined_macro(Context const& ctx, Token const& macro) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "09: " << repr(macro.get_position()) << ": " + << macro.get_value() << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'found_directive' is called, whenever a preprocessor + // directive was encountered, but before the corresponding action is + // executed. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'directive' is a reference to the token holding the + // preprocessing directive. + // + // The return value defines, whether the given expression has to be + // to be executed in a normal way (return 'false'), or if it has to be + // skipped altogether (return 'true'), which means it gets replaced in the + // output by a single newline. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context> + bool + found_directive(Context const& ctx, Token const& directive) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "10: " << repr(directive.get_position()) << ": " + << directive.get_value() << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + return false; // by default we never skip any directives + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'evaluated_conditional_expression' is called, whenever a + // conditional preprocessing expression was evaluated (the expression + // given to a #if, #elif, #ifdef or #ifndef directive) + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'directive' is a reference to the token holding the + // corresponding preprocessing directive. + // + // The parameter 'expression' holds the non-expanded token sequence + // comprising the evaluated expression. + // + // The parameter expression_value contains the result of the evaluation of + // the expression in the current preprocessing context. + // + // The return value defines, whether the given expression has to be + // evaluated again, allowing to decide which of the conditional branches + // should be expanded. You need to return 'true' from this hook function + // to force the expression to be re-evaluated. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context, typename Container> + bool + evaluated_conditional_expression(Context const& ctx, + Token const& directive, Container const& expression, + bool expression_value) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "11: " << repr(directive.get_position()) << ": " + << directive.get_value() << " " + << boost::wave::util::impl::as_string(expression) << ": " + << expression_value << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + return false; // ok to continue, do not re-evaluate expression + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'skipped_token' is called, whenever a token is about to be + // skipped due to a false preprocessor condition (code fragments to be + // skipped inside the not evaluated conditional #if/#else/#endif branches). + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'token' refers to the token to be skipped. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context> + void + skipped_token(Context const& ctx, Token const& token) + { + // this normally generates a lot of noise + if (skipped_token_hooks) { + BOOST_WAVETEST_OSSTREAM strm; + strm << "12: " << repr(token.get_position()) << ": >" + << repr(token.get_value()) << "<" << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + } + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'generated_token' will be called by the library whenever a + // token is about to be returned from the library. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 't' is the token about to be returned from the library. + // This function may alter the token, but in this case it must be + // implemented with a corresponding signature: + // + // Token const& + // generated_token(Context const& ctx, Token& t); + // + // which makes it possible to modify the token in place. + // + // The default behavior is to return the token passed as the parameter + // without modification. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context> + Token const& + generated_token(Context const& ctx, Token const& t) + { +// this generates a lot of noise +// BOOST_WAVETEST_OSSTREAM strm; +// strm << "13: " << std::endl; +// hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + return t; + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'may_skip_whitespace' will be called by the + // library, whenever it must be tested whether a specific token refers to + // whitespace and this whitespace has to be skipped. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The 'token' parameter holds a reference to the current token. The policy + // is free to change this token if needed. + // + // The 'skipped_newline' parameter holds a reference to a boolean value + // which should be set to true by the policy function whenever a newline + // is going to be skipped. + // + // If the return value is true, the given token is skipped and the + // preprocessing continues to the next token. If the return value is + // false, the given token is returned to the calling application. + // + // ATTENTION! + // Caution has to be used, because by returning true the policy function + // is able to force skipping even significant tokens, not only whitespace. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context> + bool + may_skip_whitespace(Context const& ctx, Token& token, bool& skipped_newline) + { +// this generates a lot of noise +// BOOST_WAVETEST_OSSTREAM strm; +// strm << "14: " << std::endl; +// hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + return this->base_type::may_skip_whitespace(ctx, token, skipped_newline); + } + +#if BOOST_WAVE_SUPPORT_WARNING_DIRECTIVE != 0 + /////////////////////////////////////////////////////////////////////////// + // + // The function 'found_warning_directive' will be called by the library + // whenever a #warning directive is found. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'message' references the argument token sequence of the + // encountered #warning directive. + // + // If the return value is false, the library throws a preprocessor + // exception of the type 'warning_directive', if the return value is true + // the execution continues as if no #warning directive has been found. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context, typename Container> + bool + found_warning_directive(Context const& ctx, Container const& message) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "15: " << boost::wave::util::impl::as_string(message) + << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + return false; + } +#endif + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'found_error_directive' will be called by the library + // whenever a #error directive is found. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'message' references the argument token sequence of the + // encountered #error directive. + // + // If the return value is false, the library throws a preprocessor + // exception of the type 'error_directive', if the return value is true + // the execution continues as if no #error directive has been found. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context, typename Container> + bool + found_error_directive(Context const& ctx, Container const& message) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "16: " << boost::wave::util::impl::as_string(message) + << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + return false; + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'found_line_directive' will be called by the library + // whenever a #line directive is found. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'arguments' references the argument token sequence of the + // encountered #line directive. + // + // The parameter 'line' contains the recognized line number from the #line + // directive. + // + // The parameter 'filename' references the recognized file name from the + // #line directive (if there was one given). + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context, typename Container> + void + found_line_directive(Context const& ctx, Container const& arguments, + unsigned int line, std::string const& filename) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "17: " << boost::wave::util::impl::as_string(arguments) + << " (" << line << ", \"" << filename << "\")" << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'throw_exception' will be called by the library whenever a + // preprocessing exception occurs. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'e' is the exception object containing detailed error + // information. + // + // The default behavior is to call the function boost::throw_exception. + // + /////////////////////////////////////////////////////////////////////////// + template <typename Context, typename Exception> + void + throw_exception(Context const& ctx, Exception const& e) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "18: " << e.what() << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + return this->base_type::throw_exception(ctx, e); + } + +#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0 + /////////////////////////////////////////////////////////////////////////// + // + // The function 'detected_include_guard' is called whenever either a + // include file is about to be added to the list of #pragma once headers. + // That means this header file will not be opened and parsed again even + // if it is specified in a later #include directive. + // This function is called as the result of a detected include guard + // scheme. + // + // The implemented heuristics for include guards detects two forms of + // include guards: + // + // #ifndef INCLUDE_GUARD_MACRO + // #define INCLUDE_GUARD_MACRO + // ... + // #endif + // + // or + // + // if !defined(INCLUDE_GUARD_MACRO) + // #define INCLUDE_GUARD_MACRO + // ... + // #endif + // + // note, that the parenthesis are optional (i.e. !defined INCLUDE_GUARD_MACRO + // will work as well). The code allows for any whitespace, newline and single + // '#' tokens before the #if/#ifndef and after the final #endif. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'filename' contains the file system path of the + // opened file (this is relative to the directory of the currently + // processed file or a absolute path depending on the paths given as the + // include search paths). + // + // The parameter contains the name of the detected include guard. + // + /////////////////////////////////////////////////////////////////////////// + template <typename ContextT> + void + detected_include_guard(ContextT const& ctx, std::string filename, + std::string const& include_guard) + { + using boost::wave::util::impl::escape_lit; + +#if defined(BOOST_WINDOWS) + filename = replace_slashes(filename); +#endif + + BOOST_WAVETEST_OSSTREAM strm; + strm << "19: " << escape_lit(filename) << ": " + << include_guard << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + } + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'detected_pragma_once' is called whenever either a + // include file is about to be added to the list of #pragma once headers. + // That means this header file will not be opened and parsed again even + // if it is specified in a later #include directive. + // This function is called as the result of a detected directive + // #pragma once. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter pragma_token refers to the token "#pragma" triggering + // this preprocessing hook. + // + // The parameter 'filename' contains the file system path of the + // opened file (this is relative to the directory of the currently + // processed file or a absolute path depending on the paths given as the + // include search paths). + // + /////////////////////////////////////////////////////////////////////////// + template <typename ContextT, typename TokenT> + void + detected_pragma_once(ContextT const& ctx, TokenT const& pragma_token, + std::string filename) + { + using boost::wave::util::impl::escape_lit; + +#if defined(BOOST_WINDOWS) + filename = replace_slashes(filename); +#endif + + BOOST_WAVETEST_OSSTREAM strm; + strm << "20: " << repr(pragma_token.get_position()) << ": " + << pragma_token.get_value() << ": " + << escape_lit(filename) << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + } +#endif + + /////////////////////////////////////////////////////////////////////////// + // + // The function 'found_unknown_directive' is called, whenever an unknown + // preprocessor directive was encountered. + // + // The parameter 'ctx' is a reference to the context object used for + // instantiating the preprocessing iterators by the user. + // + // The parameter 'line' holds the tokens of the entire source line + // containing the unknown directive. + // + // The parameter 'pending' may be used to push tokens back into the input + // stream, which are to be used as the replacement text for the whole + // line containing the unknown directive. + // + // The return value defines, whether the given expression has been + // properly interpreted by the hook function or not. If this function + // returns 'false', the library will raise an 'ill_formed_directive' + // preprocess_exception. Otherwise the tokens pushed back into 'pending' + // are passed on to the user program. + // + /////////////////////////////////////////////////////////////////////////// + template <typename ContextT, typename ContainerT> + bool + found_unknown_directive(ContextT const& ctx, ContainerT const& line, + ContainerT& pending) + { + BOOST_WAVETEST_OSSTREAM strm; + strm << "21: " << repr((*line.begin()).get_position()) << ": " + << boost::wave::util::impl::as_string(line) << std::endl; + hooks_trace += BOOST_WAVETEST_GETSTRING(strm); + return false; + } + +private: + std::string& hooks_trace; + bool skipped_token_hooks; +}; + +#endif + + + diff --git a/src/boost/libs/wave/test/testwave/quick.cpp b/src/boost/libs/wave/test/testwave/quick.cpp new file mode 100644 index 000000000..47bd9f224 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/quick.cpp @@ -0,0 +1,49 @@ + +// Copyright 2018 Peter Dimov. +// +// Distributed under the Boost Software License, Version 1.0. +// +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include <boost/wave.hpp> +#include <boost/wave/cpplexer/cpp_lex_token.hpp> +#include <boost/wave/cpplexer/cpp_lex_iterator.hpp> +#include <iostream> + +int main() +{ + std::string input( + "#if 0\n" + "6.28\n" + "#else\n" + "3.14\n" + "#endif\n" + ); + + try + { + typedef boost::wave::cpplexer::lex_token<> token_type; + typedef boost::wave::cpplexer::lex_iterator<token_type> lex_iterator_type; + typedef boost::wave::context<std::string::iterator, lex_iterator_type> context_type; + + context_type ctx( input.begin(), input.end(), "input.cpp" ); + + for( context_type::iterator_type first = ctx.begin(), last = ctx.end(); first != last; ++first ) + { + std::cout << first->get_value(); + } + + return 0; + } + catch( boost::wave::cpp_exception const & x ) + { + std::cerr << x.file_name() << "(" << x.line_no() << "): " << x.description() << std::endl; + return 1; + } + catch( std::exception const & x ) + { + std::cerr << "Exception: " << x.what() << std::endl; + return 2; + } +} diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_001.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_001.cpp new file mode 100644 index 000000000..89c8a342a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_001.cpp @@ -0,0 +1,42 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Test macro expansion order +#define A(x, y) x,y +#define B(x, y) [x][y] +#define C(x) B(x) + +//R #line 16 "t_1_001.cpp" +C(A(2,3)) //R [2][3] +C( A(2 , 3) ) //R [ 2 ][ 3 ] + +//H 10: t_1_001.cpp(11): #define +//H 08: t_1_001.cpp(11): A(x, y)=x,y +//H 10: t_1_001.cpp(12): #define +//H 08: t_1_001.cpp(12): B(x, y)=[x][y] +//H 10: t_1_001.cpp(13): #define +//H 08: t_1_001.cpp(13): C(x)=B(x) +//H 00: t_1_001.cpp(16): C(A(2,3)), [t_1_001.cpp(13): C(x)=B(x)] +//H 00: t_1_001.cpp(16): A(2,3), [t_1_001.cpp(11): A(x, y)=x,y] +//H 02: 2,3 +//H 03: 2,3 +//H 02: B(2,3) +//H 00: t_1_001.cpp(13): B(2,3), [t_1_001.cpp(12): B(x, y)=[x][y]] +//H 02: [2][3] +//H 03: [2][3] +//H 03: [2][3] +//H 00: t_1_001.cpp(17): C( A(2 , 3) ), [t_1_001.cpp(13): C(x)=B(x)] +//H 00: t_1_001.cpp(17): A(2 , 3), [t_1_001.cpp(11): A(x, y)=x,y] +//H 02: 2 , 3 +//H 03: 2 , 3 +//H 02: B( 2 , 3 ) +//H 00: t_1_001.cpp(13): B( 2 , 3 ), [t_1_001.cpp(12): B(x, y)=[x][y]] +//H 02: [ 2 ][ 3 ] +//H 03: [ 2 ][ 3 ] +//H 03: [ 2 ][ 3 ] diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_002.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_002.cpp new file mode 100644 index 000000000..315adc6a2 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_002.cpp @@ -0,0 +1,25 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O -DTEST +#if defined(TEST) +#define ABC() 1 +#endif + +//R #line 16 "t_1_002.cpp" +ABC() //R 1 + +//H 10: t_1_002.cpp(11): #if +//H 11: t_1_002.cpp(11): #if defined(TEST): 1 +//H 10: t_1_002.cpp(12): #define +//H 08: t_1_002.cpp(12): ABC()=1 +//H 10: t_1_002.cpp(13): #endif +//H 00: t_1_002.cpp(16): ABC(), [t_1_002.cpp(12): ABC()=1] +//H 02: 1 +//H 03: 1 diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_003.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_003.cpp new file mode 100644 index 000000000..28e01c833 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_003.cpp @@ -0,0 +1,60 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests macro expansion order in conjunction with the need to skip expansion +// of the same macro as it is currently expanded. + +#define CONCAT(a, b) a ## b +#define CONCAT_INDIRECT() CONCAT + +//R #line 18 "t_1_003.cpp" +//R CONCAT(1, 2) +CONCAT(CON, CAT)(1, 2) +//R #line 21 "t_1_003.cpp" +//R CONCAT(1, 2) +CONCAT(CON, CAT(1, 2)) +//R #line 24 "t_1_003.cpp" +//R 12 +CONCAT(CONCAT_, INDIRECT)()(1, 2) +//R #line 27 "t_1_003.cpp" +//R CONCAT(1, 2) +CONCAT(CONCAT_, INDIRECT())(1, 2) + +//R #line 31 "t_1_003.cpp" +//R 1 CONCAT(2, 3) +CONCAT(1, CONCAT(2, 3)) + +//H 10: t_1_003.cpp(13): #define +//H 08: t_1_003.cpp(13): CONCAT(a, b)=a ## b +//H 10: t_1_003.cpp(14): #define +//H 08: t_1_003.cpp(14): CONCAT_INDIRECT()=CONCAT +//H 00: t_1_003.cpp(18): CONCAT(CON, CAT), [t_1_003.cpp(13): CONCAT(a, b)=a ## b] +//H 02: CONCAT +//H 03: CONCAT +//H 00: t_1_003.cpp(21): CONCAT(CON, CAT(1, 2)), [t_1_003.cpp(13): CONCAT(a, b)=a ## b] +//H 02: CONCAT(1, 2) +//H 03: CONCAT(1, 2) +//H 00: t_1_003.cpp(24): CONCAT(CONCAT_, INDIRECT), [t_1_003.cpp(13): CONCAT(a, b)=a ## b] +//H 02: CONCAT_INDIRECT +//H 03: CONCAT_INDIRECT +//H 00: t_1_003.cpp(24): CONCAT_INDIRECT(), [t_1_003.cpp(14): CONCAT_INDIRECT()=CONCAT] +//H 02: CONCAT +//H 03: CONCAT +//H 00: t_1_003.cpp(14): CONCAT(1, 2), [t_1_003.cpp(13): CONCAT(a, b)=a ## b] +//H 02: 12 +//H 03: 12 +//H 00: t_1_003.cpp(27): CONCAT(CONCAT_, INDIRECT()), [t_1_003.cpp(13): CONCAT(a, b)=a ## b] +//H 02: CONCAT_INDIRECT() +//H 00: t_1_003.cpp(27): CONCAT_INDIRECT(), [t_1_003.cpp(14): CONCAT_INDIRECT()=CONCAT] +//H 02: CONCAT +//H 03: CONCAT +//H 03: CONCAT +//H 00: t_1_003.cpp(31): CONCAT(1, CONCAT(2, 3)), [t_1_003.cpp(13): CONCAT(a, b)=a ## b] +//H 02: 1CONCAT(2, 3) +//H 03: 1CONCAT(2, 3) diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_004.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_004.cpp new file mode 100644 index 000000000..bfcd320cc --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_004.cpp @@ -0,0 +1,88 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O --variadics + +// Tests macro expansion order in conjunction with the need to skip expansion +// of the same macro as it is currently expanded. + +#define CONCAT(a, b) a ## b +#define CONCAT_INDIRECT() CONCAT + +//R #line 20 "t_1_004.cpp" +//R CONCAT(1, 2) +CONCAT(CON, CAT)(1, 2) +//R #line 23 "t_1_004.cpp" +//R CONCAT(1, 2) +CONCAT(CON, CAT(1, 2)) +//R #line 26 "t_1_004.cpp" +//R 12 +CONCAT(CONCAT_, INDIRECT)()(1, 2) +//R #line 29 "t_1_004.cpp" +//R CONCAT(1, 2) +CONCAT(CONCAT_, INDIRECT())(1, 2) +//R #line 32 "t_1_004.cpp" +//R 1 CONCAT(2, 3) +CONCAT(1, CONCAT(2, 3)) + +//H 10: t_1_004.cpp(15): #define +//H 08: t_1_004.cpp(15): CONCAT(a, b)=a ## b +//H 10: t_1_004.cpp(16): #define +//H 08: t_1_004.cpp(16): CONCAT_INDIRECT()=CONCAT +//H 00: t_1_004.cpp(20): CONCAT(CON, CAT), [t_1_004.cpp(15): CONCAT(a, b)=a ## b] +//H 02: CONCAT +//H 03: CONCAT +//H 00: t_1_004.cpp(23): CONCAT(CON, CAT(1, 2)), [t_1_004.cpp(15): CONCAT(a, b)=a ## b] +//H 02: CONCAT(1, 2) +//H 03: CONCAT(1, 2) +//H 00: t_1_004.cpp(26): CONCAT(CONCAT_, INDIRECT), [t_1_004.cpp(15): CONCAT(a, b)=a ## b] +//H 02: CONCAT_INDIRECT +//H 03: CONCAT_INDIRECT +//H 00: t_1_004.cpp(26): CONCAT_INDIRECT(), [t_1_004.cpp(16): CONCAT_INDIRECT()=CONCAT] +//H 02: CONCAT +//H 03: CONCAT +//H 00: t_1_004.cpp(16): CONCAT(1, 2), [t_1_004.cpp(15): CONCAT(a, b)=a ## b] +//H 02: 12 +//H 03: 12 +//H 00: t_1_004.cpp(29): CONCAT(CONCAT_, INDIRECT()), [t_1_004.cpp(15): CONCAT(a, b)=a ## b] +//H 02: CONCAT_INDIRECT() +//H 00: t_1_004.cpp(29): CONCAT_INDIRECT(), [t_1_004.cpp(16): CONCAT_INDIRECT()=CONCAT] +//H 02: CONCAT +//H 03: CONCAT +//H 03: CONCAT +//H 00: t_1_004.cpp(32): CONCAT(1, CONCAT(2, 3)), [t_1_004.cpp(15): CONCAT(a, b)=a ## b] +//H 02: 1CONCAT(2, 3) +//H 03: 1CONCAT(2, 3) + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_005.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_005.cpp new file mode 100644 index 000000000..d8e880789 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_005.cpp @@ -0,0 +1,27 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests macro expansion order. + +#define A() B +#define B(x) x + +//R #line 16 "t_1_005.cpp" +A()(123) //R 123 + +//H 10: t_1_005.cpp(12): #define +//H 08: t_1_005.cpp(12): A()=B +//H 10: t_1_005.cpp(13): #define +//H 08: t_1_005.cpp(13): B(x)=x +//H 00: t_1_005.cpp(16): A(), [t_1_005.cpp(12): A()=B] +//H 02: B +//H 03: B +//H 00: t_1_005.cpp(12): B(123), [t_1_005.cpp(13): B(x)=x] +//H 02: 123 +//H 03: 123 diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_006.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_006.cpp new file mode 100644 index 000000000..063518105 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_006.cpp @@ -0,0 +1,54 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests the correctness of parameter replacement, if the parameter is +// adjacent to an operator '##'. + +#define CONCAT(a, b) PRIMITIVE_CONCAT(a, b) +#define PRIMITIVE_CONCAT(a, b) a ## b + +//R #line 18 "t_1_006.cpp" +//R 123 +CONCAT(1, PRIMITIVE_CONCAT(2, 3)) +//R #line 21 "t_1_006.cpp" +//R 123 +CONCAT(1, CONCAT(2, 3)) +// E t_1_006.cpp(23): error: pasting the following two tokens does not give a valid preprocessing token: "1" and "CONCAT" +//R #line 25 "t_1_006.cpp" +//R 1 CONCAT(2, 3) +PRIMITIVE_CONCAT(1, CONCAT(2, 3)) + +//H 10: t_1_006.cpp(13): #define +//H 08: t_1_006.cpp(13): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b) +//H 10: t_1_006.cpp(14): #define +//H 08: t_1_006.cpp(14): PRIMITIVE_CONCAT(a, b)=a ## b +//H 00: t_1_006.cpp(18): CONCAT(1, PRIMITIVE_CONCAT(2, 3)), [t_1_006.cpp(13): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)] +//H 00: t_1_006.cpp(18): PRIMITIVE_CONCAT(2, 3), [t_1_006.cpp(14): PRIMITIVE_CONCAT(a, b)=a ## b] +//H 02: 23 +//H 03: 23 +//H 02: PRIMITIVE_CONCAT(1, 23) +//H 00: t_1_006.cpp(13): PRIMITIVE_CONCAT(1, 23), [t_1_006.cpp(14): PRIMITIVE_CONCAT(a, b)=a ## b] +//H 02: 123 +//H 03: 123 +//H 03: 123 +//H 00: t_1_006.cpp(21): CONCAT(1, CONCAT(2, 3)), [t_1_006.cpp(13): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)] +//H 00: t_1_006.cpp(21): CONCAT(2, 3), [t_1_006.cpp(13): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)] +//H 02: PRIMITIVE_CONCAT(2, 3) +//H 00: t_1_006.cpp(13): PRIMITIVE_CONCAT(2, 3), [t_1_006.cpp(14): PRIMITIVE_CONCAT(a, b)=a ## b] +//H 02: 23 +//H 03: 23 +//H 03: 23 +//H 02: PRIMITIVE_CONCAT(1, 23) +//H 00: t_1_006.cpp(13): PRIMITIVE_CONCAT(1, 23), [t_1_006.cpp(14): PRIMITIVE_CONCAT(a, b)=a ## b] +//H 02: 123 +//H 03: 123 +//H 03: 123 +//H 00: t_1_006.cpp(25): PRIMITIVE_CONCAT(1, CONCAT(2, 3)), [t_1_006.cpp(14): PRIMITIVE_CONCAT(a, b)=a ## b] +//H 02: 1CONCAT(2, 3) +//H 03: 1CONCAT(2, 3) diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_007.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_007.cpp new file mode 100644 index 000000000..57e796f8f --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_007.cpp @@ -0,0 +1,55 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O --variadics + +// Tests the correctness of parameter replacement, if the parameter is +// adjacent to an operator '##'. + +#define CONCAT(a, b) PRIMITIVE_CONCAT(a, b) +#define PRIMITIVE_CONCAT(a, b) a ## b + +//R #line 20 "t_1_007.cpp" +//R 123 +CONCAT(1, PRIMITIVE_CONCAT(2, 3)) +//R #line 23 "t_1_007.cpp" +//R 123 +CONCAT(1, CONCAT(2, 3)) +//R #line 26 "t_1_007.cpp" +//R 1 CONCAT(2, 3) +PRIMITIVE_CONCAT(1, CONCAT(2, 3)) + +//H 10: t_1_007.cpp(15): #define +//H 08: t_1_007.cpp(15): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b) +//H 10: t_1_007.cpp(16): #define +//H 08: t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b +//H 00: t_1_007.cpp(20): CONCAT(1, PRIMITIVE_CONCAT(2, 3)), [t_1_007.cpp(15): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)] +//H 00: t_1_007.cpp(20): PRIMITIVE_CONCAT(2, 3), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b] +//H 02: 23 +//H 03: 23 +//H 02: PRIMITIVE_CONCAT(1, 23) +//H 00: t_1_007.cpp(15): PRIMITIVE_CONCAT(1, 23), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b] +//H 02: 123 +//H 03: 123 +//H 03: 123 +//H 00: t_1_007.cpp(23): CONCAT(1, CONCAT(2, 3)), [t_1_007.cpp(15): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)] +//H 00: t_1_007.cpp(23): CONCAT(2, 3), [t_1_007.cpp(15): CONCAT(a, b)=PRIMITIVE_CONCAT(a, b)] +//H 02: PRIMITIVE_CONCAT(2, 3) +//H 00: t_1_007.cpp(15): PRIMITIVE_CONCAT(2, 3), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b] +//H 02: 23 +//H 03: 23 +//H 03: 23 +//H 02: PRIMITIVE_CONCAT(1, 23) +//H 00: t_1_007.cpp(15): PRIMITIVE_CONCAT(1, 23), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b] +//H 02: 123 +//H 03: 123 +//H 03: 123 +//H 00: t_1_007.cpp(26): PRIMITIVE_CONCAT(1, CONCAT(2, 3)), [t_1_007.cpp(16): PRIMITIVE_CONCAT(a, b)=a ## b] +//H 02: 1CONCAT(2, 3) +//H 03: 1CONCAT(2, 3) diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_008.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_008.cpp new file mode 100644 index 000000000..99034f3b3 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_008.cpp @@ -0,0 +1,145 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// The follwoing is a parametized partially expanding concatenation macro. +// It is a extremly good test of expansion order and the order of operations +// during macro expansion in general. + +#define CAT(a, b) a ## b + +#define PARTIAL_CAT(i) CAT(PARTIAL_CAT_, i) + +#define PARTIAL_CAT_0(a, b) CAT(a, b) +#define PARTIAL_CAT_1(a, b) CAT(PARTIAL ## a, b) +#define PARTIAL_CAT_2(a, b) CAT(a, b ## PARTIAL) +#define PARTIAL_CAT_3(a, b) CAT(PARTIAL ## a, b ## PARTIAL) + +#define PARTIAL +#define PARTIALPARTIAL + +#define X Token1 +#define Y Token2 + +//R #line 31 "t_1_008.cpp" +//R Token1Token2 +PARTIAL_CAT(0)( PARTIAL X, Y PARTIAL ) +//R #line 34 "t_1_008.cpp" +//R XToken2 +PARTIAL_CAT(1)( PARTIAL X, Y PARTIAL ) +//R #line 37 "t_1_008.cpp" +//R Token1Y +PARTIAL_CAT(2)( PARTIAL X, Y PARTIAL ) +//R #line 40 "t_1_008.cpp" +//R XY +PARTIAL_CAT(3)( PARTIAL X, Y PARTIAL ) + +//H 10: t_1_008.cpp(14): #define +//H 08: t_1_008.cpp(14): CAT(a, b)=a ## b +//H 10: t_1_008.cpp(16): #define +//H 08: t_1_008.cpp(16): PARTIAL_CAT(i)=CAT(PARTIAL_CAT_, i) +//H 10: t_1_008.cpp(18): #define +//H 08: t_1_008.cpp(18): PARTIAL_CAT_0(a, b)=CAT(a, b) +//H 10: t_1_008.cpp(19): #define +//H 08: t_1_008.cpp(19): PARTIAL_CAT_1(a, b)=CAT(PARTIAL ## a, b) +//H 10: t_1_008.cpp(20): #define +//H 08: t_1_008.cpp(20): PARTIAL_CAT_2(a, b)=CAT(a, b ## PARTIAL) +//H 10: t_1_008.cpp(21): #define +//H 08: t_1_008.cpp(21): PARTIAL_CAT_3(a, b)=CAT(PARTIAL ## a, b ## PARTIAL) +//H 10: t_1_008.cpp(23): #define +//H 08: t_1_008.cpp(23): PARTIAL= +//H 10: t_1_008.cpp(24): #define +//H 08: t_1_008.cpp(24): PARTIALPARTIAL= +//H 10: t_1_008.cpp(26): #define +//H 08: t_1_008.cpp(26): X=Token1 +//H 10: t_1_008.cpp(27): #define +//H 08: t_1_008.cpp(27): Y=Token2 +//H 00: t_1_008.cpp(31): PARTIAL_CAT(0), [t_1_008.cpp(16): PARTIAL_CAT(i)=CAT(PARTIAL_CAT_, i)] +//H 02: CAT(PARTIAL_CAT_, 0) +//H 00: t_1_008.cpp(16): CAT(PARTIAL_CAT_, 0), [t_1_008.cpp(14): CAT(a, b)=a ## b] +//H 02: PARTIAL_CAT_0 +//H 03: PARTIAL_CAT_0 +//H 03: PARTIAL_CAT_0 +//H 00: t_1_008.cpp(16): PARTIAL_CAT_0( PARTIAL X, Y PARTIAL ), [t_1_008.cpp(18): PARTIAL_CAT_0(a, b)=CAT(a, b)] +//H 01: t_1_008.cpp(23): PARTIAL +//H 02: +//H 03: _ +//H 01: t_1_008.cpp(26): X +//H 02: Token1 +//H 03: Token1 +//H 01: t_1_008.cpp(27): Y +//H 02: Token2 +//H 03: Token2 +//H 01: t_1_008.cpp(23): PARTIAL +//H 02: +//H 03: _ +//H 02: CAT( Token1, Token2 ) +//H 00: t_1_008.cpp(18): CAT( Token1, Token2 ), [t_1_008.cpp(14): CAT(a, b)=a ## b] +//H 02: Token1Token2 +//H 03: Token1Token2 +//H 03: Token1Token2 +//H 00: t_1_008.cpp(34): PARTIAL_CAT(1), [t_1_008.cpp(16): PARTIAL_CAT(i)=CAT(PARTIAL_CAT_, i)] +//H 02: CAT(PARTIAL_CAT_, 1) +//H 00: t_1_008.cpp(16): CAT(PARTIAL_CAT_, 1), [t_1_008.cpp(14): CAT(a, b)=a ## b] +//H 02: PARTIAL_CAT_1 +//H 03: PARTIAL_CAT_1 +//H 03: PARTIAL_CAT_1 +//H 00: t_1_008.cpp(16): PARTIAL_CAT_1( PARTIAL X, Y PARTIAL ), [t_1_008.cpp(19): PARTIAL_CAT_1(a, b)=CAT(PARTIAL ## a, b)] +//H 01: t_1_008.cpp(27): Y +//H 02: Token2 +//H 03: Token2 +//H 01: t_1_008.cpp(23): PARTIAL +//H 02: +//H 03: _ +//H 02: CAT(PARTIALPARTIAL X, Token2 ) +//H 00: t_1_008.cpp(19): CAT(PARTIALPARTIAL X, Token2 ), [t_1_008.cpp(14): CAT(a, b)=a ## b] +//H 02: PARTIALPARTIAL XToken2 +//H 01: t_1_008.cpp(24): PARTIALPARTIAL +//H 02: +//H 03: _ +//H 03: XToken2 +//H 03: XToken2 +//H 00: t_1_008.cpp(37): PARTIAL_CAT(2), [t_1_008.cpp(16): PARTIAL_CAT(i)=CAT(PARTIAL_CAT_, i)] +//H 02: CAT(PARTIAL_CAT_, 2) +//H 00: t_1_008.cpp(16): CAT(PARTIAL_CAT_, 2), [t_1_008.cpp(14): CAT(a, b)=a ## b] +//H 02: PARTIAL_CAT_2 +//H 03: PARTIAL_CAT_2 +//H 03: PARTIAL_CAT_2 +//H 00: t_1_008.cpp(16): PARTIAL_CAT_2( PARTIAL X, Y PARTIAL ), [t_1_008.cpp(20): PARTIAL_CAT_2(a, b)=CAT(a, b ## PARTIAL)] +//H 01: t_1_008.cpp(23): PARTIAL +//H 02: +//H 03: _ +//H 01: t_1_008.cpp(26): X +//H 02: Token1 +//H 03: Token1 +//H 02: CAT( Token1, Y PARTIALPARTIAL) +//H 00: t_1_008.cpp(20): CAT( Token1, Y PARTIALPARTIAL), [t_1_008.cpp(14): CAT(a, b)=a ## b] +//H 02: Token1Y PARTIALPARTIAL +//H 01: t_1_008.cpp(24): PARTIALPARTIAL +//H 02: +//H 03: _ +//H 03: Token1Y_ +//H 03: Token1Y_ +//H 00: t_1_008.cpp(40): PARTIAL_CAT(3), [t_1_008.cpp(16): PARTIAL_CAT(i)=CAT(PARTIAL_CAT_, i)] +//H 02: CAT(PARTIAL_CAT_, 3) +//H 00: t_1_008.cpp(16): CAT(PARTIAL_CAT_, 3), [t_1_008.cpp(14): CAT(a, b)=a ## b] +//H 02: PARTIAL_CAT_3 +//H 03: PARTIAL_CAT_3 +//H 03: PARTIAL_CAT_3 +//H 00: t_1_008.cpp(16): PARTIAL_CAT_3( PARTIAL X, Y PARTIAL ), [t_1_008.cpp(21): PARTIAL_CAT_3(a, b)=CAT(PARTIAL ## a, b ## PARTIAL)] +//H 02: CAT(PARTIALPARTIAL X, Y PARTIALPARTIAL) +//H 00: t_1_008.cpp(21): CAT(PARTIALPARTIAL X, Y PARTIALPARTIAL), [t_1_008.cpp(14): CAT(a, b)=a ## b] +//H 02: PARTIALPARTIAL XY PARTIALPARTIAL +//H 01: t_1_008.cpp(24): PARTIALPARTIAL +//H 02: +//H 03: _ +//H 01: t_1_008.cpp(24): PARTIALPARTIAL +//H 02: +//H 03: _ +//H 03: XY_ +//H 03: XY_ diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_009.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_009.cpp new file mode 100644 index 000000000..914ec6b72 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_009.cpp @@ -0,0 +1,29 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Test, if wrongly placed '##' operators are detected + +#define TEST1() A ## B +#define TEST2() ## A + +//R #line 17 "t_1_009.cpp" +//R AB +TEST1() +//E t_1_009.cpp(19): error: ill formed preprocessing operator: concat ('##') +TEST2() // error + +//H 10: t_1_009.cpp(12): #define +//H 08: t_1_009.cpp(12): TEST1()=A ## B +//H 10: t_1_009.cpp(13): #define +//H 08: t_1_009.cpp(13): TEST2()=## A +//H 00: t_1_009.cpp(17): TEST1(), [t_1_009.cpp(12): TEST1()=A ## B] +//H 02: AB +//H 03: AB +//H 00: t_1_009.cpp(19): TEST2(), [t_1_009.cpp(13): TEST2()=## A] +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_010.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_010.cpp new file mode 100644 index 000000000..fda84df66 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_010.cpp @@ -0,0 +1,29 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Test, if wrongly placed '##' operators are detected + +#define TEST1() A ## B +#define TEST2() A ## + +//R #line 17 "t_1_010.cpp" +//R AB +TEST1() +//E t_1_010.cpp(19): error: ill formed preprocessing operator: concat ('##') +TEST2() // error + +//H 10: t_1_010.cpp(12): #define +//H 08: t_1_010.cpp(12): TEST1()=A ## B +//H 10: t_1_010.cpp(13): #define +//H 08: t_1_010.cpp(13): TEST2()=A ## +//H 00: t_1_010.cpp(17): TEST1(), [t_1_010.cpp(12): TEST1()=A ## B] +//H 02: AB +//H 03: AB +//H 00: t_1_010.cpp(19): TEST2(), [t_1_010.cpp(13): TEST2()=A ##] +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_011.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_011.cpp new file mode 100644 index 000000000..ed1b7b6c4 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_011.cpp @@ -0,0 +1,32 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Test if macros at not used parameter positions are expanded correctly + +#define MACRO() /**/ +#define ID(x) // parameter not used at all +#define CAT(x) X ## x // expanded parameter not used + +ID( MACRO(*) ) +//R #line 19 "t_1_011.cpp" +//R XMACRO(*) +CAT( MACRO(*) ) + +//H 10: t_1_011.cpp(12): #define +//H 08: t_1_011.cpp(12): MACRO()= +//H 10: t_1_011.cpp(13): #define +//H 08: t_1_011.cpp(13): ID(x)= +//H 10: t_1_011.cpp(14): #define +//H 08: t_1_011.cpp(14): CAT(x)=X ## x +//H 00: t_1_011.cpp(16): ID( MACRO(*) ), [t_1_011.cpp(13): ID(x)=] +//H 02: +//H 03: _ +//H 00: t_1_011.cpp(19): CAT( MACRO(*) ), [t_1_011.cpp(14): CAT(x)=X ## x] +//H 02: XMACRO(*) +//H 03: XMACRO(*) diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_012.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_012.cpp new file mode 100644 index 000000000..c42a06909 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_012.cpp @@ -0,0 +1,57 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Test, if function like macros are correctly expanded if used as object like +// macros + +#define CAT(a, b) a ## b +#define ARGS (1, 2) + +//R #line 18 "t_1_012.cpp" +//R CAT (1, 2) +CAT ARGS + +#define INVOKE(macro) macro ARGS + +//R #line 24 "t_1_012.cpp" +//R CAT (1, 2) +INVOKE(CAT) + +#define EXPAND(x) x + +//R #line 30 "t_1_012.cpp" +//R 12 +EXPAND(CAT ARGS) + +//H 10: t_1_012.cpp(13): #define +//H 08: t_1_012.cpp(13): CAT(a, b)=a ## b +//H 10: t_1_012.cpp(14): #define +//H 08: t_1_012.cpp(14): ARGS=(1, 2) +//H 01: t_1_012.cpp(14): ARGS +//H 02: (1, 2) +//H 03: (1, 2) +//H 10: t_1_012.cpp(20): #define +//H 08: t_1_012.cpp(20): INVOKE(macro)=macro ARGS +//H 00: t_1_012.cpp(24): INVOKE(CAT), [t_1_012.cpp(20): INVOKE(macro)=macro ARGS] +//H 02: CAT ARGS +//H 01: t_1_012.cpp(14): ARGS +//H 02: (1, 2) +//H 03: (1, 2) +//H 03: CAT (1, 2) +//H 10: t_1_012.cpp(26): #define +//H 08: t_1_012.cpp(26): EXPAND(x)=x +//H 00: t_1_012.cpp(30): EXPAND(CAT ARGS), [t_1_012.cpp(26): EXPAND(x)=x] +//H 01: t_1_012.cpp(14): ARGS +//H 02: (1, 2) +//H 03: (1, 2) +//H 02: CAT (1, 2) +//H 00: t_1_012.cpp(30): CAT(1, 2), [t_1_012.cpp(13): CAT(a, b)=a ## b] +//H 02: 12 +//H 03: 12 +//H 03: 12 diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_013.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_013.cpp new file mode 100644 index 000000000..1746afb82 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_013.cpp @@ -0,0 +1,89 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// This sample is taken from the C++ standard 16.3.5.6 [cpp.scope] and was +// slightly modified (removed the '#include' directive) + +#define str(s) # s +#define xstr(s) str(s) +#define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \ +x ## s, x ## t) +#define INCFILE(n) vers ## n /* from previous #include example */ +#define glue(a, b) a ## b +#define xglue(a, b) glue(a, b) +#define HIGHLOW "hello" +#define LOW LOW ", world" +debug(1, 2); +fputs(str(strncmp("abc\0d?", "abc", '\4', "\u1234") /* this goes away */ +== 0) str(: @\n), s); +/*#include*/ xstr(INCFILE(2).hpp) +glue(HIGH, LOW); +xglue(HIGH, LOW) + +// should expand to +//R #line 22 "t_1_013.cpp" +//R printf("x" "1" "= %d, x" "2" "= %s", x1, x2); +//R fputs("strncmp(\"abc\\0d\?\", \"abc\", '\\4', \"\\u1234\") == 0" ": @\n", s); +//R +//R "vers2.hpp" +//R "hello"; +//R "hello" ", world" + +//H 10: t_1_013.cpp(13): #define +//H 08: t_1_013.cpp(13): str(s)=# s +//H 10: t_1_013.cpp(14): #define +//H 08: t_1_013.cpp(14): xstr(s)=str(s) +//H 10: t_1_013.cpp(15): #define +//H 08: t_1_013.cpp(15): debug(s, t)=printf("x" # s "= %d, x" # t "= %s", x ## s, x ## t) +//H 10: t_1_013.cpp(17): #define +//H 08: t_1_013.cpp(17): INCFILE(n)=vers ## n +//H 10: t_1_013.cpp(18): #define +//H 08: t_1_013.cpp(18): glue(a, b)=a ## b +//H 10: t_1_013.cpp(19): #define +//H 08: t_1_013.cpp(19): xglue(a, b)=glue(a, b) +//H 10: t_1_013.cpp(20): #define +//H 08: t_1_013.cpp(20): HIGHLOW="hello" +//H 10: t_1_013.cpp(21): #define +//H 08: t_1_013.cpp(21): LOW=LOW ", world" +//H 00: t_1_013.cpp(22): debug(1, 2), [t_1_013.cpp(15): debug(s, t)=printf("x" # s "= %d, x" # t "= %s", x ## s, x ## t)] +//H 02: printf("x" "1" "= %d, x" "2" "= %s", x1, x2) +//H 03: printf("x" "1" "= %d, x" "2" "= %s", x1, x2) +//H 00: t_1_013.cpp(23): str(strncmp("abc\0d?", "abc", '\4', "\u1234") == 0), [t_1_013.cpp(13): str(s)=# s] +//H 02: "strncmp(\"abc\\0d\?\", \"abc\", '\\4', \"\\u1234\") == 0" +//H 03: "strncmp(\"abc\\0d\?\", \"abc\", '\\4', \"\\u1234\") == 0" +//H 00: t_1_013.cpp(24): str(: @\n), [t_1_013.cpp(13): str(s)=# s] +//H 02: ": @\n" +//H 03: ": @\n" +//H 00: t_1_013.cpp(25): xstr(INCFILE(2).hpp), [t_1_013.cpp(14): xstr(s)=str(s)] +//H 00: t_1_013.cpp(25): INCFILE(2), [t_1_013.cpp(17): INCFILE(n)=vers ## n] +//H 02: vers2 +//H 03: vers2 +//H 02: str(vers2.hpp) +//H 00: t_1_013.cpp(14): str(vers2.hpp), [t_1_013.cpp(13): str(s)=# s] +//H 02: "vers2.hpp" +//H 03: "vers2.hpp" +//H 03: "vers2.hpp" +//H 00: t_1_013.cpp(26): glue(HIGH, LOW), [t_1_013.cpp(18): glue(a, b)=a ## b] +//H 02: HIGHLOW +//H 01: t_1_013.cpp(20): HIGHLOW +//H 02: "hello" +//H 03: "hello" +//H 03: "hello" +//H 00: t_1_013.cpp(27): xglue(HIGH, LOW), [t_1_013.cpp(19): xglue(a, b)=glue(a, b)] +//H 01: t_1_013.cpp(21): LOW +//H 02: LOW ", world" +//H 03: LOW ", world" +//H 02: glue(HIGH, LOW ", world") +//H 00: t_1_013.cpp(19): glue(HIGH, LOW ", world"), [t_1_013.cpp(18): glue(a, b)=a ## b] +//H 02: HIGHLOW ", world" +//H 01: t_1_013.cpp(20): HIGHLOW +//H 02: "hello" +//H 03: "hello" +//H 03: "hello" ", world" +//H 03: "hello" ", world" diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_014.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_014.cpp new file mode 100644 index 000000000..32df363d4 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_014.cpp @@ -0,0 +1,35 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// This sample is taken from the C++ standard 16.3.5.5 [cpp.scope] + +// Currently this test fails due to a pathologic border case, which is included +// here. Wave currently does not support expanding macros, where the +// replacement-list terminates in partial macro expansion (such as the +// definition of the macro h below). This will be fixed in a future release. + +#define x 3 +#define f(a) f(x * (a)) +#undef x +#define x 2 +#define g f +#define z z[0] +#define h g( ~ +#define m(a) a(w) +#define w 0,1 +#define t(a) a +f(y+1) + f(f(z)) % t(t(g)(0) + t)(1); +g(x+(3,4)-w) +h 5) & m(f)^m(m); + +//R #line 27 "t_1_014.cpp" +//R f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1); +//R f(2 * (2+(3,4)-0,1)) +//E t_1_014.cpp(29): error: improperly terminated macro invocation or replacement-list terminates in partial macro expansion (not supported yet): missing ')' +// should expand to: f(2 * g( ~ 5)) & f(2 * (0,1))^m(0,1); diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_015.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_015.cpp new file mode 100644 index 000000000..6a20c5b49 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_015.cpp @@ -0,0 +1,25 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests, if the recursive replacement of a macro is correctly handled + +#define f(x) (4-f(x)) + +//R #line 16 "t_1_015.cpp" +//R (4-f((4-f(1)))) +f(f(1)) + +//H 10: t_1_015.cpp(12): #define +//H 08: t_1_015.cpp(12): f(x)=(4-f(x)) +//H 00: t_1_015.cpp(16): f(f(1)), [t_1_015.cpp(12): f(x)=(4-f(x))] +//H 00: t_1_015.cpp(16): f(1), [t_1_015.cpp(12): f(x)=(4-f(x))] +//H 02: (4-f(1)) +//H 03: (4-f(1)) +//H 02: (4-f((4-f(1)))) +//H 03: (4-f((4-f(1)))) diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_016.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_016.cpp new file mode 100644 index 000000000..d389e3c08 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_016.cpp @@ -0,0 +1,29 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests continuing scanning into the underlying input stream after expanding +// a macro, if this is appropriate + +#define A Token1 B +#define B() Token2 + +//R #line 18 "t_1_016.cpp" +//R Token1 Token2 +A() + +//H 10: t_1_016.cpp(13): #define +//H 08: t_1_016.cpp(13): A=Token1 B +//H 10: t_1_016.cpp(14): #define +//H 08: t_1_016.cpp(14): B()=Token2 +//H 01: t_1_016.cpp(13): A +//H 02: Token1 B +//H 03: Token1 B +//H 00: t_1_016.cpp(13): B(), [t_1_016.cpp(14): B()=Token2] +//H 02: Token2 +//H 03: Token2 diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_017.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_017.cpp new file mode 100644 index 000000000..9d025d2f8 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_017.cpp @@ -0,0 +1,31 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests macro expansion sequence and proper rescanning + +#define macro() end + +#define par() () + +#define expr macro par par par() + +#define scan(x) x + +//R #line 22 "t_1_017.cpp" +//R macro par par () +expr +//R #line 25 "t_1_017.cpp" +//R macro par () +scan(expr) +//R #line 28 "t_1_017.cpp" +//R macro () +scan(scan(expr)) +//R #line 31 "t_1_017.cpp" +//R end +scan(scan(scan(expr))) diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_018.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_018.cpp new file mode 100644 index 000000000..8e8444885 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_018.cpp @@ -0,0 +1,42 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests macro expansion sequence and proper rescanning + +#define macro() expr_2 +#define macro_2() expr + +#define par() () + +#define expr macro par () +#define expr_2 macro_2 par par par() + +#define scan(x) x + +//R #line 24 "t_1_018.cpp" +//R macro () +expr +//R #line 27 "t_1_018.cpp" +//R macro_2 par par () +scan(expr) +//R #line 30 "t_1_018.cpp" +//R macro_2 par () +scan(scan(expr)) +//R #line 33 "t_1_018.cpp" +//R macro_2 () +scan(scan(scan(expr))) +//R #line 36 "t_1_018.cpp" +//R macro () +scan(scan(scan(scan(expr)))) +//R #line 39 "t_1_018.cpp" +//R macro_2 par par () +scan(scan(scan(scan(scan(expr))))) +//R #line 42 "t_1_018.cpp" +//R macro_2 par () +scan(scan(scan(scan(scan(scan(expr)))))) diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_019.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_019.cpp new file mode 100644 index 000000000..1585bcdda --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_019.cpp @@ -0,0 +1,42 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests macro expansion sequence and proper rescanning + +#define macro() expr_2 +#define macro_2() expr + +#define par() () + +#define expr macro () +#define expr_2 macro_2 par par par() + +#define scan(x) x + +//R #line 24 "t_1_019.cpp" +//R macro_2 par par () +expr +//R #line 27 "t_1_019.cpp" +//R macro_2 par () +scan(expr) +//R #line 30 "t_1_019.cpp" +//R macro_2 () +scan(scan(expr)) +//R #line 33 "t_1_019.cpp" +//R macro_2 par par () +scan(scan(scan(expr))) +//R #line 36 "t_1_019.cpp" +//R macro_2 par () +scan(scan(scan(scan(expr)))) +//R #line 39 "t_1_019.cpp" +//R macro_2 () +scan(scan(scan(scan(scan(expr))))) +//R #line 42 "t_1_019.cpp" +//R macro_2 () +scan(scan(scan(scan(scan(scan(expr)))))) diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_020.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_020.cpp new file mode 100644 index 000000000..8c2673af7 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_020.cpp @@ -0,0 +1,34 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests the handling of placeholder tokens, which have to be inserted, when +// some macro expands into nothing (certainly these have to be ignored +// afterwards :-) + +#define NIL + +#define A B NIL +#define B() anything + +//R #line 21 "t_1_020.cpp" +//R B() +A() // not 'anything'! + +//H 10: t_1_020.cpp(14): #define +//H 08: t_1_020.cpp(14): NIL= +//H 10: t_1_020.cpp(16): #define +//H 08: t_1_020.cpp(16): A=B NIL +//H 10: t_1_020.cpp(17): #define +//H 08: t_1_020.cpp(17): B()=anything +//H 01: t_1_020.cpp(16): A +//H 02: B NIL +//H 01: t_1_020.cpp(14): NIL +//H 02: +//H 03: _ +//H 03: B_ diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_021.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_021.cpp new file mode 100644 index 000000000..0c3bdcbfc --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_021.cpp @@ -0,0 +1,41 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests continuing scanning into the underlying input stream after expanding +// a macro, if this is appropriate + +#define MACRO() X + Y NEXT +#define X 1 +#define Y 2 +#define NEXT() ... + +//R #line 20 "t_1_021.cpp" +//R 1 + 2 ... +MACRO()() + +//H 10: t_1_021.cpp(13): #define +//H 08: t_1_021.cpp(13): MACRO()=X + Y NEXT +//H 10: t_1_021.cpp(14): #define +//H 08: t_1_021.cpp(14): X=1 +//H 10: t_1_021.cpp(15): #define +//H 08: t_1_021.cpp(15): Y=2 +//H 10: t_1_021.cpp(16): #define +//H 08: t_1_021.cpp(16): NEXT()=... +//H 00: t_1_021.cpp(20): MACRO(), [t_1_021.cpp(13): MACRO()=X + Y NEXT] +//H 02: X + Y NEXT +//H 01: t_1_021.cpp(14): X +//H 02: 1 +//H 03: 1 +//H 01: t_1_021.cpp(15): Y +//H 02: 2 +//H 03: 2 +//H 03: 1 + 2 NEXT +//H 00: t_1_021.cpp(13): NEXT(), [t_1_021.cpp(16): NEXT()=...] +//H 02: ... +//H 03: ... diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_022.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_022.cpp new file mode 100644 index 000000000..809cd67b6 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_022.cpp @@ -0,0 +1,36 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests the validity of whitespace handling during macro expansion + +#define MACRO() 123 + +//R #line 16 "t_1_022.cpp" +//R 123 +MACRO() +//R #line 19 "t_1_022.cpp" +//R 123 +MACRO +() +//R #line 23 "t_1_022.cpp" +//R 123 +MACRO( +) + +//H 10: t_1_022.cpp(12): #define +//H 08: t_1_022.cpp(12): MACRO()=123 +//H 00: t_1_022.cpp(16): MACRO(), [t_1_022.cpp(12): MACRO()=123] +//H 02: 123 +//H 03: 123 +//H 00: t_1_022.cpp(19): MACRO(), [t_1_022.cpp(12): MACRO()=123] +//H 02: 123 +//H 03: 123 +//H 00: t_1_022.cpp(23): MACRO(), [t_1_022.cpp(12): MACRO()=123] +//H 02: 123 +//H 03: 123 diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_023.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_023.cpp new file mode 100644 index 000000000..a54adbd26 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_023.cpp @@ -0,0 +1,33 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests, if function-like macros buried deep inside a macro expansion of the +// same name as an object-like macro do not eat up more tokens, than expected. + +#define PRIMITIVE_CAT(a, b) a ## b + +#define EAT(n) PRIMITIVE_CAT(EAT_, n) +#define EAT_1(a) + +//R #line 20 "t_1_023.cpp" +//R EAT_1... +EAT(1)... + +//H 10: t_1_023.cpp(13): #define +//H 08: t_1_023.cpp(13): PRIMITIVE_CAT(a, b)=a ## b +//H 10: t_1_023.cpp(15): #define +//H 08: t_1_023.cpp(15): EAT(n)=PRIMITIVE_CAT(EAT_, n) +//H 10: t_1_023.cpp(16): #define +//H 08: t_1_023.cpp(16): EAT_1(a)= +//H 00: t_1_023.cpp(20): EAT(1), [t_1_023.cpp(15): EAT(n)=PRIMITIVE_CAT(EAT_, n)] +//H 02: PRIMITIVE_CAT(EAT_, 1) +//H 00: t_1_023.cpp(15): PRIMITIVE_CAT(EAT_, 1), [t_1_023.cpp(13): PRIMITIVE_CAT(a, b)=a ## b] +//H 02: EAT_1 +//H 03: EAT_1 +//H 03: EAT_1 diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_024.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_024.cpp new file mode 100644 index 000000000..b07cb9cc0 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_024.cpp @@ -0,0 +1,112 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests more complex macro expansion. + +// token-pasting macro +#define CAT(a, b) PRIMITIVE_CAT(a, b) +#define PRIMITIVE_CAT(a, b) a ## b + +// splits a value that is about to expand into two parameters and returns +// either the zero-th or one-th element. +#define SPLIT(n, im) PRIMITIVE_CAT(SPLIT_, n)(im) +#define SPLIT_0(a, b) a +#define SPLIT_1(a, b) b + +// detects if the parameter is nullary parentheses () or something else. +// passing non-nullary parenthesis is invalid input. +#define IS_NULLARY(expr) \ + SPLIT( \ + 0, \ + CAT(IS_NULLARY_R_, IS_NULLARY_T expr) \ + ) \ + /**/ +#define IS_NULLARY_T() 1 +#define IS_NULLARY_R_1 1, ? +#define IS_NULLARY_R_IS_NULLARY_T 0, ? + +// expands to a macro that eats an n-element parenthesized expression. +#define EAT(n) PRIMITIVE_CAT(EAT_, n) +#define EAT_0() +#define EAT_1(a) +#define EAT_2(a, b) +#define EAT_3(a, b, c) + +// expands to a macro that removes the parentheses from an n-element +// parenthesized expression +#define REM(n) PRIMITIVE_CAT(REM_, n) +#define REM_0() +#define REM_1(a) a +#define REM_2(a, b) a, b +#define REM_3(a, b, c) a, b, c + +// expands to nothing +#define NIL + +// expands to 1 if x is less than y otherwise, it expands to 0 +#define LESS(x, y) \ + IS_NULLARY( \ + PRIMITIVE_CAT(LESS_, y)( \ + EAT(1), PRIMITIVE_CAT(LESS_, x) \ + )() \ + ) \ + /**/ + +#define LESS_0(a, b) a(EAT(2)) b(REM(1), NIL) +#define LESS_1(a, b) a(LESS_0) b(REM(1), NIL) +#define LESS_2(a, b) a(LESS_1) b(REM(1), NIL) +#define LESS_3(a, b) a(LESS_2) b(REM(1), NIL) +#define LESS_4(a, b) a(LESS_3) b(REM(1), NIL) +#define LESS_5(a, b) a(LESS_4) b(REM(1), NIL) + +// expands to the binary one's compliment of a binary input value. i.e. 0 or 1 +#define COMPL(n) PRIMITIVE_CAT(COMPL_, n) +#define COMPL_0 1 +#define COMPL_1 0 + +// these do the obvious... +#define GREATER(x, y) LESS(y, x) +#define LESS_EQUAL(x, y) COMPL(LESS(y, x)) +#define GREATER_EQUAL(x, y) COMPL(LESS(x, y)) + +// causes another rescan... +#define SCAN(x) x + +// expands to 1 if x is not equal to y. this one contains a workaround... +#define NOT_EQUAL(x, y) \ + IS_NULLARY( \ + SCAN( \ + PRIMITIVE_CAT(LESS_, x)( \ + EAT(1), \ + PRIMITIVE_CAT(LESS_, y) EAT(2) \ + )((), ...) \ + ) \ + ) \ + /**/ +#define EQUAL(x, y) COMPL(NOT_EQUAL(x, y)) + +//R #line 95 "t_1_024.cpp" +LESS(2, 3) //R 1 +LESS(3, 2) //R 0 +LESS(3, 3) //R 0 +GREATER(2, 3) //R 0 +GREATER(3, 2) //R 1 +GREATER(3, 3) //R 0 +LESS_EQUAL(2, 3) //R 1 +LESS_EQUAL(3, 2) //R 0 +LESS_EQUAL(3, 3) //R 1 +GREATER_EQUAL(2, 3) //R 0 +GREATER_EQUAL(3, 2) //R 1 +GREATER_EQUAL(3, 3) //R 1 +NOT_EQUAL(2, 3) //R 1 +NOT_EQUAL(3, 2) //R 1 +NOT_EQUAL(3, 3) //R 0 +EQUAL(2, 3) //R 0 +EQUAL(3, 2) //R 0 +EQUAL(3, 3) //R 1 diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_025.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_025.cpp new file mode 100644 index 000000000..37a2409f9 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_025.cpp @@ -0,0 +1,35 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests, if macro expansion eats up follow up tokens under certain conditions +// (which it shouldn't). + +#define SCAN(x) x + +#define BUG BUG_2 +#define BUG_2 + +//R #line 19 "t_1_025.cpp" +SCAN(BUG) 1 2 3 4 5 //R 1 2 3 4 5 + +//H 10: t_1_025.cpp(13): #define +//H 08: t_1_025.cpp(13): SCAN(x)=x +//H 10: t_1_025.cpp(15): #define +//H 08: t_1_025.cpp(15): BUG=BUG_2 +//H 10: t_1_025.cpp(16): #define +//H 08: t_1_025.cpp(16): BUG_2= +//H 00: t_1_025.cpp(19): SCAN(BUG), [t_1_025.cpp(13): SCAN(x)=x] +//H 01: t_1_025.cpp(15): BUG +//H 02: BUG_2 +//H 01: t_1_025.cpp(16): BUG_2 +//H 02: +//H 03: _ +//H 03: _ +//H 02: +//H 03: _ diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_026.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_026.cpp new file mode 100644 index 000000000..df0cdcaa7 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_026.cpp @@ -0,0 +1,19 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Test error reporting for non-unique parameter names + +//E t_1_026.cpp(13): error: duplicate macro parameter name: x +#define MACRO(x, x) x + // ^ ^ this is illegal + +MACRO(1, 2) + +//H 10: t_1_026.cpp(13): #define +//H 18: boost::wave::macro_handling_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_027.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_027.cpp new file mode 100644 index 000000000..39ccb3acc --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_027.cpp @@ -0,0 +1,41 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests delayed macro expansion (rescanning) + +#define CONCAT_1(A, B) A ## B +#define CONCAT_2(A, B) CONCAT_1(A, B) + +#define DELAY(NAME) NAME + +#define A1 a +#define B1 b + +#define A2() a +#define B2() b + +#define LHS ( +#define RHS ) + +//R #line 27 "t_1_027.cpp" +DELAY(CONCAT_1)( a, b ) (); //R ab (); +DELAY(CONCAT_1)(A1, B1)(); //R A1B1(); +DELAY(CONCAT_1) LHS A1, B1 RHS (); //R CONCAT_1 ( a, b )(); +CONCAT_1 ( a, b ) (); //R ab (); +CONCAT_1 ( A1, B1 ) (); //R A1B1 (); +CONCAT_1 LHS a, b RHS (); //R CONCAT_1 ( a, b )(); +//R +DELAY(CONCAT_2)( a, b ) (); //R ab (); +DELAY(CONCAT_2)(A1, B1)(); //R ab(); +DELAY(CONCAT_2) LHS A1, B1 RHS (); //R CONCAT_2 ( a, b )(); +DELAY(CONCAT_2)(A2(), B2())(); //R ab(); +CONCAT_2 ( a, b ) (); //R ab (); +CONCAT_2 ( A1, B1 ) (); //R ab (); +CONCAT_2 LHS a, b RHS (); //R CONCAT_2 ( a, b )(); +CONCAT_2(A2(), B2())(); //R ab(); diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_028.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_028.cpp new file mode 100644 index 000000000..67def4af9 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_028.cpp @@ -0,0 +1,45 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests delayed macro expansion (rescanning) + +//O --variadics + +#define CONCAT_1(A, B) A ## B +#define CONCAT_2(A, B) CONCAT_1(A, B) + +#define DELAY(NAME) NAME + +#define A1 a +#define B1 b + +#define A2() a +#define B2() b + +#define LHS ( +#define RHS ) + +//R #line 29 "t_1_028.cpp" +DELAY(CONCAT_1)( a, b ) (); //R ab (); +DELAY(CONCAT_1)(A1, B1)(); //R A1B1(); +DELAY(CONCAT_1) LHS A1, B1 RHS (); //R CONCAT_1 ( a, b )(); +DELAY(CONCAT_1)(A2(), B2())(); //R a b(); +CONCAT_1 ( a, b ) (); //R ab (); +CONCAT_1 ( A1, B1 ) (); //R A1B1 (); +CONCAT_1 LHS a, b RHS (); //R CONCAT_1 ( a, b )(); +CONCAT_1(A2(), B2())(); //R a b(); +//R +DELAY(CONCAT_2)( a, b ) (); //R ab (); +DELAY(CONCAT_2)(A1, B1)(); //R ab(); +DELAY(CONCAT_2) LHS A1, B1 RHS (); //R CONCAT_2 ( a, b )(); +DELAY(CONCAT_2)(A2(), B2())(); //R ab(); +CONCAT_2 ( a, b ) (); //R ab (); +CONCAT_2 ( A1, B1 ) (); //R ab (); +CONCAT_2 LHS a, b RHS (); //R CONCAT_2 ( a, b )(); +CONCAT_2(A2(), B2())(); //R ab(); diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_029.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_029.cpp new file mode 100644 index 000000000..2cb1beb98 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_029.cpp @@ -0,0 +1,44 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests concatination of more than two parameters + +#define CAT3_1(a, b, c) a##b##c +#define CAT3_2(a, b, c) a ## b ## c + +#define CAT4_1(a, b, c, d) a##b##c##d +#define CAT4_2(a, b, c, d) a ## b ## c ## d + +//R #line 19 "t_1_029.cpp" +CAT3_1(1, 0, 0) //R 100 +CAT3_2(1, 0, 0) //R 100 +//R +CAT4_1(1, 0, 0, 2) //R 1002 +CAT4_2(1, 0, 0, 2) //R 1002 + +//H 10: t_1_029.cpp(12): #define +//H 08: t_1_029.cpp(12): CAT3_1(a, b, c)=a##b##c +//H 10: t_1_029.cpp(13): #define +//H 08: t_1_029.cpp(13): CAT3_2(a, b, c)=a ## b ## c +//H 10: t_1_029.cpp(15): #define +//H 08: t_1_029.cpp(15): CAT4_1(a, b, c, d)=a##b##c##d +//H 10: t_1_029.cpp(16): #define +//H 08: t_1_029.cpp(16): CAT4_2(a, b, c, d)=a ## b ## c ## d +//H 00: t_1_029.cpp(19): CAT3_1(1, 0, 0), [t_1_029.cpp(12): CAT3_1(a, b, c)=a##b##c] +//H 02: 100 +//H 03: 100 +//H 00: t_1_029.cpp(20): CAT3_2(1, 0, 0), [t_1_029.cpp(13): CAT3_2(a, b, c)=a ## b ## c] +//H 02: 100 +//H 03: 100 +//H 00: t_1_029.cpp(22): CAT4_1(1, 0, 0, 2), [t_1_029.cpp(15): CAT4_1(a, b, c, d)=a##b##c##d] +//H 02: 1002 +//H 03: 1002 +//H 00: t_1_029.cpp(23): CAT4_2(1, 0, 0, 2), [t_1_029.cpp(16): CAT4_2(a, b, c, d)=a ## b ## c ## d] +//H 02: 1002 +//H 03: 1002 diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_030.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_030.cpp new file mode 100644 index 000000000..bde34e3ec --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_030.cpp @@ -0,0 +1,33 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests, whether an empty macro prevents another macro from expansion + +#define EMPTY() +#define SCAN(x) x +#define MACRO(x) (x) + +//R #line 17 "t_1_030.cpp" +SCAN( MACRO EMPTY() )(1) //R (1) + +//H 10: t_1_030.cpp(12): #define +//H 08: t_1_030.cpp(12): EMPTY()= +//H 10: t_1_030.cpp(13): #define +//H 08: t_1_030.cpp(13): SCAN(x)=x +//H 10: t_1_030.cpp(14): #define +//H 08: t_1_030.cpp(14): MACRO(x)=(x) +//H 00: t_1_030.cpp(17): SCAN( MACRO EMPTY() ), [t_1_030.cpp(13): SCAN(x)=x] +//H 00: t_1_030.cpp(17): EMPTY(), [t_1_030.cpp(12): EMPTY()=] +//H 02: +//H 03: _ +//H 02: MACRO +//H 03: MACRO +//H 00: t_1_030.cpp(17): MACRO(1), [t_1_030.cpp(14): MACRO(x)=(x)] +//H 02: (1) +//H 03: (1) diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_031.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_031.cpp new file mode 100644 index 000000000..876795dcf --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_031.cpp @@ -0,0 +1,27 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests macro expansion using variadic macros + +//O --variadics + +#define is_empty(...) is_empty_ ## __VA_ARGS__ ## other + +//R #line 17 "t_1_031.cpp" +is_empty( + ) //R is_empty_+other +is_empty( +text ) //R is_empty_+textother + +//H 10: t_1_031.cpp(14): #define +//H 08: t_1_031.cpp(14): is_empty(...)=is_empty_ ## __VA_ARGS__ ## other +//H 00: t_1_031.cpp(17): is_empty( + ), [t_1_031.cpp(14): is_empty(...)=is_empty_ ## __VA_ARGS__ ## other] +//H 02: is_empty_+other +//H 03: is_empty_+other +//H 00: t_1_031.cpp(18): is_empty( +text ), [t_1_031.cpp(14): is_empty(...)=is_empty_ ## __VA_ARGS__ ## other] +//H 02: is_empty_+textother +//H 03: is_empty_+textother diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_032.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_032.cpp new file mode 100644 index 000000000..e523bb27c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_032.cpp @@ -0,0 +1,37 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Test partial macro evaluation using varidic macros + +//O --variadics + +#define cat(...) cat_i(__VA_ARGS__,,,,,) +#define cat_i(a, b, c, d, e, ...) \ + a ## b ## c ## d ## e \ + /**/ + +#define primitive_cat(a, b) a ## b + +#define partial_cat(x, y) cat(partial_cat_, x, y) + +#define partial_cat_00(a, b) partial_cat_f(, ## a, b ## ,) +#define partial_cat_01(a, b) partial_cat_f(, ## a, b ,) +#define partial_cat_10(a, b) partial_cat_f(, a, b ## ,) +#define partial_cat_11(a, b) partial_cat_f(, a, b ,) + +#define partial_cat_f(a, b, c, d) b ## c + +#define X Token1 +#define Y Token2 + +//R #line 34 "t_1_032.cpp" +partial_cat(0, 0)(X, Y) //R XY +partial_cat(0, 1)(X, Y) //R XToken2 +partial_cat(1, 0)(X, Y) //R Token1Y +partial_cat(1, 1)(X, Y) //R Token1Token2 diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_033.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_033.cpp new file mode 100644 index 000000000..9b7ccd2ca --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_033.cpp @@ -0,0 +1,35 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests the stringize operator in conjunction with varidic macros + +//O --variadics + +#define STR(...) #__VA_ARGS__ + +//R #line 17 "t_1_033.cpp" +STR(1, 2, 3) //R "1, 2, 3" +STR(1,2,3) //R "1,2,3" +STR(1 , 2 , 3) //R "1 , 2 , 3" +STR( 1 , 2 , 3 ) //R "1 , 2 , 3" + +//H 10: t_1_033.cpp(14): #define +//H 08: t_1_033.cpp(14): STR(...)=#__VA_ARGS__ +//H 00: t_1_033.cpp(17): STR(1, 2, 3), [t_1_033.cpp(14): STR(...)=#__VA_ARGS__] +//H 02: "1, 2, 3" +//H 03: "1, 2, 3" +//H 00: t_1_033.cpp(18): STR(1,2,3), [t_1_033.cpp(14): STR(...)=#__VA_ARGS__] +//H 02: "1,2,3" +//H 03: "1,2,3" +//H 00: t_1_033.cpp(19): STR(1 , 2 , 3), [t_1_033.cpp(14): STR(...)=#__VA_ARGS__] +//H 02: "1 , 2 , 3" +//H 03: "1 , 2 , 3" +//H 00: t_1_033.cpp(20): STR( 1 , 2 , 3 ), [t_1_033.cpp(14): STR(...)=#__VA_ARGS__] +//H 02: "1 , 2 , 3" +//H 03: "1 , 2 , 3" diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_034.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_034.cpp new file mode 100644 index 000000000..d908c13e2 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_034.cpp @@ -0,0 +1,39 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests empty __VA_ARGS__ expansion + +//O --variadics + +#define MACRO1(x, ...) x -> __VA_ARGS__ +#define MACRO2(...) __VA_ARGS__ +#define STR(...) #__VA_ARGS__ + +//R #line 19 "t_1_034.cpp" +MACRO1(1,) //R 1 -> +MACRO2(1, 2) //R 1, 2 +STR() //R "" + +//H 10: t_1_034.cpp(14): #define +//H 08: t_1_034.cpp(14): MACRO1(x, ...)=x -> __VA_ARGS__ +//H 10: t_1_034.cpp(15): #define +//H 08: t_1_034.cpp(15): MACRO2(...)=__VA_ARGS__ +//H 10: t_1_034.cpp(16): #define +//H 08: t_1_034.cpp(16): STR(...)=#__VA_ARGS__ +//H 00: t_1_034.cpp(19): MACRO1(1,§), [t_1_034.cpp(14): MACRO1(x, ...)=x -> __VA_ARGS__] +//H 02: 1 -> +//H 03: 1 -> +//H 00: t_1_034.cpp(20): MACRO2(1, 2), [t_1_034.cpp(15): MACRO2(...)=__VA_ARGS__] +//H 02: 1, 2 +//H 03: 1, 2 +//H 00: t_1_034.cpp(21): STR(§), [t_1_034.cpp(16): STR(...)=#__VA_ARGS__] +//H 02: "" +//H 03: "" + +// boostinspect:noascii this file needs to contain non-ASCII characters diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_035.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_035.cpp new file mode 100644 index 000000000..449dbfdd5 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_035.cpp @@ -0,0 +1,49 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests token pasting with empty empty arguments + +//O --variadics + +#define PASTE1(a, b, c, d) a ## b ## c ## d +#define PASTE2(a, b, c, d) a##b##c##d + +//R #line 18 "t_1_035.cpp" +PASTE1(1, ,3,4) //R 134 +PASTE1(1,,3,4) //R 134 +PASTE1(1, , , 4) //R 14 +//R +PASTE2(1, ,3,4) //R 134 +PASTE2(1,,3,4) //R 134 +PASTE2(1, , , 4) //R 14 + +//H 10: t_1_035.cpp(14): #define +//H 08: t_1_035.cpp(14): PASTE1(a, b, c, d)=a ## b ## c ## d +//H 10: t_1_035.cpp(15): #define +//H 08: t_1_035.cpp(15): PASTE2(a, b, c, d)=a##b##c##d +//H 00: t_1_035.cpp(18): PASTE1(1, §,3,4), [t_1_035.cpp(14): PASTE1(a, b, c, d)=a ## b ## c ## d] +//H 02: 134 +//H 03: 134 +//H 00: t_1_035.cpp(19): PASTE1(1,§,3,4), [t_1_035.cpp(14): PASTE1(a, b, c, d)=a ## b ## c ## d] +//H 02: 134 +//H 03: 134 +//H 00: t_1_035.cpp(20): PASTE1(1, §, §, 4), [t_1_035.cpp(14): PASTE1(a, b, c, d)=a ## b ## c ## d] +//H 02: 14 +//H 03: 14 +//H 00: t_1_035.cpp(22): PASTE2(1, §,3,4), [t_1_035.cpp(15): PASTE2(a, b, c, d)=a##b##c##d] +//H 02: 134 +//H 03: 134 +//H 00: t_1_035.cpp(23): PASTE2(1,§,3,4), [t_1_035.cpp(15): PASTE2(a, b, c, d)=a##b##c##d] +//H 02: 134 +//H 03: 134 +//H 00: t_1_035.cpp(24): PASTE2(1, §, §, 4), [t_1_035.cpp(15): PASTE2(a, b, c, d)=a##b##c##d] +//H 02: 14 +//H 03: 14 + +// boostinspect:noascii this file needs to contain non-ASCII characters diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_036.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_036.cpp new file mode 100644 index 000000000..d798f523b --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_036.cpp @@ -0,0 +1,21 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests the concatination operator in object like macros + +#define OBJECT a ## b + +//R #line 15 "t_1_036.cpp" +OBJECT //R ab + +//H 10: t_1_036.cpp(12): #define +//H 08: t_1_036.cpp(12): OBJECT=a ## b +//H 01: t_1_036.cpp(12): OBJECT +//H 02: ab +//H 03: ab diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_037.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_037.cpp new file mode 100644 index 000000000..49b7da15c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_037.cpp @@ -0,0 +1,17 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// the following concatenation needs to fail (even if this construct is used +// in some MS headers) + +//R +//E t_1_037.cpp(16): error: pasting the following two tokens does not give a valid preprocessing token: "/" and "/" +#define _VARIANT_BOOL /##/ +_VARIANT_BOOL bool; + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_1_038.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_1_038.cpp new file mode 100644 index 000000000..526f1a25f --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_1_038.cpp @@ -0,0 +1,37 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// make sure newlines inside of macro invocations get accounted for correctly + +#define BAZ(T, E) T E + +struct foo +{ + BAZ + (bool, + value = true + ); +}; + +struct bar {}; + +//R #line 14 "t_1_038.cpp" +//R struct foo +//R { +//R bool value = true; +//R #line 20 "t_1_038.cpp" +//R }; +//R +//R struct bar {}; + +//H 10: t_1_038.cpp(12): #define +//H 08: t_1_038.cpp(12): BAZ(T, E)=T E +//H 00: t_1_038.cpp(16): BAZ(bool, value = true ), [t_1_038.cpp(12): BAZ(T, E)=T E] +//H 02: bool value = true +//H 03: bool value = true diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_001.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_001.cpp new file mode 100644 index 000000000..a300672c0 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_001.cpp @@ -0,0 +1,32 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests the #warning directive (note: only available, if enabled during +// compilation, the macro expansion is available only, when enabled separately +// during the compilation too) + +//R +//E t_2_001.cpp(18): warning: encountered #warning directive: This is a warning +#define WARNING1 This is a +#define WARNING2 warning +#warning WARNING1 WARNING2 + +//H 10: t_2_001.cpp(16): #define +//H 08: t_2_001.cpp(16): WARNING1=This is a +//H 10: t_2_001.cpp(17): #define +//H 08: t_2_001.cpp(17): WARNING2=warning +//H 10: t_2_001.cpp(18): #warning +//H 01: t_2_001.cpp(16): WARNING1 +//H 02: This is a +//H 03: This is a +//H 01: t_2_001.cpp(17): WARNING2 +//H 02: warning +//H 03: warning +//H 15: WARNING1 WARNING2 +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_002.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_002.cpp new file mode 100644 index 000000000..797f865ee --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_002.cpp @@ -0,0 +1,22 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests simple #line functionality + +#line 5 "a_nonexisting_file.cpp" + +//R +//E a_nonexisting_file.cpp(8): fatal error: encountered #error directive or #pragma wave stop(): This error should occur at line 8 of "a_nonexisting_file.cpp" +#error This error should occur at line 8 of "a_nonexisting_file.cpp" + +//H 10: t_2_002.cpp(12): #line +//H 17: 5 "a_nonexisting_file.cpp" (5, "a_nonexisting_file.cpp") +//H 10: a_nonexisting_file.cpp(8): #error +//H 16: This error should occur at line 8 of "a_nonexisting_file.cpp" +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_003.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_003.cpp new file mode 100644 index 000000000..c0f76ba3f --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_003.cpp @@ -0,0 +1,22 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests #line functionality with out a given file name + +#line 5 + +//R +//E t_2_003.cpp(8): fatal error: encountered #error directive or #pragma wave stop(): This error should occur at line 8 of "t_2_003.cpp" +#error This error should occur at line 8 of "t_2_003.cpp" + +//H 10: t_2_003.cpp(12): #line +//H 17: 5 (5, "") +//H 10: t_2_003.cpp(8): #error +//H 16: This error should occur at line 8 of "t_2_003.cpp" +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_004.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_004.cpp new file mode 100644 index 000000000..df66a5cbc --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_004.cpp @@ -0,0 +1,34 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests #line functionality with macro expansion required + +#define LINE_NO 5 +#define FILE_NAME "a_nonexisting_file.cpp" +#line LINE_NO FILE_NAME + +//R +//E a_nonexisting_file.cpp(8): fatal error: encountered #error directive or #pragma wave stop(): This error should occur at line 8 of "a_nonexisting_file.cpp" +#error This error should occur at line 8 of "a_nonexisting_file.cpp" + +//H 10: t_2_004.cpp(12): #define +//H 08: t_2_004.cpp(12): LINE_NO=5 +//H 10: t_2_004.cpp(13): #define +//H 08: t_2_004.cpp(13): FILE_NAME="a_nonexisting_file.cpp" +//H 10: t_2_004.cpp(14): #line +//H 01: t_2_004.cpp(12): LINE_NO +//H 02: 5 +//H 03: 5 +//H 01: t_2_004.cpp(13): FILE_NAME +//H 02: "a_nonexisting_file.cpp" +//H 03: "a_nonexisting_file.cpp" +//H 17: 5 "a_nonexisting_file.cpp" (5, "a_nonexisting_file.cpp") +//H 10: a_nonexisting_file.cpp(8): #error +//H 16: This error should occur at line 8 of "a_nonexisting_file.cpp" +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_005.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_005.cpp new file mode 100644 index 000000000..80d114aaf --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_005.cpp @@ -0,0 +1,17 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// test the error reporting for unknown directives + +//R +//E t_2_005.cpp(14): error: ill formed preprocessor directive: #this_is_a_unknown_pp_directive with some parameter +#this_is_a_unknown_pp_directive with some parameter + +//H 21: t_2_005.cpp(14): #this_is_a_unknown_pp_directive with some parameter +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_006.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_006.cpp new file mode 100644 index 000000000..918c1ed6d --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_006.cpp @@ -0,0 +1,38 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests correctness of macro expansion inside #pragma directives + +#define PRAGMA_BODY preprocessed pragma body + +//R #line 16 "t_2_006.cpp" +//R #pragma some pragma body +#pragma some pragma body +//R #line 19 "t_2_006.cpp" +//R #pragma preprocessed pragma body +#pragma PRAGMA_BODY +//R #line 22 "t_2_006.cpp" +//R #pragma STDC some C99 standard pragma body +#pragma STDC some C99 standard pragma body +//R #line 25 "t_2_006.cpp" +//R #pragma STDC preprocessed pragma body +#pragma STDC PRAGMA_BODY + +//H 10: t_2_006.cpp(12): #define +//H 08: t_2_006.cpp(12): PRAGMA_BODY=preprocessed pragma body +//H 10: t_2_006.cpp(16): #pragma +//H 10: t_2_006.cpp(19): #pragma +//H 01: t_2_006.cpp(12): PRAGMA_BODY +//H 02: preprocessed pragma body +//H 03: preprocessed pragma body +//H 10: t_2_006.cpp(22): #pragma +//H 10: t_2_006.cpp(25): #pragma +//H 01: t_2_006.cpp(12): PRAGMA_BODY +//H 02: preprocessed pragma body +//H 03: preprocessed pragma body diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_007.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_007.cpp new file mode 100644 index 000000000..ccd0cbcce --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_007.cpp @@ -0,0 +1,38 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O --c99 + +// Tests correctness of macro expansion inside #pragma directives +// Note: in C99 mode the STDC prefix in pragma's suppresses macro expansion + +#define PRAGMA_BODY preprocessed pragma body + +//R #line 19 "t_2_007.cpp" +//R #pragma some pragma body +#pragma some pragma body +//R #line 22 "t_2_007.cpp" +//R #pragma preprocessed pragma body +#pragma PRAGMA_BODY +//R #line 25 "t_2_007.cpp" +//R #pragma STDC some C99 standard pragma body +#pragma STDC some C99 standard pragma body +//R #line 28 "t_2_007.cpp" +//R #pragma STDC PRAGMA_BODY +#pragma STDC PRAGMA_BODY + +//H 10: t_2_007.cpp(15): #define +//H 08: t_2_007.cpp(15): PRAGMA_BODY=preprocessed pragma body +//H 10: t_2_007.cpp(19): #pragma +//H 10: t_2_007.cpp(22): #pragma +//H 01: t_2_007.cpp(15): PRAGMA_BODY +//H 02: preprocessed pragma body +//H 03: preprocessed pragma body +//H 10: t_2_007.cpp(25): #pragma +//H 10: t_2_007.cpp(28): #pragma diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_008.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_008.cpp new file mode 100644 index 000000000..6fc61559c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_008.cpp @@ -0,0 +1,24 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests #include statements with macros as arguments + +//R +//E t_2_008.cpp(15): error: could not find include file: some_include_file.h +#define INCLUDE_FILE "some_include_file.h" +#include INCLUDE_FILE + +//H 10: t_2_008.cpp(14): #define +//H 08: t_2_008.cpp(14): INCLUDE_FILE="some_include_file.h" +//H 10: t_2_008.cpp(15): #include +//H 01: t_2_008.cpp(14): INCLUDE_FILE +//H 02: "some_include_file.h" +//H 03: "some_include_file.h" +//H 04: "some_include_file.h" +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_009.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_009.cpp new file mode 100644 index 000000000..b72ca45d4 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_009.cpp @@ -0,0 +1,56 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// The result of macro expansion must be re-tokenized to find header-name +// tokens of either <file> or "file" + +//O -S. + +#if !defined(FILE_002_009_CPP) // avoid #include recursion +#define FILE_002_009_CPP + +#define SYSTEM_HEADER <t_2_009.cpp> +#define USER_HEADER "t_2_009.cpp" + +//R #line 23 "t_2_009.cpp" +//R including <t_2_009.cpp> +including <t_2_009.cpp> +#include SYSTEM_HEADER + +//R #line 28 "t_2_009.cpp" +//R including "t_2_009.cpp" +including "t_2_009.cpp" +#include USER_HEADER + +#endif // FILE_002_009_CPP + +//H 10: t_2_009.cpp(15): #if +//H 11: t_2_009.cpp(15): #if !defined(FILE_002_009_CPP) : 1 +//H 10: t_2_009.cpp(16): #define +//H 08: t_2_009.cpp(16): FILE_002_009_CPP= +//H 10: t_2_009.cpp(18): #define +//H 08: t_2_009.cpp(18): SYSTEM_HEADER=<t_2_009.cpp> +//H 10: t_2_009.cpp(19): #define +//H 08: t_2_009.cpp(19): USER_HEADER="t_2_009.cpp" +//H 10: t_2_009.cpp(24): #include +//H 01: t_2_009.cpp(18): SYSTEM_HEADER +//H 02: <t_2_009.cpp> +//H 03: <t_2_009.cpp> +//H 04: <t_2_009.cpp> +//H 05: $B(t_2_009.cpp) ($B(t_2_009.cpp)) +//H 10: t_2_009.cpp(15): #if +//H 11: t_2_009.cpp(15): #if !defined(FILE_002_009_CPP) : 0 +//H 06: +//H 19: $B(t_2_009.cpp): FILE_002_009_CPP +//H 10: t_2_009.cpp(29): #include +//H 01: t_2_009.cpp(19): USER_HEADER +//H 02: "t_2_009.cpp" +//H 03: "t_2_009.cpp" +//H 04: "t_2_009.cpp" +//H 10: t_2_009.cpp(31): #endif diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_010.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_010.cpp new file mode 100644 index 000000000..bdc92a741 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_010.cpp @@ -0,0 +1,21 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests error reporting for missing #endif + +//E t_2_010.cpp(22): error: detected at least one missing #endif directive +#if 1 +#if 0 +#endif + +//H 10: t_2_010.cpp(13): #if +//H 11: t_2_010.cpp(13): #if 1: 1 +//H 10: t_2_010.cpp(14): #if +//H 11: t_2_010.cpp(14): #if 0: 0 +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_011.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_011.cpp new file mode 100644 index 000000000..8f8dfedf3 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_011.cpp @@ -0,0 +1,21 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests error reporting for missing #if + +//E t_2_011.cpp(15): error: the #if for this directive is missing: #endif +#if 1 +#endif +#endif + +//H 10: t_2_011.cpp(13): #if +//H 11: t_2_011.cpp(13): #if 1: 1 +//H 10: t_2_011.cpp(14): #endif +//H 10: t_2_011.cpp(15): #endif +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_012.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_012.cpp new file mode 100644 index 000000000..67ff1fe7d --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_012.cpp @@ -0,0 +1,17 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests error reporting for missing #if + +//E t_2_012.cpp(13): error: the #if for this directive is missing: #else +#else +#endif + +//H 10: t_2_012.cpp(13): #else +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_013.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_013.cpp new file mode 100644 index 000000000..e44893f1d --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_013.cpp @@ -0,0 +1,19 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests error reporting for missing #if + +//E t_2_013.cpp(20): error: detected at least one missing #endif directive +#if 1 +#else + +//H 10: t_2_013.cpp(13): #if +//H 11: t_2_013.cpp(13): #if 1: 1 +//H 10: t_2_013.cpp(14): #else +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_014.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_014.cpp new file mode 100644 index 000000000..9a6df37a1 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_014.cpp @@ -0,0 +1,111 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests, whether alternative tokens are interpreted inside of conditional +// expressions + +//R #line 16 "t_2_014.cpp" +//R true +#if compl 1 +true +#else +false +#endif + +//R #line 26 "t_2_014.cpp" +//R true +#if not 1 +false +#else +true +#endif + +//R #line 32 "t_2_014.cpp" +//R true +#if 1 or 2 +true +#else +false +#endif + +//R #line 40 "t_2_014.cpp" +//R true +#if 1 and 2 +true +#else +false +#endif + +//R #line 50 "t_2_014.cpp" +//R true +#if not 1 +false +#else +true +#endif + +//R #line 56 "t_2_014.cpp" +//R true +#if 1 xor 2 +true +#else +false +#endif + +//R #line 66 "t_2_014.cpp" +//R true +#if 1 bitand 2 +false +#else +true +#endif + +//R #line 72 "t_2_014.cpp" +//R true +#if 1 bitor 2 +true +#else +false +#endif + +//R #line 80 "t_2_014.cpp" +//R true +#if 1 not_eq 2 +true +#else +false +#endif + +//H 10: t_2_014.cpp(15): #if +//H 11: t_2_014.cpp(15): #if compl 1: 1 +//H 10: t_2_014.cpp(17): #else +//H 10: t_2_014.cpp(23): #if +//H 11: t_2_014.cpp(23): #if not 1: 0 +//H 10: t_2_014.cpp(27): #endif +//H 10: t_2_014.cpp(31): #if +//H 11: t_2_014.cpp(31): #if 1 or 2: 1 +//H 10: t_2_014.cpp(33): #else +//H 10: t_2_014.cpp(39): #if +//H 11: t_2_014.cpp(39): #if 1 and 2: 1 +//H 10: t_2_014.cpp(41): #else +//H 10: t_2_014.cpp(47): #if +//H 11: t_2_014.cpp(47): #if not 1: 0 +//H 10: t_2_014.cpp(51): #endif +//H 10: t_2_014.cpp(55): #if +//H 11: t_2_014.cpp(55): #if 1 xor 2: 1 +//H 10: t_2_014.cpp(57): #else +//H 10: t_2_014.cpp(63): #if +//H 11: t_2_014.cpp(63): #if 1 bitand 2: 0 +//H 10: t_2_014.cpp(67): #endif +//H 10: t_2_014.cpp(71): #if +//H 11: t_2_014.cpp(71): #if 1 bitor 2: 1 +//H 10: t_2_014.cpp(73): #else +//H 10: t_2_014.cpp(79): #if +//H 11: t_2_014.cpp(79): #if 1 not_eq 2: 1 +//H 10: t_2_014.cpp(81): #else diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_015.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_015.cpp new file mode 100644 index 000000000..67d7bb42e --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_015.cpp @@ -0,0 +1,27 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests, whether #if works when the expression is surrounded by parenthesis + +#define WINVER 0x0500 + +//R #line 17 "t_2_015.cpp" +//R true +#if(WINVER >= 0x0500) +true +#endif + +//H 10: t_2_015.cpp(12): #define +//H 08: t_2_015.cpp(12): WINVER=0x0500 +//H 10: t_2_015.cpp(16): #if +//H 01: t_2_015.cpp(12): WINVER +//H 02: 0x0500 +//H 03: 0x0500 +//H 11: t_2_015.cpp(16): #if (WINVER >= 0x0500): 1 +//H 10: t_2_015.cpp(18): #endif diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_016.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_016.cpp new file mode 100644 index 000000000..43169d0f9 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_016.cpp @@ -0,0 +1,26 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// if _MSC_VER was defined through the command line, the pp expression was +// garbled + +//O -D_MSC_VER=1200 + +//R #line 18 "t_2_016.cpp" +//R true +#if defined (_MSC_VER) && (_MSC_VER >= 1020) +true +#endif + +//H 10: t_2_016.cpp(17): #if +//H 01: <command line>(1): _MSC_VER +//H 02: 1200 +//H 03: 1200 +//H 11: t_2_016.cpp(17): #if defined (_MSC_VER) && (_MSC_VER >= 1020): 1 +//H 10: t_2_016.cpp(19): #endif diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_017.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_017.cpp new file mode 100644 index 000000000..a69083c10 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_017.cpp @@ -0,0 +1,36 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// The result of macro expansion must be retokenized to find header-name tokens +// of either <file> or "file". Test inclusion using absolute names. + +#if !defined(FILE_002_017_CPP) // avoid #include recursion +#define FILE_002_017_CPP + +#include __FILE__ + +#endif // FILE_002_017_CPP + +//R #line 24 "t_2_017.cpp" +//R file t_2_017.cpp +//R #line 24 "t_2_017.cpp" +//R file t_2_017.cpp +file t_2_017.cpp + +//H 10: t_2_017.cpp(13): #if +//H 11: t_2_017.cpp(13): #if !defined(FILE_002_017_CPP) : 1 +//H 10: t_2_017.cpp(14): #define +//H 08: t_2_017.cpp(14): FILE_002_017_CPP= +//H 10: t_2_017.cpp(16): #include +//H 04: "$P(t_2_017.cpp)" +//H 05: $B(t_2_017.cpp) ($B(t_2_017.cpp)) +//H 10: t_2_017.cpp(13): #if +//H 11: t_2_017.cpp(13): #if !defined(FILE_002_017_CPP) : 0 +//H 06: +//H 10: t_2_017.cpp(18): #endif diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_018.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_018.cpp new file mode 100644 index 000000000..8ca07c42b --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_018.cpp @@ -0,0 +1,22 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Check if regression reported by ticket #1752 has been fixed + +//R #line 17 "t_2_018.cpp" +//R "__FILE__ is defined" +#ifndef __FILE__ +"No __FILE__" +#else +"__FILE__ is defined" +#endif + +//H 10: t_2_018.cpp(14): #ifndef +//H 11: t_2_018.cpp(14): #ifndef __FILE__: 1 +//H 10: t_2_018.cpp(18): #endif diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_019.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_019.cpp new file mode 100644 index 000000000..9a4729d01 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_019.cpp @@ -0,0 +1,61 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Check if #pragma once, include guard detection, and related hooks work as +// expected + +#include "t_2_019_001.hpp" // #pragma once +#include "t_2_019_002.hpp" // include guard style 1 +#include "t_2_019_003.hpp" // include guard style 2 + +// repeat inclusion, should do nothing +#include "t_2_019_001.hpp" +#include "t_2_019_002.hpp" +#include "t_2_019_003.hpp" + +//R #line 11 "t_2_019_001.hpp" +//R t_2_019_001 +//R #line 16 "t_2_019_002.hpp" +//R t_2_019_002 +//R #line 16 "t_2_019_003.hpp" +//R t_2_019_003 + +//H 10: t_2_019.cpp(13): #include "t_2_019_001.hpp" +//H 04: "t_2_019_001.hpp" +//H 05: $S(t_2_019_001.hpp) ($B(t_2_019_001.hpp)) +//H 10: t_2_019_001.hpp(10): #pragma +//H 20: t_2_019_001.hpp(10): #pragma: $B(t_2_019_001.hpp) +//H 06: +//H 10: t_2_019.cpp(14): #include "t_2_019_002.hpp" +//H 04: "t_2_019_002.hpp" +//H 05: t_2_019_002.hpp ($B(t_2_019_002.hpp)) +//H 10: t_2_019_002.hpp(12): #if +//H 11: t_2_019_002.hpp(12): #if !defined(T_2_019_002): 1 +//H 10: t_2_019_002.hpp(14): #define +//H 08: t_2_019_002.hpp(14): T_2_019_002= +//H 10: t_2_019_002.hpp(18): #endif +//H 06: +//H 19: $B(t_2_019_002.hpp): T_2_019_002 +//H 10: t_2_019.cpp(15): #include "t_2_019_003.hpp" +//H 04: "t_2_019_003.hpp" +//H 05: t_2_019_003.hpp ($B(t_2_019_003.hpp)) +//H 10: t_2_019_003.hpp(12): #ifndef +//H 11: t_2_019_003.hpp(12): #ifndef T_2_019_003: 0 +//H 10: t_2_019_003.hpp(14): #define +//H 08: t_2_019_003.hpp(14): T_2_019_003= +//H 10: t_2_019_003.hpp(18): #endif +//H 06: +//H 19: $B(t_2_019_003.hpp): T_2_019_003 +//H 10: t_2_019.cpp(18): #include "t_2_019_001.hpp" +//H 04: "t_2_019_001.hpp" +//H 10: t_2_019.cpp(19): #include "t_2_019_002.hpp" +//H 04: "t_2_019_002.hpp" +//H 10: t_2_019.cpp(20): #include "t_2_019_003.hpp" +//H 04: "t_2_019_003.hpp" + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_019_001.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_019_001.hpp new file mode 100644 index 000000000..281621c3d --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_019_001.hpp @@ -0,0 +1,11 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#pragma once +t_2_019_001 diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_019_002.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_019_002.hpp new file mode 100644 index 000000000..778b8e0fa --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_019_002.hpp @@ -0,0 +1,20 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +# + +#if !defined(T_2_019_002) +# // more comments here +#define T_2_019_002 + +t_2_019_002 + +#endif +# // and here + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_019_003.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_019_003.hpp new file mode 100644 index 000000000..ab9e5635e --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_019_003.hpp @@ -0,0 +1,20 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +# + +#ifndef T_2_019_003 +# // more comments here +#define T_2_019_003 + +t_2_019_003 + +#endif +# // and here + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_020.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_020.cpp new file mode 100644 index 000000000..7691ffe36 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_020.cpp @@ -0,0 +1,261 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// check called hooks during conditional preprocessing +//O --skipped_token_hooks + +#ifdef FOO +int foo; +#else +float foo; +#endif + +#if defined BAR +int bar; +#elif defined BAR2 +float bar; +#endif + +#define BAZ +#ifdef BAZ +int baz; +#else +float baz; +#endif + +#if defined BAZ +int baz1; +#elif defined BAZ +float baz1; +#endif + +#ifndef BAZ +int baz2; +#else +float baz2; +#endif + +#if 1 +int w1; +#elif 1 +int w2; +#else +int w3; +#endif + +#if 0 +int x1; +#elif 1 +int x2; +#else +int x3; +#endif + +#if 1 +int y1; +#elif 0 +int y2; +#else +int y3; +#endif + +#if 0 +int z1; +#elif 0 +int z2; +#else +int z3; +#endif + +//R #line 16 "t_2_020.cpp" +//R float foo; +//R #line 27 "t_2_020.cpp" +//R int baz; +//R #line 33 "t_2_020.cpp" +//R int baz1; +//R #line 41 "t_2_020.cpp" +//R float baz2; +//R #line 45 "t_2_020.cpp" +//R int w1; +//R #line 55 "t_2_020.cpp" +//R int x2; +//R #line 61 "t_2_020.cpp" +//R int y1; +//R #line 73 "t_2_020.cpp" +//R int z3; + +//H 10: t_2_020.cpp(13): #ifdef +//H 11: t_2_020.cpp(13): #ifdef FOO: 0 +//H 12: t_2_020.cpp(13): >\n< +//H 12: t_2_020.cpp(14): >int< +//H 12: t_2_020.cpp(14): > < +//H 12: t_2_020.cpp(14): >foo< +//H 12: t_2_020.cpp(14): >;< +//H 12: t_2_020.cpp(14): >\n< +//H 12: t_2_020.cpp(15): >#else< +//H 12: t_2_020.cpp(15): >\n< +//H 10: t_2_020.cpp(17): #endif +//H 12: t_2_020.cpp(17): >#endif< +//H 12: t_2_020.cpp(17): >\n< +//H 10: t_2_020.cpp(19): #if +//H 12: t_2_020.cpp(19): > < +//H 11: t_2_020.cpp(19): #if defined BAR: 0 +//H 12: t_2_020.cpp(19): >\n< +//H 12: t_2_020.cpp(20): >int< +//H 12: t_2_020.cpp(20): > < +//H 12: t_2_020.cpp(20): >bar< +//H 12: t_2_020.cpp(20): >;< +//H 12: t_2_020.cpp(20): >\n< +//H 10: t_2_020.cpp(21): #elif +//H 12: t_2_020.cpp(21): > < +//H 11: t_2_020.cpp(21): #elif defined BAR2: 0 +//H 12: t_2_020.cpp(21): >\n< +//H 12: t_2_020.cpp(22): >float< +//H 12: t_2_020.cpp(22): > < +//H 12: t_2_020.cpp(22): >bar< +//H 12: t_2_020.cpp(22): >;< +//H 12: t_2_020.cpp(22): >\n< +//H 12: t_2_020.cpp(23): >#endif< +//H 12: t_2_020.cpp(23): >\n< +//H 10: t_2_020.cpp(25): #define +//H 08: t_2_020.cpp(25): BAZ= +//H 12: t_2_020.cpp(25): >\n< +//H 10: t_2_020.cpp(26): #ifdef +//H 11: t_2_020.cpp(26): #ifdef BAZ: 1 +//H 12: t_2_020.cpp(26): >\n< +//H 10: t_2_020.cpp(28): #else +//H 12: t_2_020.cpp(28): >#else< +//H 12: t_2_020.cpp(28): >\n< +//H 12: t_2_020.cpp(29): >float< +//H 12: t_2_020.cpp(29): > < +//H 12: t_2_020.cpp(29): >baz< +//H 12: t_2_020.cpp(29): >;< +//H 12: t_2_020.cpp(29): >\n< +//H 12: t_2_020.cpp(30): >#endif< +//H 12: t_2_020.cpp(30): >\n< +//H 10: t_2_020.cpp(32): #if +//H 12: t_2_020.cpp(32): > < +//H 11: t_2_020.cpp(32): #if defined BAZ: 1 +//H 12: t_2_020.cpp(32): >\n< +//H 10: t_2_020.cpp(34): #elif +//H 12: t_2_020.cpp(34): > < +//H 12: t_2_020.cpp(34): >defined< +//H 12: t_2_020.cpp(34): > < +//H 12: t_2_020.cpp(34): >BAZ< +//H 12: t_2_020.cpp(34): >\n< +//H 12: t_2_020.cpp(35): >float< +//H 12: t_2_020.cpp(35): > < +//H 12: t_2_020.cpp(35): >baz1< +//H 12: t_2_020.cpp(35): >;< +//H 12: t_2_020.cpp(35): >\n< +//H 12: t_2_020.cpp(36): >#endif< +//H 12: t_2_020.cpp(36): >\n< +//H 10: t_2_020.cpp(38): #ifndef +//H 11: t_2_020.cpp(38): #ifndef BAZ: 1 +//H 12: t_2_020.cpp(38): >\n< +//H 12: t_2_020.cpp(39): >int< +//H 12: t_2_020.cpp(39): > < +//H 12: t_2_020.cpp(39): >baz2< +//H 12: t_2_020.cpp(39): >;< +//H 12: t_2_020.cpp(39): >\n< +//H 12: t_2_020.cpp(40): >#else< +//H 12: t_2_020.cpp(40): >\n< +//H 10: t_2_020.cpp(42): #endif +//H 12: t_2_020.cpp(42): >#endif< +//H 12: t_2_020.cpp(42): >\n< +//H 10: t_2_020.cpp(44): #if +//H 12: t_2_020.cpp(44): > < +//H 11: t_2_020.cpp(44): #if 1: 1 +//H 12: t_2_020.cpp(44): >\n< +//H 10: t_2_020.cpp(46): #elif +//H 12: t_2_020.cpp(46): > < +//H 12: t_2_020.cpp(46): >1< +//H 12: t_2_020.cpp(46): >\n< +//H 12: t_2_020.cpp(47): >int< +//H 12: t_2_020.cpp(47): > < +//H 12: t_2_020.cpp(47): >w2< +//H 12: t_2_020.cpp(47): >;< +//H 12: t_2_020.cpp(47): >\n< +//H 12: t_2_020.cpp(48): >#else< +//H 12: t_2_020.cpp(48): >\n< +//H 12: t_2_020.cpp(49): >int< +//H 12: t_2_020.cpp(49): > < +//H 12: t_2_020.cpp(49): >w3< +//H 12: t_2_020.cpp(49): >;< +//H 12: t_2_020.cpp(49): >\n< +//H 12: t_2_020.cpp(50): >#endif< +//H 12: t_2_020.cpp(50): >\n< +//H 10: t_2_020.cpp(52): #if +//H 12: t_2_020.cpp(52): > < +//H 11: t_2_020.cpp(52): #if 0: 0 +//H 12: t_2_020.cpp(52): >\n< +//H 12: t_2_020.cpp(53): >int< +//H 12: t_2_020.cpp(53): > < +//H 12: t_2_020.cpp(53): >x1< +//H 12: t_2_020.cpp(53): >;< +//H 12: t_2_020.cpp(53): >\n< +//H 10: t_2_020.cpp(54): #elif +//H 12: t_2_020.cpp(54): > < +//H 11: t_2_020.cpp(54): #elif 1: 1 +//H 12: t_2_020.cpp(54): >\n< +//H 10: t_2_020.cpp(56): #else +//H 12: t_2_020.cpp(56): >#else< +//H 12: t_2_020.cpp(56): >\n< +//H 12: t_2_020.cpp(57): >int< +//H 12: t_2_020.cpp(57): > < +//H 12: t_2_020.cpp(57): >x3< +//H 12: t_2_020.cpp(57): >;< +//H 12: t_2_020.cpp(57): >\n< +//H 12: t_2_020.cpp(58): >#endif< +//H 12: t_2_020.cpp(58): >\n< +//H 10: t_2_020.cpp(60): #if +//H 12: t_2_020.cpp(60): > < +//H 11: t_2_020.cpp(60): #if 1: 1 +//H 12: t_2_020.cpp(60): >\n< +//H 10: t_2_020.cpp(62): #elif +//H 12: t_2_020.cpp(62): > < +//H 12: t_2_020.cpp(62): >0< +//H 12: t_2_020.cpp(62): >\n< +//H 12: t_2_020.cpp(63): >int< +//H 12: t_2_020.cpp(63): > < +//H 12: t_2_020.cpp(63): >y2< +//H 12: t_2_020.cpp(63): >;< +//H 12: t_2_020.cpp(63): >\n< +//H 12: t_2_020.cpp(64): >#else< +//H 12: t_2_020.cpp(64): >\n< +//H 12: t_2_020.cpp(65): >int< +//H 12: t_2_020.cpp(65): > < +//H 12: t_2_020.cpp(65): >y3< +//H 12: t_2_020.cpp(65): >;< +//H 12: t_2_020.cpp(65): >\n< +//H 12: t_2_020.cpp(66): >#endif< +//H 12: t_2_020.cpp(66): >\n< +//H 10: t_2_020.cpp(68): #if +//H 12: t_2_020.cpp(68): > < +//H 11: t_2_020.cpp(68): #if 0: 0 +//H 12: t_2_020.cpp(68): >\n< +//H 12: t_2_020.cpp(69): >int< +//H 12: t_2_020.cpp(69): > < +//H 12: t_2_020.cpp(69): >z1< +//H 12: t_2_020.cpp(69): >;< +//H 12: t_2_020.cpp(69): >\n< +//H 10: t_2_020.cpp(70): #elif +//H 12: t_2_020.cpp(70): > < +//H 11: t_2_020.cpp(70): #elif 0: 0 +//H 12: t_2_020.cpp(70): >\n< +//H 12: t_2_020.cpp(71): >int< +//H 12: t_2_020.cpp(71): > < +//H 12: t_2_020.cpp(71): >z2< +//H 12: t_2_020.cpp(71): >;< +//H 12: t_2_020.cpp(71): >\n< +//H 12: t_2_020.cpp(72): >#else< +//H 12: t_2_020.cpp(72): >\n< +//H 10: t_2_020.cpp(74): #endif +//H 12: t_2_020.cpp(74): >#endif< +//H 12: t_2_020.cpp(74): >\n< diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_021.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_021.cpp new file mode 100644 index 000000000..ceef8e8a2 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_021.cpp @@ -0,0 +1,50 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#define SIX (4 + 2.0) + +//R #line 14 "t_2_021.cpp" +//R #pragma command option +#pragma command option +//R #line 17 "t_2_021.cpp" +//R #pragma command option (4 + 2.0) +#pragma command option SIX +//R #line 20 "t_2_021.cpp" +//R #pragma command option[(4 + 2.0)] +#pragma command option[SIX] +//R #line 23 "t_2_021.cpp" +//R #pragma command option(5) +#pragma command option(5) +//R #line 26 "t_2_021.cpp" +//R #pragma command option((4 + 2.0)) +#pragma command option(SIX) +//R #line 29 "t_2_021.cpp" +//R #pragma command (4 + 2.0) +#pragma command SIX + +//H 10: t_2_021.cpp(10): #define +//H 08: t_2_021.cpp(10): SIX=(4 + 2.0) +//H 10: t_2_021.cpp(14): #pragma +//H 10: t_2_021.cpp(17): #pragma +//H 01: t_2_021.cpp(10): SIX +//H 02: (4 + 2.0) +//H 03: (4 + 2.0) +//H 10: t_2_021.cpp(20): #pragma +//H 01: t_2_021.cpp(10): SIX +//H 02: (4 + 2.0) +//H 03: (4 + 2.0) +//H 10: t_2_021.cpp(23): #pragma +//H 10: t_2_021.cpp(26): #pragma +//H 01: t_2_021.cpp(10): SIX +//H 02: (4 + 2.0) +//H 03: (4 + 2.0) +//H 10: t_2_021.cpp(29): #pragma +//H 01: t_2_021.cpp(10): SIX +//H 02: (4 + 2.0) +//H 03: (4 + 2.0) diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_022.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_022.cpp new file mode 100644 index 000000000..a25f3be34 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_022.cpp @@ -0,0 +1,23 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Verify fix of regression #6838: Adding include file with force_include makes +// Wave fail to emit #line directive + +//O --forceinclude=t_2_022.hpp + +//R #line 12 "t_2_022.hpp" +//R int func() { return 42; } +//R #line 19 "t_2_022.cpp" +//R int main() { return func(); } +int main() { return func(); } + +//H 04: t_2_022.hpp +//H 05: $B(t_2_022.hpp) ($B(t_2_022.hpp)) +//H 06: diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_2_022.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_2_022.hpp new file mode 100644 index 000000000..6b7c52f68 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_2_022.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Verify fix of regression #6838: Adding include file with force_include makes +// Wave fail to emit #line directive +int func() { return 42; } diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_3_001.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_3_001.cpp new file mode 100644 index 000000000..1718a5ddf --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_3_001.cpp @@ -0,0 +1,17 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests, if a diagnostic is emitted, if a predefined macro is to be undefined. + +//R +//E t_3_001.cpp(14): warning: #undef may not be used on this predefined name: __cplusplus +#undef __cplusplus // should emit a warning + +//H 10: t_3_001.cpp(14): #undef +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_3_002.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_3_002.cpp new file mode 100644 index 000000000..cb9825948 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_3_002.cpp @@ -0,0 +1,50 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests predefined macros + +//R #line 13 "t_3_002.cpp" +__STDC__ //R 1 +__STDC_VERSION__ //R __STDC_VERSION__ +__cplusplus //R 199711L +__STDC_HOSTED__ //R __STDC_HOSTED__ +__LINE__ //R 17 +__FILE__ //R "$P" +__BASE_FILE__ //R "$F" +__WAVE_HAS_VARIADICS__ //R __WAVE_HAS_VARIADICS__ +__INCLUDE_LEVEL__ //R 0 +//R #line 50 "test.cpp" +#line 50 "test.cpp" +__LINE__ //R 50 +__FILE__ //R "test.cpp" +__BASE_FILE__ //R "$F" + + +//R #line 56 "test.cpp" +__LINE__ //R 56 +__FILE__ //R "test.cpp" +__BASE_FILE__ //R "$F" + +//H 01: <built-in>(1): __STDC__ +//H 02: 1 +//H 03: 1 +//H 01: <built-in>(1): __cplusplus +//H 02: 199711L +//H 03: 199711L +//H 01: <built-in>(1): __BASE_FILE__ +//H 02: "$F" +//H 03: "$F" +//H 10: t_3_002.cpp(23): #line +//H 17: 50 "test.cpp" (50, "test.cpp") +//H 01: <built-in>(1): __BASE_FILE__ +//H 02: "$F" +//H 03: "$F" +//H 01: <built-in>(1): __BASE_FILE__ +//H 02: "$F" +//H 03: "$F" diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_3_003.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_3_003.cpp new file mode 100644 index 000000000..63c17b55a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_3_003.cpp @@ -0,0 +1,55 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O --variadics + +// Tests predefined macros + +//R #line 15 "t_3_003.cpp" +__STDC__ //R 1 +__STDC_VERSION__ //R __STDC_VERSION__ +__cplusplus //R 199711L +__STDC_HOSTED__ //R __STDC_HOSTED__ +__LINE__ //R 19 +__FILE__ //R "$P" +__BASE_FILE__ //R "$F" +__WAVE_HAS_VARIADICS__ //R 1 +__INCLUDE_LEVEL__ //R 0 +//R #line 50 "test.cpp" +#line 50 "test.cpp" +__LINE__ //R 50 +__FILE__ //R "test.cpp" +__BASE_FILE__ //R "$F" + + +//R #line 56 "test.cpp" +__LINE__ //R 56 +__FILE__ //R "test.cpp" +__BASE_FILE__ //R "$F" + +//H 01: <built-in>(1): __STDC__ +//H 02: 1 +//H 03: 1 +//H 01: <built-in>(1): __cplusplus +//H 02: 199711L +//H 03: 199711L +//H 01: <built-in>(1): __BASE_FILE__ +//H 02: "$F" +//H 03: "$F" +//H 01: <built-in>(1): __WAVE_HAS_VARIADICS__ +//H 02: 1 +//H 03: 1 +//H 10: t_3_003.cpp(25): #line +//H 17: 50 "test.cpp" (50, "test.cpp") +//H 01: <built-in>(1): __BASE_FILE__ +//H 02: "$F" +//H 03: "$F" +//H 01: <built-in>(1): __BASE_FILE__ +//H 02: "$F" +//H 03: "$F" diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_3_004.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_3_004.cpp new file mode 100644 index 000000000..a5a0dc3ea --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_3_004.cpp @@ -0,0 +1,58 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O --c99 + +// Tests predefined macros + +//R #line 15 "t_3_004.cpp" +__STDC__ //R 1 +__STDC_VERSION__ //R 199901L +__cplusplus //R __cplusplus +__STDC_HOSTED__ //R 0 +__LINE__ //R 19 +__FILE__ //R "$P" +__BASE_FILE__ //R "$F" +__WAVE_HAS_VARIADICS__ //R 1 +__INCLUDE_LEVEL__ //R 0 +//R #line 50 "test.cpp" +#line 50 "test.cpp" +__LINE__ //R 50 +__FILE__ //R "test.cpp" +__BASE_FILE__ //R "$F" + + +//R #line 56 "test.cpp" +__LINE__ //R 56 +__FILE__ //R "test.cpp" +__BASE_FILE__ //R "$F" + +//H 01: <built-in>(1): __STDC__ +//H 02: 1 +//H 03: 1 +//H 01: <built-in>(1): __STDC_VERSION__ +//H 02: 199901L +//H 03: 199901L +//H 01: <built-in>(1): __STDC_HOSTED__ +//H 02: 0 +//H 03: 0 +//H 01: <built-in>(1): __BASE_FILE__ +//H 02: "$F" +//H 03: "$F" +//H 01: <built-in>(1): __WAVE_HAS_VARIADICS__ +//H 02: 1 +//H 03: 1 +//H 10: t_3_004.cpp(25): #line +//H 17: 50 "test.cpp" (50, "test.cpp") +//H 01: <built-in>(1): __BASE_FILE__ +//H 02: "$F" +//H 03: "$F" +//H 01: <built-in>(1): __BASE_FILE__ +//H 02: "$F" +//H 03: "$F" diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_4_001.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_4_001.cpp new file mode 100644 index 000000000..dbb52f7f8 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_4_001.cpp @@ -0,0 +1,22 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests, whether integer arithmetic results get truncated correctly + +//R #line 15 "t_4_001.cpp" +//R true +#if 1 / 10 == 0 +true +#else +false +#endif + +//H 10: t_4_001.cpp(14): #if +//H 11: t_4_001.cpp(14): #if 1 / 10 == 0: 1 +//H 10: t_4_001.cpp(16): #else diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_4_002.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_4_002.cpp new file mode 100644 index 000000000..71feb4311 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_4_002.cpp @@ -0,0 +1,28 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests, whether ecursively defined macros get expanded correctly in the +// context of an #if expression + +#define C C + +//R #line 18 "t_4_002.cpp" +//R true +#if !C +true +#endif + +//H 10: t_4_002.cpp(13): #define +//H 08: t_4_002.cpp(13): C=C +//H 10: t_4_002.cpp(17): #if +//H 01: t_4_002.cpp(13): C +//H 02: C +//H 03: C +//H 11: t_4_002.cpp(17): #if !C: 1 +//H 10: t_4_002.cpp(19): #endif diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_4_003.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_4_003.cpp new file mode 100644 index 000000000..ec0566af0 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_4_003.cpp @@ -0,0 +1,100 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests simple expression arithmetics + +# define CAT(a, b) PRIMITIVE_CAT(a, b) +# define PRIMITIVE_CAT(a, b) a ## b + +# define OFFSET(n) OFFSET_ ## n + +# define OFFSET_1 OFFSET_2 % 10 +# define OFFSET_2 OFFSET_3 % 100 +# define OFFSET_3 OFFSET_4 % 1000 +# define OFFSET_4 + +# define FACTOR(n) FACTOR_ ## n + +# define FACTOR_1 / 1 +# define FACTOR_2 CAT(FACTOR_1, 0) +# define FACTOR_3 CAT(FACTOR_2, 0) +# define FACTOR_4 CAT(FACTOR_3, 0) + +# define DIGIT(n) OFFSET(n) FACTOR(n) + +# define x 987 + +# if (x) DIGIT(3) == 0 +# define D3 0 +# elif (x) DIGIT(3) == 1 +# define D3 1 +# elif (x) DIGIT(3) == 2 +# define D3 2 +# elif (x) DIGIT(3) == 3 +# define D3 3 +# elif (x) DIGIT(3) == 4 +# define D3 4 +# elif (x) DIGIT(3) == 5 +# define D3 5 +# elif (x) DIGIT(3) == 6 +# define D3 6 +# elif (x) DIGIT(3) == 7 +# define D3 7 +# elif (x) DIGIT(3) == 8 +# define D3 8 +# elif (x) DIGIT(3) == 9 +# define D3 9 +# endif + +# if (x) DIGIT(2) == 0 +# define D2 0 +# elif (x) DIGIT(2) == 1 +# define D2 1 +# elif (x) DIGIT(2) == 2 +# define D2 2 +# elif (x) DIGIT(2) == 3 +# define D2 3 +# elif (x) DIGIT(2) == 4 +# define D2 4 +# elif (x) DIGIT(2) == 5 +# define D2 5 +# elif (x) DIGIT(2) == 6 +# define D2 6 +# elif (x) DIGIT(2) == 7 +# define D2 7 +# elif (x) DIGIT(2) == 8 +# define D2 8 +# elif (x) DIGIT(2) == 9 +# define D2 9 +# endif + +# if (x) DIGIT(1) == 0 +# define D1 0 +# elif (x) DIGIT(1) == 1 +# define D1 1 +# elif (x) DIGIT(1) == 2 +# define D1 2 +# elif (x) DIGIT(1) == 3 +# define D1 3 +# elif (x) DIGIT(1) == 4 +# define D1 4 +# elif (x) DIGIT(1) == 5 +# define D1 5 +# elif (x) DIGIT(1) == 6 +# define D1 6 +# elif (x) DIGIT(1) == 7 +# define D1 7 +# elif (x) DIGIT(1) == 8 +# define D1 8 +# elif (x) DIGIT(1) == 9 +# define D1 9 +# endif + +//R #line 100 "t_4_003.cpp" +D3 D2 D1 //R 9 8 7 diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_4_004.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_4_004.cpp new file mode 100644 index 000000000..15f66e70f --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_4_004.cpp @@ -0,0 +1,61 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests, whether invalid expression errors get ignored for 'passive' #elif +// expressions +#define USHRT_MAX 0xffffU + +// The number of bytes in a short. +# if !defined (SIZEOF_SHORT) +# if (USHRT_MAX) == 255U +# define SIZEOF_SHORT 1 +# elif (USHRT_MAX) == 65535U +# define SIZEOF_SHORT 2 +# elif (USHRT_MAX) == 4294967295U +# define SIZEOF_SHORT 4 +# elif (USHRT_MAX) == 18446744073709551615U +# define SIZEOF_SHORT 8 +# else +# error: unsupported short size, must be updated for this platform! +# endif /* USHRT_MAX */ +# endif /* !defined (SIZEOF_SHORT) */ + +//R #line 32 "t_4_004.cpp" +//R true +#if SIZEOF_SHORT == 2 +true +#else +false +#endif + +//H 10: t_4_004.cpp(12): #define +//H 08: t_4_004.cpp(12): USHRT_MAX=0xffffU +//H 10: t_4_004.cpp(15): # if +//H 11: t_4_004.cpp(15): # if !defined (SIZEOF_SHORT): 1 +//H 10: t_4_004.cpp(16): # if +//H 01: t_4_004.cpp(12): USHRT_MAX +//H 02: 0xffffU +//H 03: 0xffffU +//H 11: t_4_004.cpp(16): # if (USHRT_MAX) == 255U: 0 +//H 10: t_4_004.cpp(18): # elif +//H 01: t_4_004.cpp(12): USHRT_MAX +//H 02: 0xffffU +//H 03: 0xffffU +//H 11: t_4_004.cpp(18): # elif (USHRT_MAX) == 65535U: 1 +//H 10: t_4_004.cpp(19): #define +//H 08: t_4_004.cpp(19): SIZEOF_SHORT=2 +//H 10: t_4_004.cpp(20): # elif +//H 10: t_4_004.cpp(22): # elif +//H 10: t_4_004.cpp(27): # endif +//H 10: t_4_004.cpp(31): #if +//H 01: t_4_004.cpp(19): SIZEOF_SHORT +//H 02: 2 +//H 03: 2 +//H 11: t_4_004.cpp(31): #if SIZEOF_SHORT == 2: 1 +//H 10: t_4_004.cpp(33): #else diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_001.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_001.cpp new file mode 100644 index 000000000..7a2114229 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_001.cpp @@ -0,0 +1,58 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests the conversion of trigraph sequences. + +// 1.1: The following 9 sequences are valid trigraph sequences. +//R #line 20 "t_5_001.cpp" +"??( ??) ??/??/ ??' ??< ??> ??! ??- ??=" //R "[ ] \\ ^ { } | ~ #" +??( ??) ??/??/ ??' ??< ??> ??! ??- ??= //R [ ] \\ ^ { } | ~ # + +// 1.2: In directive line. +//R #line 26 "t_5_001.cpp" +??= define OR(a, b) a ??! b +OR(1, 2) //R 1 | 2 + +// 1.3: Any sequence other than above 9 is not a trigraph sequence. +//R #line 30 "t_5_001.cpp" +"?? ??? ??% ??^ ???=" //R "?? ??? ??% ??^ ?#" +?? ??? ??% ??^ ???= //R ? ? ? ? ? ? ?% ? ?^ ?# + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_002.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_002.cpp new file mode 100644 index 000000000..1e265095c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_002.cpp @@ -0,0 +1,76 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests the line splicing by <backslash><newline> sequence. + +// 2.1: In a #define directive line, between the parameter list and the +// replacement text. +//R #line 23 "t_5_002.cpp" +#define FUNC(a, b, c) \ + a ## b ## c +FUNC(ab, cd, ef) //R abcdef + +// 2.2: In a #define directive line, among the parameter list and among the +// replacement text. +//R #line 33 "t_5_002.cpp" +#undef FUNC +#define FUNC(a, b \ + , c) \ + a ## b \ + ## c +FUNC(ab, cd, ef) //R abcdef + +// 2.3: In a string literal. +//R #line 37 "t_5_002.cpp" +"abc\ +de" //R "abcde" + +// 2.4: <backslash><newline> in midst of an identifier. +//R #line 43 "t_5_002.cpp" +#define ABCDE 5 +ABC\ +DE //R 5 + +// 2.5: <backslash><newline> by trigraph. +//R #line 48 "t_5_002.cpp" +ABC??/ +DE //R 5 + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_003.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_003.cpp new file mode 100644 index 000000000..55d249d6a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_003.cpp @@ -0,0 +1,68 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests the handling of comments. + +#define STR(x) #x + +// 3.1: A comment is converted to one space. +//R #line 22 "t_5_003.cpp" +STR(abc/* comment */de) //R "abc de" +abc/* comment */de //R abc de + +// 3.2: // is not a comment of C. +// Wave always treats the '//' style as comments (even in C99 mode) +/* assert( strcmp( str( //), "//") == 0); */ + +// 3.3: Comments are parsed prior to the parsing of preprocessing directives. +//R #line 41 "t_5_003.cpp" +#if 0 + "nonsence"; /* +#else + still in + comment */ +#else +#define MACRO_abcd /* + in comment + */ abcd +#endif +MACRO_abcd //R abcd + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_004.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_004.cpp new file mode 100644 index 000000000..e2b1db60c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_004.cpp @@ -0,0 +1,59 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests the handling of comments and <backslash><newline>. + +// This test is currently disabled, because of the known problem in Wave, that +// causes multiple __LINE__ macros on splitted lines after preprocessing +// directives are expanded as the line number of the directive itself. + +// Note: This unit test passes only if Wave was compiled with a defined +// BOOST_WAVE_PREPROCESS_ERROR_MESSAGE_BODY compile time constant +// (which is the default). +#define STR(x) #x + +// 3.4: Comment and <backslash><newline> in #error line. +//E t_5_004.cpp(29): fatal error: encountered #error directive or #pragma wave stop(): (29) Message of first physical line. (30) Message of second physical and first logical line. (32) Message of forth physical and third logical line. +#error (__LINE__) Message of first physical line. \ + (__LINE__) Message of second physical and first logical line. /* + this comment splices the lines + */ (__LINE__) Message of forth physical and third logical line. + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_005.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_005.cpp new file mode 100644 index 000000000..87b3ee182 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_005.cpp @@ -0,0 +1,52 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests the handling of special tokens. + +// 4.1: Digraph spellings in directive line. +//R #line 21 "t_5_005.cpp" +%: define STR(a) %: a +STR(abc) //R "abc" + +// 4.2: Digraph spellings are retained in stringization. +//R #line 25 "t_5_005.cpp" +STR(<:) //R "<:" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_006.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_006.cpp new file mode 100644 index 000000000..6f03d5897 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_006.cpp @@ -0,0 +1,53 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// boostinspect:notab this file needs to contain tabs + +// Tests, whether spaces or tabs are allowed at any place in a pp-directive +// lines, including between the top of a pp-directive line and '#', and between +// the '#' and the directive. + +// /**/[TAB]# /**/[TAB]define /**/[TAB]MACRO[TAB]/**/ abcde /**/ + /**/ # /**/ define /**/ MACRO /**/ abcde /**/ + +//R #line 26 "t_5_006.cpp" +MACRO //R abcde + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_007.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_007.cpp new file mode 100644 index 000000000..be08d5c35 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_007.cpp @@ -0,0 +1,70 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + Some of the tests included in this file were initially taken from the mcpp + V2.5 preprocessor validation suite and were modified to fit into the + Boost.Wave unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests the #include directive (need to switch off include guard detection). +//O --noguard + +// 6.1: Header-name quoted by " and " as well as by < and > can include +// standard headers. +//R #line 23 "t_5_007.cpp" +#include "boost/version.hpp" +BOOST_LIB_VERSION //R "$V" + +//R #line 29 "t_5_007.cpp" +#undef BOOST_VERSION_HPP +#undef BOOST_LIB_VERSION +#include <boost/version.hpp> +BOOST_LIB_VERSION //R "$V" + +// 6.2: Macro is allowed in #include line. +//R #line 36 "t_5_007.cpp" +#undef MACRO_005_007 +#define HEADER "t_5_007.hpp" +#include HEADER +MACRO_005_007 //R abc + +// 6.3: With macro nonsense but legal. +//R #line 43 "t_5_007.cpp" +#undef MACRO_005_007 +#define ZERO_TOKEN +#include ZERO_TOKEN HEADER ZERO_TOKEN +MACRO_005_007 //R abc + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_007.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_007.hpp new file mode 100644 index 000000000..5534d768c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_007.hpp @@ -0,0 +1,12 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests the #include directive. +#define MACRO_005_007 abc + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_008.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_008.cpp new file mode 100644 index 000000000..c934d1192 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_008.cpp @@ -0,0 +1,62 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests the #line directive. + +// 7.1: Line number and filename. +//R #line 1234 "cpp" +#line 1234 "cpp" +__LINE__ //R 1234 +__FILE__ //R "cpp" + +// 7.2: Filename argument is optional. +//R #line 2345 "cpp" +#line 2345 +__LINE__ //R 2345 +__FILE__ //R "cpp" + +// 7.3: Argument with macro. +//R #line 1234 "t_5_008.cpp" +#define LINE_AND_FILENAME 1234 "t_5_008.cpp" +#line LINE_AND_FILENAME +__LINE__ //R 1234 +__FILE__ //R "t_5_008.cpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_009.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_009.cpp new file mode 100644 index 000000000..b3141c977 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_009.cpp @@ -0,0 +1,57 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests the #error directive. + +// 8.1: The original mcpp validation suite claims: +// Argument of #error directive is not a subject of macro expansion. +// +// But the Standard doesn't say anything about this (neither the C99 nor +// the C++ Standard), so Wave allows to be configured at compile time +// whether to macro expand the arguments to an #error directive. +// This test assumes that macro expansion is enabled. + +//E t_5_009.cpp(29): fatal error: encountered #error directive or #pragma wave stop(): 0 is not a positive number. +#define MACRO 0 +#if MACRO <= 0 +#error MACRO is not a positive number. +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_010.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_010.cpp new file mode 100644 index 000000000..40d4609e3 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_010.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests, whether the argument of #error is optional + +// 8.2: #error should be executed even without argument. +//E t_5_010.cpp(20): fatal error: encountered #error directive or #pragma wave stop() +#error + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_011.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_011.cpp new file mode 100644 index 000000000..2805a63be --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_011.cpp @@ -0,0 +1,54 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests, whether the argument of #error is optional + +// 9.1: Any #pragma directive should be processed or ignored, should not +// be diagnosed as an error. +// Wave allows to be configured at compile time, whether unknown #pragmas +// are left untouched or skipped entirely (see the +// BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES pp constant) + +//R #line 27 "t_5_011.cpp" +//R #pragma who knows ? +#pragma once +#pragma who knows ? + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_012.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_012.cpp new file mode 100644 index 000000000..d10107493 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_012.cpp @@ -0,0 +1,74 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests #if, #elif, #else and #endif pp-directives. + +#define MACRO_0 0 +#define MACRO_1 1 + +// 10.1: +// Note: an undefined identifier in #if expression is replaced to 0. +//R #line 30 "t_5_012.cpp" +//R true +#if a +false +#elif MACRO_0 +false +#elif MACRO_1 /* Valid block */ +true +#else +false +#endif + +// 10.2: Comments must be processed even if in skipped #if block. +// At least tokenization of string literal and character constant is +// necessary to process comments, e.g. /* is not a comment mark in string +// literal. + +//R #line 46 "t_5_012.cpp" +//R true +#ifdef UNDEFINED + /* Comment */ + "in literal /* is not a comment" +#else +true +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_013.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_013.cpp new file mode 100644 index 000000000..3245bbd0b --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_013.cpp @@ -0,0 +1,82 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests operator "defined" in #if or #elif directives. + +#define MACRO_abc abc +#define MACRO_0 2 +#define ZERO_TOKEN + +// 11.1: +//R #line 28 "t_5_013.cpp" +//R true +#if defined a +false +#else +true +#endif + +//R #line 34 "t_5_013.cpp" +//R true +#if defined (MACRO_abc) +true +#else +false +#endif + +// 11.2: "defined" is an unary operator whose result is 1 or 0. + +//R #line 46 "t_5_013.cpp" +//R true +#if defined MACRO_0 * 3 != 3 +false +#else +true +#endif + +//R #line 54 "t_5_013.cpp" +//R true +#if (!defined ZERO_TOKEN != 0) || (-defined ZERO_TOKEN != -1) +false +#else +true +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_014.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_014.cpp new file mode 100644 index 000000000..c955d8f9d --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_014.cpp @@ -0,0 +1,114 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests integer preprocessing number token and type of #if expression. + +// 12.1: +//R #line 24 "t_5_014.cpp" +//R true +#if __TESTWAVE_LONG_MAX__ <= __TESTWAVE_LONG_MIN__ + "Bad evaluation of long." +#else +true +#endif + +//R #line 32 "t_5_014.cpp" +//R true +#if __TESTWAVE_LONG_MAX__ <= (__TESTWAVE_LONG_MAX__ / 2) /* 0x3FFFFFFF */ + "Bad evaluation of long." +#else +true +#endif + +// 12.2: +//R #line 41 "t_5_014.cpp" +//R true +#if __TESTWAVE_ULONG_MAX__ / 2 < __TESTWAVE_LONG_MAX__ + "Bad evaluation of unsigned long." +#else +true +#endif + +// 12.3: Octal number. +//R #line 50 "t_5_014.cpp" +//R true +#if 0177777 != 65535 + "Bad evaluation of octal number." +#else +true +#endif + +// 12.4: Hexadecimal number. +//R #line 59 "t_5_014.cpp" +//R true +#if 0Xffff != 65535 || 0xFfFf != 65535 + "Bad evaluation of hexadecimal number." +#else +true +#endif + +// 12.5: Suffix 'L' or 'l'. +//R #line 68 "t_5_014.cpp" +//R true +#if 0L != 0 || 0l != 0 + "Bad evaluation of 'L' suffix." +#else +true +#endif + +// 12.6: Suffix 'U' or 'u'. +//R #line 77 "t_5_014.cpp" +//R true +#if 1U != 1 || 1u != 1 + "Bad evaluation of 'U' suffix." +#else +true +#endif + +// 12.7: Negative integer. +//R #line 86 "t_5_014.cpp" +//R true +#if 0 <= -1 + "Bad evaluation of negative number." +#else +true +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_015.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_015.cpp new file mode 100644 index 000000000..49e4fd496 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_015.cpp @@ -0,0 +1,93 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests valid operators in #if expression. + +// Valid operators are (precedence in this order) : +// defined, (unary)+, (unary)-, ~, !, +// *, /, %, +// +, -, +// <<, >>, +// <, >, <=, >=, +// ==, !=, +// &, +// ^, +// |, +// &&, +// ||, +// ? : + +// 13.1: Bit shift. +//R #line 38 "t_5_015.cpp" +//R true +#if 1 << 2 != 4 || 8 >> 1 != 4 + "Bad arithmetic of <<, >> operators." +#else +true +#endif + +// 13.2: Bitwise operators. +//R #line 47 "t_5_015.cpp" +//R true +#if (3 ^ 5) != 6 || (3 | 5) != 7 || (3 & 5) != 1 + "Bad arithmetic of ^, |, & operators." +#else +true +#endif + +// 13.3: Result of ||, && operators is either of 1 or 0. +//R #line 56 "t_5_015.cpp" +//R true +#if (2 || 3) != 1 || (2 && 3) != 1 || (0 || 4) != 1 || (0 && 5) != 0 + "Bad arithmetic of ||, && operators." +#else +true +#endif + +// 13.4: ?, : operator. +//R #line 65 "t_5_015.cpp" +//R true +#if (0 ? 1 : 2) != 2 + "Bad arithmetic of ?: operator."; +#else +true +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_016.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_016.cpp new file mode 100644 index 000000000..f7bcc0f11 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_016.cpp @@ -0,0 +1,79 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests arithmetic conversion in #if expressions. + +// 13.5: The usual arithmetic conversion is not performed on bit shift. +//R #line 24 "t_5_016.cpp" +//R true +#if -1 << 3U > 0 + "Bad conversion of bit shift operands." +#else +true +#endif + +// 13.6: Usual arithmetic conversions. +//R #line 33 "t_5_016.cpp" +//R true +#if -1 <= 0U /* -1 is converted to unsigned long. */ + "Bad arithmetic conversion." +#else +true +#endif + +//R #line 41 "t_5_016.cpp" +//R true +#if -1 * 1U <= 0 + "Bad arithmetic conversion." +#else +true +#endif + +// Second and third operands of conditional operator are converted to the +// same type, thus -1 is converted to unsigned long. +//R #line 51 "t_5_016.cpp" +//R true +#if (1 ? -1 : 0U) <= 0 + "Bad arithmetic conversion."; +#else +true +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_017.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_017.cpp new file mode 100644 index 000000000..6a3679494 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_017.cpp @@ -0,0 +1,88 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests short-circuit evaluation of #if expression. + +#define MACRO_0 0 + +// 13.7: 10/0 or 10/MACRO_0 are never evaluated, "divide by zero" error +// cannot occur. + +//R #line 28 "t_5_017.cpp" +//R true +#if 0 && 10 / 0 +false +#else +true +#endif + +//R #line 36 "t_5_017.cpp" +//R true +#if not_defined && 10 / not_defined +false +#else +true +#endif + +//R #line 44 "t_5_017.cpp" +//R true +#if MACRO_0 && 10 / MACRO_0 > 1 +false +#else +true +#endif + +//R #line 52 "t_5_017.cpp" +//R true +#if MACRO_0 ? 10 / MACRO_0 : 0 +false +#else +true +#endif + +//R #line 58 "t_5_017.cpp" +//R true +#if MACRO_0 == 0 || 10 / MACRO_0 > 1 /* Valid block */ +true +#else +false +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_018.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_018.cpp new file mode 100644 index 000000000..8683accaa --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_018.cpp @@ -0,0 +1,91 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests grouping of sub-expressions in #if expression. + +// 13.8: Unary operators are grouped from right to left. +//R #line 24 "t_5_018.cpp" +//R true +#if (- -1 != 1) || (!!9 != 1) || (-!+!9 != -1) || (~~1 != 1) + "Bad grouping of -, +, !, ~ in #if expression." +#else +true +#endif + +// 13.9: ?: operators are grouped from right to left. +//R #line 33 "t_5_018.cpp" +//R true +#if (1 ? 2 ? 3 ? 3 : 2 : 1 : 0) != 3 + "Bad grouping of ? : in #if expression." +#else +true +#endif + +// 13.10: Other operators are grouped from left to right. +//R #line 42 "t_5_018.cpp" +//R true +#if (15 >> 2 >> 1 != 1) || (3 << 2 << 1 != 24) + "Bad grouping of >>, << in #if expression." +#else +true +#endif + +// 13.11: Test of precedence. +//R #line 51 "t_5_018.cpp" +//R true +#if 3*10/2 >> !0*2 >> !+!-9 != 1 + "Bad grouping of -, +, !, *, /, >> in #if expression." +#else +true +#endif + +// 13.12: Overall test. Grouped as: +// ((((((+1 - -1 - ~~1 - -!0) & 6) | ((8 % 9) ^ (-2 * -2))) >> 1) == 7) +// ? 7 : 0) != 7 +// evaluates to false. +//R #line 63 "t_5_018.cpp" +//R true +#if (((+1- -1-~~1- -!0&6|8%9^-2*-2)>>1)==7?7:0)!=7 + "Bad arithmetic of #if expression." +#else +true +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_019.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_019.cpp new file mode 100644 index 000000000..e5bbf1a84 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_019.cpp @@ -0,0 +1,72 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests #if expressions with macros. + +#define ZERO_TOKEN +#define MACRO_0 0 +#define MACRO_1 1 + +#define and_op && +#define or_op || +#define not_eq_op != +#define bitor_op | + +// 13.13: With macros expanding to operators. +//R #line 32 "t_5_019.cpp" +//R true +#if (1 bitor_op 2) == 3 and_op 4 not_eq_op 5 or_op 0 +// #if (1 | 2) == 3 && 4 != 5 || 0 +true +#else + "Bad evaluation of macros expanding to operators in #if expression." +#endif + +// 13.14: With macros expanding to nothing, nonsence but legal. +//R #line 42 "t_5_019.cpp" +//R true +#if ZERO_TOKEN MACRO_1 ZERO_TOKEN > ZERO_TOKEN MACRO_0 ZERO_TOKEN +// #if 1 > 0 +true +#else + "Bad evaluation of macros expanding to 0 token in #if expression." +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_020.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_020.cpp new file mode 100644 index 000000000..877a8a7ea --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_020.cpp @@ -0,0 +1,64 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests #ifdef, #ifndef directives. + +#define MACRO_0 0 +#define MACRO_1 1 + +// 15.1: #ifdef directive. +//R #line 25 "t_5_020.cpp" +//R true +#ifdef MACRO_1 /* Valid block */ +true +#else +false +#endif + +// 15.2: #ifndef directive. +//R #line 36 "t_5_020.cpp" +//R true +#ifndef MACRO_1 +false +#else /* Valid block */ +true +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_021.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_021.cpp new file mode 100644 index 000000000..1edd2d041 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_021.cpp @@ -0,0 +1,69 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests #define directive. + +// Excerpts from ISO C 6.8.3 "Examples". +#define OBJ_LIKE (1-1) +#define FTN_LIKE(a) ( a ) + +// 18.1: Definition of an object-like macro. +//R #line 24 "t_5_021.cpp" +OBJ_LIKE //R (1-1) + +//R #line 32 "t_5_021.cpp" +//R true +#define ZERO_TOKEN +#ifndef ZERO_TOKEN + "Can't define macro to 0-token." +#else +true +#endif + +// 18.2: Definition of a function-like macro. +//R #line 37 "t_5_021.cpp" +FTN_LIKE(3) //R ( 3 ) + +// 18.3: Spelling in string identical to parameter is not a parameter. +//R #line 42 "t_5_021.cpp" +#define STR(n1, n2) "n1:n2" +STR(1, 2) //R "n1:n2" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_022.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_022.cpp new file mode 100644 index 000000000..fd287dba2 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_022.cpp @@ -0,0 +1,59 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests valid re-definitions of macros. + +/* Excerpts from ISO C 6.8.3 "Examples". */ +#define OBJ_LIKE (1-1) +#define FTN_LIKE(a) ( a ) + +// 19.1: +//R #line 25 "t_5_022.cpp" +#define OBJ_LIKE /* white space */ (1-1) /* other */ +OBJ_LIKE //R (1-1) + +// 19.2: +//R #line 32 "t_5_022.cpp" +#define FTN_LIKE( a )( /* note the white space */ \ + a /* other stuff on this line + */ ) +FTN_LIKE(3) //R ( 3 ) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_023.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_023.cpp new file mode 100644 index 000000000..6450af6c0 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_023.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests macro lexically identical to keyword. + +// 20.1: +//R #line 21 "t_5_023.cpp" +#define float double +float //R double + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_024.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_024.cpp new file mode 100644 index 000000000..64c9b849a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_024.cpp @@ -0,0 +1,54 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests tokenization (No preprocessing tokens are merged implicitly). + +// 21.1: +//R #line 21 "t_5_024.cpp" +#define MINUS - +-MINUS-1 //R - - -1 + +// 21.2: +//R #line 27 "t_5_024.cpp" +#define sub(a, b) a-b /* '(a)-(b)' would be better */ +#define Y -y /* '(-y)' would be better */ +sub(x, Y) //R x- -y + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_025.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_025.cpp new file mode 100644 index 000000000..3243fc885 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_025.cpp @@ -0,0 +1,64 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests tokenization of preprocessing numbers. + +// Note: Wave curently fails the tests 22.1 and 22.2 because of Wave's design +// choice to act on C++ tokens and not on the raw inut stream. +// This limitation will be removed in a future release. + +#define STR1(a) # a +#define STR(a) STR1(a) +#define EXP 1 + +// 22.1: 12E+EXP is a preprocessing number, EXP is not expanded. +//R #line 28 "t_5_025.cpp" +STR(12E+EXP) //R "12E+EXP" + +// 22.2: .2e-EXP is also a preprocessing number. +//R #line 32 "t_5_025.cpp" +STR(.2e-EXP) //R ".2e-EXP" + +// 22.3: + or - is allowed only following E or e, 12+EXP is not +// a preprocessing number. +//R #line 37 "t_5_025.cpp" +STR(12+EXP) //R "12+1" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_026.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_026.cpp new file mode 100644 index 000000000..a70da086d --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_026.cpp @@ -0,0 +1,60 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests ## operator in macro definition. + +// TODO: revise the --variadics mode +//O --variadics + +#define GLUE(a, b) a ## b +#define XGLUE(a, b) GLUE(a, b) +#define MACRO_0 0 +#define MACRO_1 1 + +// 23.1: +//R #line 28 "t_5_026.cpp" +GLUE(x, y) //R xy + +// 23.2: Generate a preprocessing number. +//R #line 33 "t_5_026.cpp" +#define EXP 2 +XGLUE(.12e+, EXP) //R .12e+2 + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_027.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_027.cpp new file mode 100644 index 000000000..84066c5ae --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_027.cpp @@ -0,0 +1,70 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests # operator in macro definition. + +// 24.1: +//R #line 21 "t_5_027.cpp" +#define STR(a) # a +STR(a+b) //R "a+b" + +// 24.2: White spaces between tokens of operand are converted to one space. +//R #line 25 "t_5_027.cpp" +STR( ab /* comment */ + + cd ) //R "ab + cd" + +// 24.3: \ is inserted before \ and " in or surrounding literals and no +// other character is inserted to anywhere. +//R #line 31 "t_5_027.cpp" +STR( '"' + "' \"") //R "'\"' + \"' \\\"\"" + +// 24.4: Line splicing by <backslash><newline> is done prior to token parsing. +//R #line 35 "t_5_027.cpp" +STR( "ab\ +c") //R "\"abc\"" + +// 24.5: Token separator inserted by macro expansion should be removed. +// (Meanwhile, tokens should not be merged. See 21.2.) +//R #line 43 "t_5_027.cpp" +#define XSTR(a) STR(a) +#define f(a) a +XSTR(x-f(y)) //R "x-y" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_028.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_028.cpp new file mode 100644 index 000000000..15888794c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_028.cpp @@ -0,0 +1,75 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests whether macro arguments are pre-expanded (unless the argument is an +// operand of # or ## operator) separately, that is, are macro-replaced +// completely prior to rescanning. + +#define ZERO_TOKEN +#define MACRO_0 0 +#define MACRO_1 1 +#define TWO_ARGS a,b +#define SUB(x, y) (x - y) +#define GLUE(a, b) a ## b +#define XGLUE(a, b) GLUE( a, b) +#define STR(a) # a + +// 25.1: "TWO_ARGS" is read as one argument to "SUB", then expanded to +// "a,b", then "x" is substituted by "a,b". +//R #line 32 "t_5_028.cpp" +SUB(TWO_ARGS, 1) //R (a,b - 1) + +// 25.2: An argument pre-expanded to 0-token. */ +//R #line 36 "t_5_028.cpp" +SUB(ZERO_TOKEN, a) //R ( - a) + +// 25.3: "glue( a, b)" is pre-expanded. */ +//R #line 40 "t_5_028.cpp" +XGLUE(GLUE(a, b), c) //R abc + +// 25.4: Operands of ## operator are not pre-expanded. +//R #line 44 "t_5_028.cpp" +GLUE(MACRO_0, MACRO_1) //R MACRO_0MACRO_1 + +// 25.5: Operand of # operator is not pre-expanded. +//R #line 48 "t_5_028.cpp" +STR(ZERO_TOKEN) //R "ZERO_TOKEN" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_029.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_029.cpp new file mode 100644 index 000000000..202529c6b --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_029.cpp @@ -0,0 +1,69 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests whether the name once replaced is not further replaced. + +// 26.1: Directly recursive object-like macro definition. +//R #line 21 "t_5_029.cpp" +#define Z Z[0] +Z //R Z[0] + +// 26.2: Intermediately recursive object-like macro definition. +//R #line 27 "t_5_029.cpp" +#define AB BA +#define BA AB +AB //R AB + +// 26.3: Directly recursive function-like macro definition. +//R #line 32 "t_5_029.cpp" +#define f(a) a + f(a) +f(x) //R x + f(x) + +// 26.4: Intermediately recursive function-like macro definition. +//R #line 38 "t_5_029.cpp" +#define g(a) a + h(a) +#define h(a) a + g(a) +g(x) //R x + x + g(x) + +// 26.5: Rescanning encounters the non-replaced macro name. +//R #line 42 "t_5_029.cpp" +f(Z) //R Z[0] + f(Z[0]) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_030.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_030.cpp new file mode 100644 index 000000000..338467aee --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_030.cpp @@ -0,0 +1,93 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests whether rescanning of a macro replace any macro call in the replacement +// text after substitution of parameters by pre-expanded-arguments. This +// re-examination may involve the succeeding sequences from the source +// file (what a queer thing!). + +// Note: The tests 27.4 and 27.5 are currently disabled because of Wave's +// problem with replacement-list terminating in partial macro expansion. + +// 27.1: Cascaded use of object-like macros. +//R #line 34 "t_5_030.cpp" +#define NEST8 NEST7 + 8 +#define NEST7 NEST6 + 7 +#define NEST6 NEST5 + 6 +#define NEST5 NEST4 + 5 +#define NEST4 NEST3 + 4 +#define NEST3 NEST2 + 3 +#define NEST2 NEST1 + 2 +#define NEST1 1 +NEST8 //R 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + +// 27.2: Cascaded use of function-like macros. +//R #line 42 "t_5_030.cpp" +#define FUNC4(a, b) FUNC3(a, b) + NEST4 +#define FUNC3(a, b) FUNC2(a, b) + NEST3 +#define FUNC2(a, b) FUNC1(a, b) + NEST2 +#define FUNC1(a, b) (a) + (b) +FUNC4(NEST1, NEST2) //R (1) + ( 1 + 2) + 1 + 2 + 1 + 2 + 3 + 1 + 2 + 3 + 4 + +// 27.3: An identifier generated by ## operator is subject to expansion. +//R #line 48 "t_5_030.cpp" +#define GLUE( a, b) a ## b +#define MACRO_1 1 +GLUE(MACRO_, 1) //R 1 + +// 27.4: 'SUB' as an argument of math() is not pre-expanded, since '(' +// missing. +//R #line 55 "t_5_030.cpp" +#define SUB(x, y) (x - y) +#define MATH(op, a, b) op( (a), (b)) +MATH(SUB, a, b) //R ( ( a) - ( b)) + +// 27.5: Queer thing. +// R #line 28 "t_5_030.cpp" +//#define HEAD SUB( +// HEAD a,b ) // R + +// 27.6: Recursive macro. +//R #line 66 "t_5_030.cpp" +#define M N +#define N(a) a +M(m) //R m + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_031.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_031.cpp new file mode 100644 index 000000000..7c1453c07 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_031.cpp @@ -0,0 +1,78 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests whether __FILE__, __LINE__, __DATE__, __TIME__, __STDC__ and +// __STDC_VERSION__ are predefined. + +// The tests 28.3 and 28.4 are disabled because it is nearly impossible to +// verify the __DATE__ and __TIME__ macro expansion (at least I have no idea +// how to achieve this reliably). + +// 28.1: +//R #line 25 "t_5_031.cpp" +__FILE__ //R "$F" + +// 28.2: +//R #line 29 "t_5_031.cpp" +__LINE__ //R 29 + +// 28.3: +// R #line 29 "t_5_031.cpp" +//__DATE__ + +// 28.4: +// R #line 33 "t_5_031.cpp" +//__TIME__ + +// 28.5: +//R #line 41 "t_5_031.cpp" +__STDC__ //R 1 + +// 28.6: +//R #line 45 "t_5_031.cpp" +__STDC_VERSION__ //R __STDC_VERSION__ + +// 28.7: +//R #line 16 "t_5_031.hpp" +//R "$P(t_5_031.hpp)" +//R 17 +#include "t_5_031.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_031.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_031.hpp new file mode 100644 index 000000000..43f1d3984 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_031.hpp @@ -0,0 +1,44 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +__FILE__ +__LINE__ + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_032.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_032.cpp new file mode 100644 index 000000000..f04f05cf9 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_032.cpp @@ -0,0 +1,72 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests the #undef directive. + +// 29.1: Undefined macro is not a macro. +//R #line 23 "t_5_032.cpp" +//R true +#define DEFINED +#if defined(DEFINED) +true +#else +false +#endif + +//R #line 34 "t_5_032.cpp" +//R true +#undef DEFINED +#if defined(DEFINED) +false +#else +true +#endif + +// 29.2: Undefining undefined name is not an error. +//R #line 44 "t_5_032.cpp" +//R true +#undef UNDEFINED +#if defined(UNDEFINED) +false +#else +true +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_033.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_033.cpp new file mode 100644 index 000000000..672ebd92c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_033.cpp @@ -0,0 +1,58 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests macro calls. + +// 30.1: A macro call crossing lines. +//R #line 22 "t_5_033.cpp" +//R a + b + c +#define FUNC(a, b, c) a + b + c +FUNC +( + a, + b, + c +) + +// 30.2: A macro call containing additional parenthesises +//R #line 31 "t_5_033.cpp" +FUNC(a, (b + c), d) //R a + (b + c) + d + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_034.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_034.cpp new file mode 100644 index 000000000..92f609f6d --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_034.cpp @@ -0,0 +1,61 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests escape sequence in character constant in #if expression. + +// 32.1: Character octal escape sequence. +//R #line 24 "t_5_034.cpp" +//R true +#if '\123' != 83 + "Bad evaluation of octal escape sequence." +#else +true +#endif + +// 32.2: Character hexadecimal escape sequence. +//R #line 33 "t_5_034.cpp" +//R true +#if '\x1b' != '\033' + "Bad evaluation of hexadecimal escape sequence." +#else +true +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035.cpp new file mode 100644 index 000000000..5c5d6bc15 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035.cpp @@ -0,0 +1,137 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#define ABCDEFGHIJKLMNOPQRSTUVWXYZabcde 0 +#define ABCDEFGHIJKLMNOPQRSTUVWXYZabcd_ 1 + +// 37.1: Number of parameters in macro: at least 31. +#define GLUE31(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E) \ + a##b##c##d##e##f##g##h##i##j##k##l##m##n##o##p##q##r##s##t##u##v##w##x##y##z##A##B##C##D##E + +// 37.2: Number of arguments in macro call: at least 31. +//R #line 28 "t_5_035.cpp" +//R 0 +GLUE31( A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, + S, T, U, V, W, X, Y, Z, a, b, c, d, e) + +// 37.3: Significant initial characters in an internal identifier or +// macro name: at least 31. +//R #line 34 "t_5_035.cpp" +ABCDEFGHIJKLMNOPQRSTUVWXYZabcd_ //R 1 + +// 37.4: Nested conditional inclusion: at least 8 levels. +//R #line 65 "t_5_035.cpp" +#define NEST 0 +#ifdef A +#else +# ifdef B +# else +# ifdef C +# else +# ifdef D +# else +# ifdef E +# else +# ifdef F +# else +# ifdef G +# else +# ifdef H +# else +#undef NEST +#define NEST 1 +# endif +# endif +# endif +# endif +# endif +# endif +# endif +#endif +NEST //R 1 + +// 37.5: Nested source file inclusion: at least 8 levels. +//R #line 70 "t_5_035.cpp" +#include "t_5_035_01.hpp" +NEST //R 8 + +// 37.6: Parenthesized expression: at least 32 levels. +//R #line 81 "t_5_035.cpp" +#if 0 + (1 - (2 + (3 - (4 + (5 - (6 + (7 - (8 + (9 - (10 + (11 - (12 + \ + (13 - (14 + (15 - (16 + (17 - (18 + (19 - (20 + (21 - (22 + (23 - \ + (24 + (25 - (26 + (27 - (28 + (29 - (30 + (31 - (32 + 0)))))))))) \ + )))))))))))))))))))))) == 0 +#undef NEST +#define NEST 32 +#endif +NEST //R 32 + +// 37.7: Characters in a string (after concatenation): at least 509. +//R #line 86 "t_5_035.cpp" +//R "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567" +"123456789012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789012345678901234567890123456789\ +012345678901234567" + +// 37.8: Characters in a logical source line: at least 509. +//R #line 98 "t_5_035.cpp" +//R 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 +123456789012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789012345678901234567890123456789\ +0123456789012345678901234567890123456789012345678901234567890123456789\ +012345678901234567 + +// 37.9: Macro definitions: at least 1024. +//R #line 110 "t_5_035.cpp" +#include "t_5_035.hpp" +ZX //R 1 + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035.hpp new file mode 100644 index 000000000..2a48af765 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035.hpp @@ -0,0 +1,1069 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits (number of possible macro definitions should be at +// least 1024). + +#define AA +#define AB +#define AC +#define AD +#define AE +#define AF +#define AG +#define AH +#define AI +#define AJ +#define AK +#define AL +#define AM +#define AN +#define AO +#define AP +#define AQ +#define AR +#define AS +#define AT +#define AU +#define AV +#define AW +#define AX +#define AY +#define AZ +#define Aa +#define Ab +#define Ac +#define Ad +#define Ae +#define Af +#define Ag +#define Ah +#define Ai +#define Aj +#define Ak +#define Al +#define Am +#define An +#define BA +#define BB +#define BC +#define BD +#define BE +#define BF +#define BG +#define BH +#define BI +#define BJ +#define BK +#define BL +#define BM +#define BN +#define BO +#define BP +#define BQ +#define BR +#define BS +#define BT +#define BU +#define BV +#define BW +#define BX +#define BY +#define BZ +#define Ba +#define Bb +#define Bc +#define Bd +#define Be +#define Bf +#define Bg +#define Bh +#define Bi +#define Bj +#define Bk +#define Bl +#define Bm +#define Bn +#define CA +#define CB +#define CC +#define CD +#define CE +#define CF +#define CG +#define CH +#define CI +#define CJ +#define CK +#define CL +#define CM +#define CN +#define CO +#define CP +#define CQ +#define CR +#define CS +#define CT +#define CU +#define CV +#define CW +#define CX +#define CY +#define CZ +#define Ca +#define Cb +#define Cc +#define Cd +#define Ce +#define Cf +#define Cg +#define Ch +#define Ci +#define Cj +#define Ck +#define Cl +#define Cm +#define Cn +#define DA +#define DB +#define DC +#define DD +#define DE +#define DF +#define DG +#define DH +#define DI +#define DJ +#define DK +#define DL +#define DM +#define DN +#define DO +#define DP +#define DQ +#define DR +#define DS +#define DT +#define DU +#define DV +#define DW +#define DX +#define DY +#define DZ +#define Da +#define Db +#define Dc +#define Dd +#define De +#define Df +#define Dg +#define Dh +#define Di +#define Dj +#define Dk +#define Dl +#define Dm +#define Dn +#define EA +#define EB +#define EC +#define ED +#define EE +#define EF +#define EG +#define EH +#define EI +#define EJ +#define EK +#define EL +#define EM +#define EN +#define EO +#define EP +#define EQ +#define ER +#define ES +#define ET +#define EU +#define EV +#define EW +#define EX +#define EY +#define EZ +#define Ea +#define Eb +#define Ec +#define Ed +#define Ee +#define Ef +#define Eg +#define Eh +#define Ei +#define Ej +#define Ek +#define El +#define Em +#define En +#define FA +#define FB +#define FC +#define FD +#define FE +#define FF +#define FG +#define FH +#define FI +#define FJ +#define FK +#define FL +#define FM +#define FN +#define FO +#define FP +#define FQ +#define FR +#define FS +#define FT +#define FU +#define FV +#define FW +#define FX +#define FY +#define FZ +#define Fa +#define Fb +#define Fc +#define Fd +#define Fe +#define Ff +#define Fg +#define Fh +#define Fi +#define Fj +#define Fk +#define Fl +#define Fm +#define Fn +#define GA +#define GB +#define GC +#define GD +#define GE +#define GF +#define GG +#define GH +#define GI +#define GJ +#define GK +#define GL +#define GM +#define GN +#define GO +#define GP +#define GQ +#define GR +#define GS +#define GT +#define GU +#define GV +#define GW +#define GX +#define GY +#define GZ +#define Ga +#define Gb +#define Gc +#define Gd +#define Ge +#define Gf +#define Gg +#define Gh +#define Gi +#define Gj +#define Gk +#define Gl +#define Gm +#define Gn +#define HA +#define HB +#define HC +#define HD +#define HE +#define HF +#define HG +#define HH +#define HI +#define HJ +#define HK +#define HL +#define HM +#define HN +#define HO +#define HP +#define HQ +#define HR +#define HS +#define HT +#define HU +#define HV +#define HW +#define HX +#define HY +#define HZ +#define Ha +#define Hb +#define Hc +#define Hd +#define He +#define Hf +#define Hg +#define Hh +#define Hi +#define Hj +#define Hk +#define Hl +#define Hm +#define Hn +#define IA +#define IB +#define IC +#define ID +#define IE +#define IF +#define IG +#define IH +#define II +#define IJ +#define IK +#define IL +#define IM +#define IN +#define IO +#define IP +#define IQ +#define IR +#define IS +#define IT +#define IU +#define IV +#define IW +#define IX +#define IY +#define IZ +#define Ia +#define Ib +#define Ic +#define Id +#define Ie +#define If +#define Ig +#define Ih +#define Ii +#define Ij +#define Ik +#define Il +#define Im +#define In +#define JA +#define JB +#define JC +#define JD +#define JE +#define JF +#define JG +#define JH +#define JI +#define JJ +#define JK +#define JL +#define JM +#define JN +#define JO +#define JP +#define JQ +#define JR +#define JS +#define JT +#define JU +#define JV +#define JW +#define JX +#define JY +#define JZ +#define Ja +#define Jb +#define Jc +#define Jd +#define Je +#define Jf +#define Jg +#define Jh +#define Ji +#define Jj +#define Jk +#define Jl +#define Jm +#define Jn +#define KA +#define KB +#define KC +#define KD +#define KE +#define KF +#define KG +#define KH +#define KI +#define KJ +#define KK +#define KL +#define KM +#define KN +#define KO +#define KP +#define KQ +#define KR +#define KS +#define KT +#define KU +#define KV +#define KW +#define KX +#define KY +#define KZ +#define Ka +#define Kb +#define Kc +#define Kd +#define Ke +#define Kf +#define Kg +#define Kh +#define Ki +#define Kj +#define Kk +#define Kl +#define Km +#define Kn +#define LA +#define LB +#define LC +#define LD +#define LE +#define LF +#define LG +#define LH +#define LI +#define LJ +#define LK +#define LL +#define LM +#define LN +#define LO +#define LP +#define LQ +#define LR +#define LS +#define LT +#define LU +#define LV +#define LW +#define LX +#define LY +#define LZ +#define La +#define Lb +#define Lc +#define Ld +#define Le +#define Lf +#define Lg +#define Lh +#define Li +#define Lj +#define Lk +#define Ll +#define Lm +#define Ln +#define MA +#define MB +#define MC +#define MD +#define ME +#define MF +#define MG +#define MH +#define MI +#define MJ +#define MK +#define ML +#define MM +#define MN +#define MO +#define MP +#define MQ +#define MR +#define MS +#define MT +#define MU +#define MV +#define MW +#define MX +#define MY +#define MZ +#define Ma +#define Mb +#define Mc +#define Md +#define Me +#define Mf +#define Mg +#define Mh +#define Mi +#define Mj +#define Mk +#define Ml +#define Mm +#define Mn +#define NA +#define NB +#define NC +#define ND +#define NE +#define NF +#define NG +#define NH +#define NI +#define NJ +#define NK +#define NL +#define NM +#define NN +#define NO +#define NP +#define NQ +#define NR +#define NS +#define NT +#define NU +#define NV +#define NW +#define NX +#define NY +#define NZ +#define Na +#define Nb +#define Nc +#define Nd +#define Ne +#define Nf +#define Ng +#define Nh +#define Ni +#define Nj +#define Nk +#define Nl +#define Nm +#define Nn +#define OA +#define OB +#define OC +#define OD +#define OE +#define OF +#define OG +#define OH +#define OI +#define OJ +#define OK +#define OL +#define OM +#define ON +#define OO +#define OP +#define OQ +#define OR +#define OS +#define OT +#define OU +#define OV +#define OW +#define OX +#define OY +#define OZ +#define Oa +#define Ob +#define Oc +#define Od +#define Oe +#define Of +#define Og +#define Oh +#define Oi +#define Oj +#define Ok +#define Ol +#define Om +#define On +#define PA +#define PB +#define PC +#define PD +#define PE +#define PF +#define PG +#define PH +#define PI +#define PJ +#define PK +#define PL +#define PM +#define PN +#define PO +#define PP +#define PQ +#define PR +#define PS +#define PT +#define PU +#define PV +#define PW +#define PX +#define PY +#define PZ +#define Pa +#define Pb +#define Pc +#define Pd +#define Pe +#define Pf +#define Pg +#define Ph +#define Pi +#define Pj +#define Pk +#define Pl +#define Pm +#define Pn +#define QA +#define QB +#define QC +#define QD +#define QE +#define QF +#define QG +#define QH +#define QI +#define QJ +#define QK +#define QL +#define QM +#define QN +#define QO +#define QP +#define QQ +#define QR +#define QS +#define QT +#define QU +#define QV +#define QW +#define QX +#define QY +#define QZ +#define Qa +#define Qb +#define Qc +#define Qd +#define Qe +#define Qf +#define Qg +#define Qh +#define Qi +#define Qj +#define Qk +#define Ql +#define Qm +#define Qn +#define RA +#define RB +#define RC +#define RD +#define RE +#define RF +#define RG +#define RH +#define RI +#define RJ +#define RK +#define RL +#define RM +#define RN +#define RO +#define RP +#define RQ +#define RR +#define RS +#define RT +#define RU +#define RV +#define RW +#define RX +#define RY +#define RZ +#define Ra +#define Rb +#define Rc +#define Rd +#define Re +#define Rf +#define Rg +#define Rh +#define Ri +#define Rj +#define Rk +#define Rl +#define Rm +#define Rn +#define SA +#define SB +#define SC +#define SD +#define SE +#define SF +#define SG +#define SH +#define SI +#define SJ +#define SK +#define SL +#define SM +#define SN +#define SO +#define SP +#define SQ +#define SR +#define SS +#define ST +#define SU +#define SV +#define SW +#define SX +#define SY +#define SZ +#define Sa +#define Sb +#define Sc +#define Sd +#define Se +#define Sf +#define Sg +#define Sh +#define Si +#define Sj +#define Sk +#define Sl +#define Sm +#define Sn +#define TA +#define TB +#define TC +#define TD +#define TE +#define TF +#define TG +#define TH +#define TI +#define TJ +#define TK +#define TL +#define TM +#define TN +#define TO +#define TP +#define TQ +#define TR +#define TS +#define TT +#define TU +#define TV +#define TW +#define TX +#define TY +#define TZ +#define Ta +#define Tb +#define Tc +#define Td +#define Te +#define Tf +#define Tg +#define Th +#define Ti +#define Tj +#define Tk +#define Tl +#define Tm +#define Tn +#define UA +#define UB +#define UC +#define UD +#define UE +#define UF +#define UG +#define UH +#define UI +#define UJ +#define UK +#define UL +#define UM +#define UN +#define UO +#define UP +#define UQ +#define UR +#define US +#define UT +#define UU +#define UV +#define UW +#define UX +#define UY +#define UZ +#define Ua +#define Ub +#define Uc +#define Ud +#define Ue +#define Uf +#define Ug +#define Uh +#define Ui +#define Uj +#define Uk +#define Ul +#define Um +#define Un +#define VA +#define VB +#define VC +#define VD +#define VE +#define VF +#define VG +#define VH +#define VI +#define VJ +#define VK +#define VL +#define VM +#define VN +#define VO +#define VP +#define VQ +#define VR +#define VS +#define VT +#define VU +#define VV +#define VW +#define VX +#define VY +#define VZ +#define Va +#define Vb +#define Vc +#define Vd +#define Ve +#define Vf +#define Vg +#define Vh +#define Vi +#define Vj +#define Vk +#define Vl +#define Vm +#define Vn +#define WA +#define WB +#define WC +#define WD +#define WE +#define WF +#define WG +#define WH +#define WI +#define WJ +#define WK +#define WL +#define WM +#define WN +#define WO +#define WP +#define WQ +#define WR +#define WS +#define WT +#define WU +#define WV +#define WW +#define WX +#define WY +#define WZ +#define Wa +#define Wb +#define Wc +#define Wd +#define We +#define Wf +#define Wg +#define Wh +#define Wi +#define Wj +#define Wk +#define Wl +#define Wm +#define Wn +#define XA +#define XB +#define XC +#define XD +#define XE +#define XF +#define XG +#define XH +#define XI +#define XJ +#define XK +#define XL +#define XM +#define XN +#define XO +#define XP +#define XQ +#define XR +#define XS +#define XT +#define XU +#define XV +#define XW +#define XX +#define XY +#define XZ +#define Xa +#define Xb +#define Xc +#define Xd +#define Xe +#define Xf +#define Xg +#define Xh +#define Xi +#define Xj +#define Xk +#define Xl +#define Xm +#define Xn +#define YA +#define YB +#define YC +#define YD +#define YE +#define YF +#define YG +#define YH +#define YI +#define YJ +#define YK +#define YL +#define YM +#define YN +#define YO +#define YP +#define YQ +#define YR +#define YS +#define YT +#define YU +#define YV +#define YW +#define YX +#define YY +#define YZ +#define Ya +#define Yb +#define Yc +#define Yd +#define Ye +#define Yf +#define Yg +#define Yh +#define Yi +#define Yj +#define Yk +#define Yl +#define Ym +#define Yn +#define ZA +#define ZB +#define ZC +#define ZD +#define ZE +#define ZF +#define ZG +#define ZH +#define ZI +#define ZJ +#define ZK +#define ZL +#define ZM +#define ZN +#define ZO +#define ZP +#define ZQ +#define ZR +#define ZS +#define ZT +#define ZU +#define ZV +#define ZW +#define ZX 1 + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_01.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_01.hpp new file mode 100644 index 000000000..ec93622bb --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_01.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#undef NEST +#define NEST 1 + +#include "t_5_035_02.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_02.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_02.hpp new file mode 100644 index 000000000..e43a593d9 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_02.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#undef NEST +#define NEST 2 + +#include "t_5_035_03.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_03.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_03.hpp new file mode 100644 index 000000000..b721c89e9 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_03.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#undef NEST +#define NEST 3 + +#include "t_5_035_04.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_04.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_04.hpp new file mode 100644 index 000000000..c754d4277 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_04.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#undef NEST +#define NEST 4 + +#include "t_5_035_05.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_05.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_05.hpp new file mode 100644 index 000000000..3a07b6f42 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_05.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#undef NEST +#define NEST 5 + +#include "t_5_035_06.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_06.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_06.hpp new file mode 100644 index 000000000..5c2a6859c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_06.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#undef NEST +#define NEST 6 + +#include "t_5_035_07.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_07.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_07.hpp new file mode 100644 index 000000000..d95d6a070 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_07.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#undef NEST +#define NEST 7 + +#include "t_5_035_08.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_08.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_08.hpp new file mode 100644 index 000000000..2a346da78 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_08.hpp @@ -0,0 +1,54 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#ifndef X0F + +#undef NEST +#define NEST 8 + +#else + +#include "t_5_035_09.hpp" + +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_09.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_09.hpp new file mode 100644 index 000000000..134c8814e --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_09.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#undef NEST +#define NEST 9 + +#include "t_5_035_10.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_10.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_10.hpp new file mode 100644 index 000000000..957bc88e3 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_10.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#undef NEST +#define NEST 10 + +#include "t_5_035_11.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_11.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_11.hpp new file mode 100644 index 000000000..9c8c566d9 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_11.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#undef NEST +#define NEST 11 + +#include "t_5_035_12.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_12.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_12.hpp new file mode 100644 index 000000000..46e695e11 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_12.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#undef NEST +#define NEST 12 + +#include "t_5_035_13.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_13.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_13.hpp new file mode 100644 index 000000000..aaa28275d --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_13.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#undef NEST +#define NEST 13 + +#include "t_5_035_14.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_14.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_14.hpp new file mode 100644 index 000000000..5840831c1 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_14.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#undef NEST +#define NEST 14 + +#include "t_5_035_15.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_5_035_15.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_15.hpp new file mode 100644 index 000000000..9989b95ca --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_5_035_15.hpp @@ -0,0 +1,50 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests translation limits. + +#ifdef X0F + +#undef NEST +#define NEST 0xf + +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_001.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_001.cpp new file mode 100644 index 000000000..154c26797 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_001.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: out of range of integer pp-token in #if expression. + +// 12.8: Preprocessing number perhaps out of range of unsigned long. +//E t_6_001.cpp(20): error: ill formed integer literal or integer constant too large: 123456789012345678901 +#if 123456789012345678901 +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_002.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_002.cpp new file mode 100644 index 000000000..4109983d7 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_002.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: illegal #if expressions. + +// 14.1: String literal is not allowed in #if expression. +//E t_6_002.cpp(20): error: ill formed preprocessor expression: "string" +#if "string" +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_003.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_003.cpp new file mode 100644 index 000000000..e6548b4d7 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_003.cpp @@ -0,0 +1,51 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: illegal #if expressions. + +#define A 1 +#define B 1 + +// 14.2: Operators =, +=, ++, etc. are not allowed in #if expression. +//E t_6_003.cpp(23): error: ill formed preprocessor expression: 1 = 1 +#if A = B +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_004.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_004.cpp new file mode 100644 index 000000000..af948a51b --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_004.cpp @@ -0,0 +1,51 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: illegal #if expressions. + +#define A 1 +#define B 1 + +// 14.2: Operators =, +=, ++, etc. are not allowed in #if expression. +//E t_6_004.cpp(23): error: ill formed preprocessor expression: 1++ 1 +#if A++ B +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_005.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_005.cpp new file mode 100644 index 000000000..d0865bf3a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_005.cpp @@ -0,0 +1,51 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: illegal #if expressions. + +#define A 1 +#define B 1 + +// 14.2: Operators =, +=, ++, etc. are not allowed in #if expression. +//E t_6_005.cpp(23): error: ill formed preprocessor expression: 1 --1 +#if A --B +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_006.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_006.cpp new file mode 100644 index 000000000..5062602e0 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_006.cpp @@ -0,0 +1,51 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: illegal #if expressions. + +#define A 1 +#define B 1 + +// 14.2: Operators =, +=, ++, etc. are not allowed in #if expression. +//E t_6_006.cpp(23): error: ill formed preprocessor expression: 1.1 +#if A.B +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_007.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_007.cpp new file mode 100644 index 000000000..8c158ae69 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_007.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: illegal #if expressions. + +// 14.3: Unterminated #if expression. +//E t_6_007.cpp(20): error: ill formed preprocessor expression: 0 < +#if 0 < +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_008.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_008.cpp new file mode 100644 index 000000000..3b0cff5ac --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_008.cpp @@ -0,0 +1,51 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: illegal #if expressions. + +#define A 1 +#define B 1 + +// 14.3: Unterminated #if expression. +//E t_6_008.cpp(23): error: ill formed preprocessor expression: ( (1 == 1) +#if ( (A == B) +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_009.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_009.cpp new file mode 100644 index 000000000..2ecff36d1 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_009.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: illegal #if expressions. + +// 14.4: Unbalanced parenthesis in #if defined operator. +//E t_6_009.cpp(20): error: ill formed preprocessor expression: defined(): defined ( MACRO +#if defined ( MACRO +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_010.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_010.cpp new file mode 100644 index 000000000..4c32afaad --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_010.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: illegal #if expressions. + +// 14.5: No argument. +//E t_6_010.cpp(20): error: ill formed preprocessor directive: #if +#if +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_011.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_011.cpp new file mode 100644 index 000000000..4773fe3a2 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_011.cpp @@ -0,0 +1,49 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: illegal #if expressions. + +// 14.6: Macro expanding to 0 token in #if expression. +//E t_6_011.cpp(21): error: ill formed preprocessor expression: <empty expression> +#define ZERO_TOKEN +#if ZERO_TOKEN +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_012.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_012.cpp new file mode 100644 index 000000000..2ed7de72f --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_012.cpp @@ -0,0 +1,49 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: there is no keyword allowed in #if expression. + +// 14.7: sizeof operator is disallowed. +// Evaluated as: 0 (0), Constant expression syntax error. */ +//E t_6_012.cpp(21): error: ill formed preprocessor expression: 0 (0) +#if sizeof (int) +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_013.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_013.cpp new file mode 100644 index 000000000..e039439d7 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_013.cpp @@ -0,0 +1,49 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: illegal #if expressions. + +// 14.8: type cast is disallowed. +// Evaluated as: (0)0x8000, constant expression error. +//E t_6_013.cpp(21): error: ill formed preprocessor expression: (0)0x8000 < 0 +#if (int)0x8000 < 0 +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_014.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_014.cpp new file mode 100644 index 000000000..5e44dcef6 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_014.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: out of range in #if expression (division by 0). + +// 14.9: Division by 0. +//E t_6_014.cpp(20): fatal error: division by zero in preprocessor expression: 1 / 0 +#if 1 / 0 +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_015.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_015.cpp new file mode 100644 index 000000000..f072c9c88 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_015.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: overflow of constant expression in #if directive. + +// 14.10: +//E t_6_015.cpp(20): error: integer overflow in preprocessor expression: $E(__TESTWAVE_LONG_MAX__) - $E(__TESTWAVE_LONG_MIN__) +#if __TESTWAVE_LONG_MAX__ - __TESTWAVE_LONG_MIN__ +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_016.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_016.cpp new file mode 100644 index 000000000..ec3d57a00 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_016.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: overflow of constant expression in #if directive. + +// 14.10: +//E t_6_016.cpp(20): error: integer overflow in preprocessor expression: $E(__TESTWAVE_LONG_MAX__) + 1 +#if __TESTWAVE_LONG_MAX__ + 1 +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_017.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_017.cpp new file mode 100644 index 000000000..1617fc0d7 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_017.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: overflow of constant expression in #if directive. + +// 14.10: +//E t_6_017.cpp(20): error: integer overflow in preprocessor expression: $E(__TESTWAVE_LONG_MIN__) - 1 +#if __TESTWAVE_LONG_MIN__ - 1 +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_018.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_018.cpp new file mode 100644 index 000000000..878274bce --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_018.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: overflow of constant expression in #if directive. + +// 14.10: +//E t_6_018.cpp(20): error: integer overflow in preprocessor expression: $E(__TESTWAVE_LONG_MAX__) * 2 +#if __TESTWAVE_LONG_MAX__ * 2 +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_019.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_019.cpp new file mode 100644 index 000000000..7a30e8e9b --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_019.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #ifdef, #ifndef syntax errors. + +// 15.3: Not an identifier. +//E t_6_019.cpp(20): error: ill formed preprocessor directive: #ifdef "string" +#ifdef "string" +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_020.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_020.cpp new file mode 100644 index 000000000..7eafd389a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_020.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #ifdef, #ifndef syntax errors. + +// 15.3: Not an identifier. +//E t_6_020.cpp(20): error: ill formed preprocessor directive: #ifdef 123 +#ifdef 123 +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_021.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_021.cpp new file mode 100644 index 000000000..ff697cd25 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_021.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #ifdef, #ifndef syntax errors. + +// 15.4: Excessive token sequence. +//E t_6_021.cpp(20): error: ill formed preprocessor directive: #ifdef MACRO Junk +#ifdef MACRO Junk +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_022.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_022.cpp new file mode 100644 index 000000000..f0d0061b2 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_022.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #ifdef, #ifndef syntax errors. + +// 15.5: No argument. +//E t_6_022.cpp(20): error: ill formed preprocessor directive: #ifndef +#ifndef +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_023.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_023.cpp new file mode 100644 index 000000000..f40b52035 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_023.cpp @@ -0,0 +1,50 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Trailing junk of #else, #endif. + +// 16.1: Trailing junk of #else. +//E t_6_023.cpp(22): error: ill formed preprocessor directive: #else MACRO_0 +#define MACRO_0 0 +#if MACRO_0 +#else MACRO_0 +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_024.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_024.cpp new file mode 100644 index 000000000..118d50ed0 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_024.cpp @@ -0,0 +1,50 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Trailing junk of #else, #endif. + +// 16.2: Trailing junk of #endif. +//E t_6_024.cpp(23): error: ill formed preprocessor directive: #endif MACRO_0 +#define MACRO_0 0 +#if MACRO_0 +#else +#endif MACRO_0 + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_025.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_025.cpp new file mode 100644 index 000000000..b9f3e546a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_025.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: ill-formed group in a source file. + +// 17.1: Errorneous #endif without #if. +//E t_6_025.cpp(20): error: the #if for this directive is missing: #endif +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_026.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_026.cpp new file mode 100644 index 000000000..c22424309 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_026.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: ill-formed group in a source file. + +// 17.2: Errorneous #else without #if. +//E t_6_026.cpp(20): error: the #if for this directive is missing: #else +#else + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_027.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_027.cpp new file mode 100644 index 000000000..04c6f94c8 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_027.cpp @@ -0,0 +1,50 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: ill-formed group in a source file. + +// 17.3: Errorneous #else after #else (missing #if). +//E t_6_027.cpp(22): error: the #if for this directive is missing: #else +#if MACRO_1 +#else +#else +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_028.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_028.cpp new file mode 100644 index 000000000..6a5d2bac2 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_028.cpp @@ -0,0 +1,50 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: ill-formed group in a source file. + +// 17.4: Errorneous #elif after #else (missing #if). +//E t_6_028.cpp(22): error: the #if for this directive is missing: #elif +#if MACRO_1 == 1 +#else +#elif MACRO_1 == 0 +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_029.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_029.cpp new file mode 100644 index 000000000..8261b4c01 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_029.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: ill-formed group in a source file. + +// 17.5: Errorneous #endif without #if in an included file. +//E t_6_029.hpp(47): warning: unbalanced #if/#endif in include file: $P(t_6_029.hpp) +#if 1 +#include "t_6_029.hpp" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_029.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_029.hpp new file mode 100644 index 000000000..3333ec490 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_029.hpp @@ -0,0 +1,46 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: ill-formed group in a source file. + +// 17.5: Errorneous #endif without #if in an included file. +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_030.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_030.cpp new file mode 100644 index 000000000..0459b8d62 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_030.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: ill-formed group in a source file. + +// 17.6: Errorneous unterminated #if section in an included file. +//E t_6_030.hpp(49): warning: unbalanced #if/#endif in include file: $P(t_6_030.hpp) +#include "t_6_030.hpp" +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_030.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_030.hpp new file mode 100644 index 000000000..8ea0b22ab --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_030.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: ill-formed group in a source file. + +// 17.6: Errorneous unterminated #if section in an included file. +#define UNBAL2 1 +#if UNBAL2 +#else + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_031.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_031.cpp new file mode 100644 index 000000000..d39525c3b --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_031.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: ill-formed group in a source file. + +// 17.7: Errorneous unterminated #if section (missing #endif). +//E t_6_031.cpp(49): error: detected at least one missing #endif directive +#if MACRO_1 == 0 +#else + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_032.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_032.cpp new file mode 100644 index 000000000..27777b258 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_032.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #define syntax errors. + +// 18.4: Not an identifier. +//E t_6_032.cpp(20): error: ill formed preprocessor directive: #define "string" +#define "string" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_033.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_033.cpp new file mode 100644 index 000000000..fd2b63272 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_033.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #define syntax errors. + +// 18.4: Not an identifier. +//E t_6_033.cpp(20): error: ill formed preprocessor directive: #define 123 +#define 123 + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_034.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_034.cpp new file mode 100644 index 000000000..eecb88f2d --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_034.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #define syntax errors. + +// 18.5: No argument. +//E t_6_034.cpp(20): error: ill formed preprocessor directive: #define +#define + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_035.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_035.cpp new file mode 100644 index 000000000..c785b931f --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_035.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #define syntax errors. + +// 18.6: Empty parameter list. +//E t_6_035.cpp(20): error: ill formed preprocessor directive: #define math( op, a, ) op( (a), (b)) +#define math( op, a, ) op( (a), (b)) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_036.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_036.cpp new file mode 100644 index 000000000..a168ddaa5 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_036.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #define syntax errors. + +// 18.7: Duplicate parameter names. +//E t_6_036.cpp(20): error: duplicate macro parameter name: a +#define math( op, a, a) op( (a), (b)) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_037.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_037.cpp new file mode 100644 index 000000000..36ee92052 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_037.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #define syntax errors. + +// 18.8: Argument is not an identifier. +//E t_6_037.cpp(20): error: ill formed preprocessor directive: #define NUMARGS( 1, +, 2) (1 + 2) +#define NUMARGS( 1, +, 2) (1 + 2) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_038.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_038.cpp new file mode 100644 index 000000000..5e764d454 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_038.cpp @@ -0,0 +1,58 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #define syntax errors. + +// 18.9: No space between macro name and replacement text. +// C90 (Corrigendum 1) forbids this if and only if the replacement text +// begins with a non-basic-character. +// C99 forbids this even when the replacement text begins with basic- +// character. + +// From ISO 9899:1990 / Corrigendum 1. +#if defined(__TESTWAVE_HAS_STRICT_LEXER__) +//E(__TESTWAVE_HAS_STRICT_LEXER__) t_6_038.cpp(27): error: ill formed preprocessor directive: #define +#define THIS$AND$THAT(a, b) ((a) + (b)) +#endif + +// Note: the following definition is legal (object-like macro). +// #define THIS $AND$THAT(a, b) ((a) + (b)) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_039.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_039.cpp new file mode 100644 index 000000000..75adf8eef --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_039.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Redefinitions of macros. +#define OBJ_LIKE (1-1) + +// 19.3: different token sequence +//E t_6_039.cpp(21): warning: illegal macro redefinition: OBJ_LIKE +#define OBJ_LIKE (0) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_040.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_040.cpp new file mode 100644 index 000000000..647b41912 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_040.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Redefinitions of macros. +#define OBJ_LIKE (1-1) + +// 19.4: different white space +//E t_6_040.cpp(21): warning: illegal macro redefinition: OBJ_LIKE +#define OBJ_LIKE (1 - 1) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_041.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_041.cpp new file mode 100644 index 000000000..371612b87 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_041.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Redefinitions of macros. +#define FTN_LIKE(a) ( a ) + +// 19.5: different parameter usage +//E t_6_041.cpp(21): warning: illegal macro redefinition: FTN_LIKE +#define FTN_LIKE(b) ( a ) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_042.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_042.cpp new file mode 100644 index 000000000..237da9112 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_042.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Redefinitions of macros. +#define FTN_LIKE(a) ( a ) + +// 19.6: different parameter spelling +//E t_6_042.cpp(21): warning: illegal macro redefinition: FTN_LIKE +#define FTN_LIKE(b) ( b ) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_043.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_043.cpp new file mode 100644 index 000000000..c446129f3 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_043.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Redefinitions of macros. +#define FTN_LIKE(a) ( a ) + +// 19.7 +//E t_6_043.cpp(21): warning: illegal macro redefinition: FTN_LIKE +#define FTN_LIKE OBJ_LIKE + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_044.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_044.cpp new file mode 100644 index 000000000..802742f9a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_044.cpp @@ -0,0 +1,51 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: The ## operator shall not occur at the beginning or at +// the end of replacement list for either form of macro +// definition. + +// 23.3: In object-like macro (left). +#define CON ## name + +//E t_6_044.cpp(24): error: ill formed preprocessing operator: concat ('##') +CON + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_045.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_045.cpp new file mode 100644 index 000000000..fd605025c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_045.cpp @@ -0,0 +1,51 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: The ## operator shall not occur at the beginning or at +// the end of replacement list for either form of macro +// definition. + +// 23.3: In object-like macro (right). +#define CAT 12 ## + +//E t_6_045.cpp(24): error: ill formed preprocessing operator: concat ('##') +CAT + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_046.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_046.cpp new file mode 100644 index 000000000..53a3e8590 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_046.cpp @@ -0,0 +1,51 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: The ## operator shall not occur at the beginning or at +// the end of replacement list for either form of macro +// definition. + +// 23.4: In function-like macro (left). +#define CON(a, b) ## a ## b + +//E t_6_046.cpp(24): error: ill formed preprocessing operator: concat ('##') +CON(1, 2) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_047.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_047.cpp new file mode 100644 index 000000000..02c12f34f --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_047.cpp @@ -0,0 +1,51 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: The ## operator shall not occur at the beginning or at +// the end of replacement list for either form of macro +// definition. + +// 23.4: In function-like macro (right). +#define CON(a, b) a ## b ## + +//E t_6_047.cpp(24): error: ill formed preprocessing operator: concat ('##') +CON(1, 2) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_048.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_048.cpp new file mode 100644 index 000000000..07db985e1 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_048.cpp @@ -0,0 +1,50 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: The operand of the # operator in function-like macro +// definition should be a parameter. + +// 24.6: In function-like macro (right). +#define FUNC(a) # b + +//E t_6_048.cpp(23): error: ill formed preprocessing operator: stringize ('#') +FUNC(1) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_049.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_049.cpp new file mode 100644 index 000000000..6abaf7d1c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_049.cpp @@ -0,0 +1,56 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Macro arguments are pre-expanded separately. + +// 25.6: +#define SUB(x, y) (x - y) +#define HEAD SUB( +#define BODY(x,y) x,y +#define TAIL ) +#define HEAD_BODY_TAIL(a, b, c) a b c + +// "HEAD" is once expanded to "SUB(", then rescanning of "SUB(" causes an +// uncompleted macro call. Expansion of an argument should complete +// within the argument. +//E t_6_049.cpp(29): error: improperly terminated macro invocation or replacement-list terminates in partial macro expansion (not supported yet): missing ')' +HEAD_BODY_TAIL(HEAD, BODY(a,b), TAIL) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_050.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_050.cpp new file mode 100644 index 000000000..aff380a2f --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_050.cpp @@ -0,0 +1,54 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Error of rescanning. + +// 27.7 +#define SUB1(x, y) (x - y) +#define TWO_TOKENS a,b +#define SUB(x, y) SUB1(x, y) + +// Too many arguments error while rescanning after once replaced to: +// SUB(a, b, 1) + +//E t_6_050.cpp(27): warning: too many macro arguments: SUB1 +SUB(TWO_TOKENS, 1) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_051.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_051.cpp new file mode 100644 index 000000000..4dd98335a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_051.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #undef errors. + +// 29.3: Not an identifier. +//E t_6_051.cpp(20): error: ill formed preprocessor directive: #undef "string" +#undef "string" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_052.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_052.cpp new file mode 100644 index 000000000..943f398bd --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_052.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #undef errors. + +// 29.3: Not an identifier. +//E t_6_052.cpp(20): error: ill formed preprocessor directive: #undef 123 +#undef 123 + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_053.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_053.cpp new file mode 100644 index 000000000..84f1e282d --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_053.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #undef errors. + +// 29.4: Excessive token sequence. +//E t_6_053.cpp(20): error: ill formed preprocessor directive: #undef MACRO_0 Junk +#undef MACRO_0 Junk + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_054.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_054.cpp new file mode 100644 index 000000000..1f55f1648 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_054.cpp @@ -0,0 +1,47 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #undef errors. + +// 29.5: No argument. +//E t_6_054.cpp(20): error: ill formed preprocessor directive: #undef +#undef + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_055.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_055.cpp new file mode 100644 index 000000000..413fe8aef --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_055.cpp @@ -0,0 +1,49 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Illegal macro calls. + +#define SUB(x, y) (x - y) + +// 31.1: Too many arguments error. +//E t_6_055.cpp(22): warning: too many macro arguments: SUB +SUB(x, y, z); + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_056.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_056.cpp new file mode 100644 index 000000000..dafe05b06 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_056.cpp @@ -0,0 +1,49 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Illegal macro calls. + +#define SUB(x, y) (x - y) + +// 31.2: Too few arguments error. +//E t_6_056.cpp(22): warning: too few macro arguments: SUB +SUB(x); + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_057.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_057.cpp new file mode 100644 index 000000000..d2efa5ecd --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_057.cpp @@ -0,0 +1,52 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Macro call in control line should complete in the line. + +#define GLUE(a, b) a ## b +#define STR(s) # s +#define XSTR(s) STR(s) + +// 31.3: Unterminated macro call. +//E t_6_057.cpp(24): error: improperly terminated macro invocation or replacement-list terminates in partial macro expansion (not supported yet): missing ')' +#include XSTR(GLUE(header, + .h)) + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_058.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_058.cpp new file mode 100644 index 000000000..e4c969be9 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_058.cpp @@ -0,0 +1,52 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Range error of character constant. + +// 32.5: Value of a numerical escape sequence in character constant should +// be in the range of char. +//E t_6_058.cpp(21): warning: expression contains out of range character literal: '\x123' == 0x123 +#if '\x123' == 0x123 +false +#else +true +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_059.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_059.cpp new file mode 100644 index 000000000..e36b19826 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_059.cpp @@ -0,0 +1,52 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Out of range of numerical escape sequence in wide-char. + +// 32.5: Value of a numerical escape sequence in character constant should +// be in the range of char. +//E t_6_059.cpp(21): warning: expression contains out of range character literal: L'\xabcdef012' == 0xbcdef012 +#if L'\xabcdef012' == 0xbcdef012 +false +#else +true +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_060.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_060.cpp new file mode 100644 index 000000000..7ec2ef85e --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_060.cpp @@ -0,0 +1,52 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Out of range of character constant. + +// In ASCII character set. +// 35.2: +//E t_6_060.cpp(21): warning: expression contains out of range character literal: 'abcdefghi' == '\x61\x62\x63\x64\x65\x66\x67\x68\x69' +#if 'abcdefghi' == '\x61\x62\x63\x64\x65\x66\x67\x68\x69' +false +#else +true +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_061.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_061.cpp new file mode 100644 index 000000000..25c6f4630 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_061.cpp @@ -0,0 +1,51 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Illegal pp-token. + +// 4.3: Empty character constant is an error. +//E t_6_061.cpp(20): error: ill formed preprocessor expression: '' == 0 +#if '' == 0 +false +#else +true +#endif + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_062.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_062.cpp new file mode 100644 index 000000000..1f1514110 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_062.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: #line error. + +// 7.4: string literal in #line directive shall be a character string +// literal. +//E t_6_062.cpp(21): warning: filename argument of #line directive should be a narrow string literal: 123 L"wide" +#line 123 L"wide" + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_063.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_063.cpp new file mode 100644 index 000000000..776561a7c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_063.cpp @@ -0,0 +1,54 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: undefined behavior: End of a source file without a +// <newline>. + +//E t_6_063.hpp(45): warning: last line of file ends without a newline +#include "t_6_063.hpp" + +//R #line 19 "t_6_063.hpp" +//R int dummy = 0; + +//H 10: t_6_063.cpp(20): #include "t_6_063.hpp" +//H 04: "t_6_063.hpp" +//H 05: $S(t_6_063.hpp) ($B(t_6_063.hpp)) +//H 18: boost::wave::preprocess_exception + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_063.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_063.hpp new file mode 100644 index 000000000..bd1faee1a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_063.hpp @@ -0,0 +1,45 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: undefined behavior: End of a source file without a +// <newline>: boostinspect:noend + +int dummy = 0; + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */
\ No newline at end of file diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_064.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_064.cpp new file mode 100644 index 000000000..ebf8918b6 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_064.cpp @@ -0,0 +1,51 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.6.1 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Undefined behavior on out-of-range #line number. + +//O --variadics + +// C99: Line number argument of #line directive should be in range of +// [1..2147483647] + +//E t_6_064.cpp(24): warning: line number argument of #line directive should consist out of decimal digits only and must be in range of [1..INT_MAX] +#line 0 + +/*- + * Copyright (c) 1998, 2002-2006 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_065.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_065.cpp new file mode 100644 index 000000000..819add33a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_065.cpp @@ -0,0 +1,51 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.6.1 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: Undefined behavior on out-of-range #line number. + +//O --variadics + +// C99: Line number argument of #line directive should be in range of +// [1..2147483647] + +//E t_6_065.cpp(24): warning: line number argument of #line directive should consist out of decimal digits only and must be in range of [1..INT_MAX] +#line 2147483648 + +/*- + * Copyright (c) 1998, 2002-2006 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_066.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_066.cpp new file mode 100644 index 000000000..4f9868ec5 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_066.cpp @@ -0,0 +1,49 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: undefined behavior: End of a source file is +// <backslash><newline>. + +//E t_6_066.hpp(46): warning: last line of file ends without a newline +#include "t_6_066.hpp" + +//R #line 19 "t_6_066.hpp" +//R int dummy = 0; + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_066.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_066.hpp new file mode 100644 index 000000000..c0e7d8856 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_066.hpp @@ -0,0 +1,46 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: undefined behavior: End of a source file is +// <backslash><newline>: boostinspect:noend + +int dummy = 0; + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ \ +
\ No newline at end of file diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_067.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_067.cpp new file mode 100644 index 000000000..b5cdbd538 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_067.cpp @@ -0,0 +1,54 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: undefined behavior: End of a source file with an +// unterminated comment. + +//E t_6_067.hpp(48): warning: generic lexer warning: Unterminated 'C' style comment +#include "t_6_067.hpp" + +//R #line 19 "t_6_067.hpp" +//R int dummy = 0; + +//H 10: t_6_067.cpp(20): #include "t_6_067.hpp" +//H 04: "t_6_067.hpp" +//H 05: $S(t_6_067.hpp) ($B(t_6_067.hpp)) +//H 18: boost::wave::lexing_exception + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_067.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_067.hpp new file mode 100644 index 000000000..ae0adec1a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_067.hpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: undefined behavior: End of a source file with an +// unterminated comment: boostinspect:noend + +int dummy = 0; + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + /* unterminated comment ... +
\ No newline at end of file diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_068.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_068.cpp new file mode 100644 index 000000000..e24d77c7a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_068.cpp @@ -0,0 +1,46 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: undefined behavior: Argument of #include other than +// header-name + +//E t_6_068.cpp(20): error: ill formed #include directive: filename +#include filename + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_6_069.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_6_069.cpp new file mode 100644 index 000000000..a2edaa0c5 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_6_069.cpp @@ -0,0 +1,45 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + + The tests included in this file were initially taken from the mcpp V2.5 + preprocessor validation suite and were modified to fit into the Boost.Wave + unit test requirements. + The original files of the mcpp preprocessor are distributed under the + license reproduced at the end of this file. +=============================================================================*/ + +// Tests error reporting: undefined behavior: trailing junk of #include + +//E t_6_069.cpp(19): error: ill formed preprocessor directive: #include <boost/assert.hpp> Junk +#include <boost/assert.hpp> Junk + +/*- + * Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_7_001.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_7_001.cpp new file mode 100644 index 000000000..226bca4f5 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_7_001.cpp @@ -0,0 +1,49 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O --c++11 +//O -Werror + +//R #line 17 "t_7_001.cpp" +//R R"(de +//R fg +//R h)" +R"(de +fg +h)" + +//R #line 22 "t_7_001.cpp" +"abc" //R "abc" +R"(abc)" //R R"(abc)" + +//R #line 28 "t_7_001.cpp" +//R uR"(de fg +//R h)" +uR"(de \ +fg +h)" + +//R #line 33 "t_7_001.cpp" +u"abc" //R u"abc" +U"def" //R U"def" +u8"ghi" //R u8"ghi" + +//R #line 40 "t_7_001.cpp" +//R R"delim("quoted text +//R with newline")delim" +R"delim("quoted text +with newline")delim" + +//R #line 45 "t_7_001.cpp" +//R R"de"lim(some text)de"lim" +R"de"lim(some text)de"lim" + +//R #line 49 "t_7_001.cpp" +//R no_newline_at_end_of_file +no_newline_at_end_of_file
\ No newline at end of file diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_7_002.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_7_002.cpp new file mode 100644 index 000000000..390ddc952 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_7_002.cpp @@ -0,0 +1,15 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2017 Abel Sinkovics. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O --c++11 +//O -Werror +//R + +#if 0 +#endif
\ No newline at end of file diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_7_003.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_7_003.cpp new file mode 100644 index 000000000..a8cab32ee --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_7_003.cpp @@ -0,0 +1,13 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2017 Abel Sinkovics. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O --c++11 +//O -Werror + +#line 7
\ No newline at end of file diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_7_004.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_7_004.cpp new file mode 100644 index 000000000..dde43b13e --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_7_004.cpp @@ -0,0 +1,14 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2017 Abel Sinkovics. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O --c++11 + +//E t_7_004.cpp(14): error: detected at least one missing #endif directive + +#if 0
\ No newline at end of file diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_7_005.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_7_005.cpp new file mode 100644 index 000000000..776d7fbfe --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_7_005.cpp @@ -0,0 +1,15 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2017 Abel Sinkovics. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O --c++11 + +//E t_7_005.cpp(15): error: detected at least one missing #endif directive + +#if 0 +#else
\ No newline at end of file diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_7_006.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_7_006.cpp new file mode 100644 index 000000000..0d9ec951b --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_7_006.cpp @@ -0,0 +1,17 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2017 Abel Sinkovics. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O --c++11 +//R #line 10 "t_7_006.hpp" +//R header +//R #line 17 "t_7_006.cpp" +//R cpp_content + +#include "t_7_006.hpp" +cpp_content
\ No newline at end of file diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_7_006.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_7_006.hpp new file mode 100644 index 000000000..061bf2ed8 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_7_006.hpp @@ -0,0 +1,10 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2017 Abel Sinkovics. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +header
\ No newline at end of file diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_001.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_001.cpp new file mode 100644 index 000000000..0732c71d6 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_001.cpp @@ -0,0 +1,23 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + + /* + + Expose bug + + */ + +#if 1 +//R #line 18 "t_9_001.cpp" + void exposed() {} //R void exposed() {} +#endif + +//H 10: t_9_001.cpp(16): #if +//H 11: t_9_001.cpp(16): #if 1: 1 +//H 10: t_9_001.cpp(19): #endif diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_002.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_002.cpp new file mode 100644 index 000000000..9c0b0ca6a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_002.cpp @@ -0,0 +1,23 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#if 0 + // + // some comment + // +#endif + + // another comment + // ---------------------------------------------------- +1 +//R #line 18 "t_9_002.cpp" +//R 1 + +//H 10: t_9_002.cpp(10): #if +//H 11: t_9_002.cpp(10): #if 0: 0 diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_003.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_003.cpp new file mode 100644 index 000000000..845eeb8c7 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_003.cpp @@ -0,0 +1,61 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Test, if additional whitespace is inserted at appropriate places. + +#define STRINGIZE(x) STRINGIZE_D(x) +#define STRINGIZE_D(x) #x + +#define X() 1 +#define PLUS() + +#define MINUS() - +#define DOT() . +#define GREATER() > +#define LESS() < + +//R #line 23 "t_9_003.cpp" +X()2 //R 1 2 +STRINGIZE( X()2 ) //R "12" +//R +X() 2 //R 1 2 +STRINGIZE( X() 2 ) //R "1 2" +//R +PLUS()MINUS() //R +- +STRINGIZE( PLUS()MINUS() ) //R "+-" +//R +PLUS()PLUS() //R + + +STRINGIZE( PLUS()PLUS() ) //R "++" +//R +MINUS()MINUS() //R - - +STRINGIZE( MINUS()MINUS() ) //R "--" +//R +DOT()DOT()DOT() //R .. . +STRINGIZE( DOT()DOT()DOT() ) //R "..." + +// the following are regressions reported by Stefan Seefeld +//R #line 43 "t_9_003.cpp" +GREATER()GREATER() //R > > +STRINGIZE( GREATER()GREATER() ) //R ">>" +//R +LESS()LESS() //R < < +STRINGIZE( LESS()LESS() ) //R "<<" + +#define COMMA() , +#define AND() & +#define CHAR() char +#define STAR() * + +// Make sure no whitespace gets inserted in between the operator symbols +//R #line 56 "t_9_003.cpp" +void foo(char&, char) //R void foo(char&, char) +void foo(char *) //R void foo(char *) +void foo(char *&) //R void foo(char *&) +void foo(CHAR()AND()COMMA() CHAR()) //R void foo(char&, char) +void foo(CHAR() STAR()) //R void foo(char *) +void foo(CHAR() STAR()AND()) //R void foo(char *&) diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_004.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_004.cpp new file mode 100644 index 000000000..0a5fc6e9e --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_004.cpp @@ -0,0 +1,28 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Test if invalid or not allowed universal characters are rejected + +#define \u00ff ... + +//R #line 16 "t_9_004.cpp" +//R ... +\u00ff + +//E t_9_004.cpp(19): error: a universal character name cannot designate a character in the basic character set: \u0061 +#define \u0061 weird // 0x61 == 'a' + +\u0061 + +//H 10: t_9_004.cpp(12): #define +//H 08: t_9_004.cpp(12): \u00ff=... +//H 01: t_9_004.cpp(12): \u00ff +//H 02: ... +//H 03: ... +//H 18: boost::wave::lexing_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_005.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_005.cpp new file mode 100644 index 000000000..f3e414dd4 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_005.cpp @@ -0,0 +1,27 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests, if no universal character values are to be generated accidently by +// concatenation + +#define CONCAT(a, b) PRIMITIVE_CONCAT(a, b) +#define PRIMITIVE_CONCAT(a, b) a ## b +#define STRINGIZE(x) STRINGIZE_D(x) +#define STRINGIZE_D(x) # x + +//R #line 19 "t_9_005.cpp" +STRINGIZE( CONCAT(\, u00ff) ) //R "\u00ff" +STRINGIZE( CONCAT(\u00, ff) ) //R "\u00ff" +STRINGIZE( CONCAT(\u00ff, 56) ) //R "\u00ff56" +CONCAT(\, u00ff) //R \u00ff +CONCAT(\u00, ff) //R \ u00ff +CONCAT(\u00ff, 56) //R \u00ff56 + +//E t_9_005.cpp(27): error: a universal character name cannot designate a character in the basic character set: \u0061 +STRINGIZE( CONCAT(\, u0061) ) // reports an error diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_006.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_006.cpp new file mode 100644 index 000000000..d96b464bb --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_006.cpp @@ -0,0 +1,46 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// syntax for defined operator +// is either: +// +// defined X +// +// -or- +// +// defined(X) +// +// i.e. the parenthesis are optional (ala sizeof) + +#define X + +//R #line 26 "t_9_006.cpp" +//R "X" is defined. +#if defined(X) +"X" is defined. +#else +"X" is not defined. +#endif + +//R #line 34 "t_9_006.cpp" +//R "X" is defined. +#if defined X +"X" is defined. +#else +"X" is not defined. +#endif + +//H 10: t_9_006.cpp(21): #define +//H 08: t_9_006.cpp(21): X= +//H 10: t_9_006.cpp(25): #if +//H 11: t_9_006.cpp(25): #if defined(X): 1 +//H 10: t_9_006.cpp(27): #else +//H 10: t_9_006.cpp(33): #if +//H 11: t_9_006.cpp(33): #if defined X: 1 +//H 10: t_9_006.cpp(35): #else diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_007.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_007.cpp new file mode 100644 index 000000000..c5348e6d8 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_007.cpp @@ -0,0 +1,20 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Test error reporting during redefinition of 'defined' + +//E t_9_007.cpp(13): warning: this predefined name may not be redefined: defined +#define defined 1 // undefined in C++ (16.8/3), error in C99 (6.10.8/4) + +#if defined // error +<error> +#endif + +//H 10: t_9_007.cpp(13): #define +//H 18: boost::wave::macro_handling_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_008.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_008.cpp new file mode 100644 index 000000000..fa0b557d0 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_008.cpp @@ -0,0 +1,16 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Test error reporting during redefinition of 'defined' + +//E t_9_008.cpp(13): warning: #undef may not be used on this predefined name: defined +#undef defined + +//H 10: t_9_008.cpp(13): #undef +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_009.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_009.cpp new file mode 100644 index 000000000..6022034e8 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_009.cpp @@ -0,0 +1,27 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests for a problem wrt preprocessing tokens (preprocessing numbers) + +#define X() X_ ## 0R() +#define X_0R() ... + +//R #line 16 "t_9_009.cpp" +X() //R ... + +//H 10: t_9_009.cpp(12): #define +//H 08: t_9_009.cpp(12): X()=X_ ## 0R() +//H 10: t_9_009.cpp(13): #define +//H 08: t_9_009.cpp(13): X_0R()=... +//H 00: t_9_009.cpp(16): X(), [t_9_009.cpp(12): X()=X_ ## 0R()] +//H 02: X_0R() +//H 00: t_9_009.cpp(12): X_0R(), [t_9_009.cpp(13): X_0R()=...] +//H 02: ... +//H 03: ... +//H 03: ... diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_010.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_010.cpp new file mode 100644 index 000000000..d4740440c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_010.cpp @@ -0,0 +1,70 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests, whether adjacent tokens are separated by whitespace if the adjacency +// is created by macro expansion + +#define A(x) x + +//R #line 16 "t_9_010.cpp" +A(1)1 //R 1 1 +A(1)X //R 1 X +A(X)1 //R X 1 +A(X)X //R X X + +#define CAT(a, b) PRIMITIVE_CAT(a, b) +#define PRIMITIVE_CAT(a, b) a ## b + +#define X() B +#define ABC 1 + +//R #line 28 "t_9_010.cpp" +CAT(A, X() C) //R AB C +CAT(A, X()C) //R AB C + +//H 10: t_9_010.cpp(13): #define +//H 08: t_9_010.cpp(13): A(x)=x +//H 00: t_9_010.cpp(16): A(1), [t_9_010.cpp(13): A(x)=x] +//H 02: 1 +//H 03: 1 +//H 00: t_9_010.cpp(17): A(1), [t_9_010.cpp(13): A(x)=x] +//H 02: 1 +//H 03: 1 +//H 00: t_9_010.cpp(18): A(X), [t_9_010.cpp(13): A(x)=x] +//H 02: X +//H 03: X +//H 00: t_9_010.cpp(19): A(X), [t_9_010.cpp(13): A(x)=x] +//H 02: X +//H 03: X +//H 10: t_9_010.cpp(21): #define +//H 08: t_9_010.cpp(21): CAT(a, b)=PRIMITIVE_CAT(a, b) +//H 10: t_9_010.cpp(22): #define +//H 08: t_9_010.cpp(22): PRIMITIVE_CAT(a, b)=a ## b +//H 10: t_9_010.cpp(24): #define +//H 08: t_9_010.cpp(24): X()=B +//H 10: t_9_010.cpp(25): #define +//H 08: t_9_010.cpp(25): ABC=1 +//H 00: t_9_010.cpp(28): CAT(A, X() C), [t_9_010.cpp(21): CAT(a, b)=PRIMITIVE_CAT(a, b)] +//H 00: t_9_010.cpp(28): X(), [t_9_010.cpp(24): X()=B] +//H 02: B +//H 03: B +//H 02: PRIMITIVE_CAT(A, B C) +//H 00: t_9_010.cpp(21): PRIMITIVE_CAT(A, B C), [t_9_010.cpp(22): PRIMITIVE_CAT(a, b)=a ## b] +//H 02: AB C +//H 03: AB C +//H 03: AB C +//H 00: t_9_010.cpp(29): CAT(A, X()C), [t_9_010.cpp(21): CAT(a, b)=PRIMITIVE_CAT(a, b)] +//H 00: t_9_010.cpp(29): X(), [t_9_010.cpp(24): X()=B] +//H 02: B +//H 03: B +//H 02: PRIMITIVE_CAT(A, BC) +//H 00: t_9_010.cpp(21): PRIMITIVE_CAT(A, BC), [t_9_010.cpp(22): PRIMITIVE_CAT(a, b)=a ## b] +//H 02: ABC +//H 03: ABC +//H 03: ABC diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_011.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_011.cpp new file mode 100644 index 000000000..fb2e06b55 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_011.cpp @@ -0,0 +1,30 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Test, if additional whitespace is inserted at appropriate places. + +//O --variadics + +#define PRIMITIVE_CAT(a, b) a ## b +#define PRIMITIVE_CAT3(a, b, c) a ## b ## c + +//R #line 18 "t_9_011.cpp" +PRIMITIVE_CAT(1, ABC) //R 1 ABC +PRIMITIVE_CAT3(ABC, 1, ABC) //R ABC1ABC + +//H 10: t_9_011.cpp(14): #define +//H 08: t_9_011.cpp(14): PRIMITIVE_CAT(a, b)=a ## b +//H 10: t_9_011.cpp(15): #define +//H 08: t_9_011.cpp(15): PRIMITIVE_CAT3(a, b, c)=a ## b ## c +//H 00: t_9_011.cpp(18): PRIMITIVE_CAT(1, ABC), [t_9_011.cpp(14): PRIMITIVE_CAT(a, b)=a ## b] +//H 02: 1ABC +//H 03: 1ABC +//H 00: t_9_011.cpp(19): PRIMITIVE_CAT3(ABC, 1, ABC), [t_9_011.cpp(15): PRIMITIVE_CAT3(a, b, c)=a ## b ## c] +//H 02: ABC1ABC +//H 03: ABC1ABC diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_012.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_012.cpp new file mode 100644 index 000000000..36cf5a885 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_012.cpp @@ -0,0 +1,25 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests, whether macro definition works when there is no whitespace in between +// the macro name and the defined expansion list + +#define CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y,\ +nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)\ +CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y,\ +nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam) + +//R #line 19 "t_9_012.cpp" +CreateWindowA(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) //R CreateWindowExA(0L, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) + +//H 10: t_9_012.cpp(13): #define +//H 08: t_9_012.cpp(13): CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)=CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y,nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam) +//H 00: t_9_012.cpp(19): CreateWindowA(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), [t_9_012.cpp(13): CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)=CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y,nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)] +//H 02: CreateWindowExA(0L, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) +//H 03: CreateWindowExA(0L, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_013.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_013.cpp new file mode 100644 index 000000000..6a8e21d8c --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_013.cpp @@ -0,0 +1,19 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests error reporting of C99 features in C++ mode (without variadics) + +#define MACRO(a, b, c) a ## b ## c + +//E t_9_013.cpp(15): warning: empty macro arguments are not supported in pure C++ mode, use variadics mode to allow these: MACRO +MACRO(1,, 3) + +//H 10: t_9_013.cpp(12): #define +//H 08: t_9_013.cpp(12): MACRO(a, b, c)=a ## b ## c +//H 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_014.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_014.cpp new file mode 100644 index 000000000..35c80e05a --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_014.cpp @@ -0,0 +1,15 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O --long_long +// Tests 'LL' suffix + +//R #line 14 "t_9_014.cpp" +1000LL //R 1000LL + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_015.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_015.cpp new file mode 100644 index 000000000..3c1c21255 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_015.cpp @@ -0,0 +1,15 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Tests 'LL' suffix + +//R #line 14 "t_9_015.cpp" +//E t_9_015.cpp(14): warning: long long suffixes are not allowed in pure C++ mode, enable long_long mode to allow these: 1000LL +1000LL + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_016.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_016.cpp new file mode 100644 index 000000000..3b4106601 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_016.cpp @@ -0,0 +1,42 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#if !defined(inclusion) +# define inclusion +# include __FILE__ +# include "t_9_016.hpp" +#else +//R #line 18 "t_9_016.cpp" +//R # define later +#define EXPAND(x) x +EXPAND(#) define later +#endif + +//H 10: t_9_016.cpp(10): #if +//H 11: t_9_016.cpp(10): #if !defined(inclusion): 1 +//H 10: t_9_016.cpp(11): #define +//H 08: t_9_016.cpp(11): inclusion= +//H 10: t_9_016.cpp(12): # include +//H 04: "$P(t_9_016.cpp)" +//H 05: $B(t_9_016.cpp) ($B(t_9_016.cpp)) +//H 10: t_9_016.cpp(10): #if +//H 11: t_9_016.cpp(10): #if !defined(inclusion): 0 +//H 10: t_9_016.cpp(17): #define +//H 08: t_9_016.cpp(17): EXPAND(x)=x +//H 00: t_9_016.cpp(18): EXPAND(#), [t_9_016.cpp(17): EXPAND(x)=x] +//H 02: # +//H 03: # +//H 10: t_9_016.cpp(19): #endif +//H 06: +//H 19: $B(t_9_016.cpp): inclusion +//H 10: t_9_016.cpp(13): # include "t_9_016.hpp" +//H 04: "t_9_016.hpp" +//H 05: t_9_016.hpp ($B(t_9_016.hpp)) +//H 06: +//H 10: t_9_016.cpp(14): #else diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_016.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_016.hpp new file mode 100644 index 000000000..ef3aaa249 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_016.hpp @@ -0,0 +1,11 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +/* intentionally left empty */ + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_017.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_017.cpp new file mode 100644 index 000000000..bb1c431dc --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_017.cpp @@ -0,0 +1,75 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// tests, whether true and false are usable a 'normal' identifiers + +#define true 1 +#define false 0 + +//R #line 18 "t_9_017.cpp" +//R 1 is defined +#if defined(true) +true is defined +#else +true is not defined +#endif + +//R #line 26 "t_9_017.cpp" +//R 0 is defined +#if defined(false) +false is defined +#else +false is not defined +#endif + +#undef true +#undef false + +//R #line 37 "t_9_017.cpp" +//R true is not defined +#ifndef true +true is not defined +#else +true is defined +#endif + +//R #line 45 "t_9_017.cpp" +//R false is not defined +#ifndef false +false is not defined +#else +false is defined +#endif + +//H 10: t_9_017.cpp(12): #define +//H 08: t_9_017.cpp(12): true=1 +//H 10: t_9_017.cpp(13): #define +//H 08: t_9_017.cpp(13): false=0 +//H 10: t_9_017.cpp(17): #if +//H 11: t_9_017.cpp(17): #if defined(true): 1 +//H 01: t_9_017.cpp(12): true +//H 02: 1 +//H 03: 1 +//H 10: t_9_017.cpp(19): #else +//H 10: t_9_017.cpp(25): #if +//H 11: t_9_017.cpp(25): #if defined(false): 1 +//H 01: t_9_017.cpp(13): false +//H 02: 0 +//H 03: 0 +//H 10: t_9_017.cpp(27): #else +//H 10: t_9_017.cpp(31): #undef +//H 09: t_9_017.cpp(31): true +//H 10: t_9_017.cpp(32): #undef +//H 09: t_9_017.cpp(32): false +//H 10: t_9_017.cpp(36): #ifndef +//H 11: t_9_017.cpp(36): #ifndef true: 0 +//H 10: t_9_017.cpp(38): #else +//H 10: t_9_017.cpp(44): #ifndef +//H 11: t_9_017.cpp(44): #ifndef false: 0 +//H 10: t_9_017.cpp(46): #else diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_018.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_018.cpp new file mode 100644 index 000000000..a6d3818a9 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_018.cpp @@ -0,0 +1,20 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// tests, whether macro redefinition does not crash anymore, even if the new +// replacement list is shorter, than the initial one. + +//E t_9_018.cpp(15): warning: illegal macro redefinition: M1 +#define M1 1 +#define M1 + +//H 10: t_9_018.cpp(14): #define +//H 08: t_9_018.cpp(14): M1=1 +//H 10: t_9_018.cpp(15): #define +//H 18: boost::wave::macro_handling_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_019.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_019.cpp new file mode 100644 index 000000000..1141aa9e9 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_019.cpp @@ -0,0 +1,21 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// tests, whether regression causing #include_next to infinitely recurse is +// fixed + +//E t_9_019.hpp(11): error: could not find include file: t_9_019.hpp +#include "t_9_019.hpp" + +// 10: t_9_019.cpp(14): #include "t_9_019.hpp" +// 04: "t_9_019.hpp" +// 05: $B(t_9_019.hpp) ($B(t_9_019.hpp)) +// 10: t_9_019.hpp(11): #include_next "t_9_019.hpp" +// 04: "t_9_019.hpp" (include_next) +// 18: boost::wave::preprocess_exception diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_019.hpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_019.hpp new file mode 100644 index 000000000..39685a26b --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_019.hpp @@ -0,0 +1,11 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// this shouldn't give an recursion +#include_next "t_9_019.hpp" diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_020.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_020.cpp new file mode 100644 index 000000000..f78ef776b --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_020.cpp @@ -0,0 +1,48 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// tests whether whitespace is correctly handled in macro arguments + +//O --variadics + +#define STRINGIZE1(x) #x +#define STRINGIZE(x) STRINGIZE1(x) + +#define MACRO(...) (__VA_ARGS__) - STRINGIZE((__VA_ARGS__)) + +//R #line 20 "t_9_020.cpp" +MACRO() //R () - "()" +MACRO( ) //R () - "()" +MACRO(a) //R (a) - "(a)" +MACRO( a ) //R ( a ) - "( a )" +MACRO( a ) //R ( a ) - "( a )" +MACRO(a,b) //R (a,b) - "(a,b)" +MACRO(a, b) //R (a, b) - "(a, b)" +MACRO(a ,b) //R (a ,b) - "(a ,b)" +MACRO( a ,b, c ) //R ( a ,b, c ) - "( a ,b, c )" +MACRO( a ,b, c ) //R ( a ,b, c ) - "( a ,b, c )" + +#undef MACRO +#define MACRO(x) [x] + +//R #line 35 "t_9_020.cpp" +MACRO() //R [] +MACRO( ) //R [] +MACRO(123) //R [123] +MACRO( 123 ) //R [ 123 ] +MACRO( 123 ) //R [ 123 ] + +#define A(x) 1 x 3 +#define B(x) (1)x(3) + +//R #line 45 "t_9_020.cpp" +A(2) //R 1 2 3 +STRINGIZE(A(2)) //R "1 2 3" +STRINGIZE(B(2)) //R "(1)2(3)" +STRINGIZE(B( 2 )) //R "(1) 2 (3)" diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_021.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_021.cpp new file mode 100644 index 000000000..84b0e3314 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_021.cpp @@ -0,0 +1,24 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Verifies that preprocessing directives are properly recognized only if +// the '#' is really the first character on a line before macro expansion. +// See http://www.open-std.org/jtc1/sc22/wg14/docs/rr/dr_144.html. + +#define EMPTY +EMPTY # define M 1 + +//R #line 15 "t_9_021.cpp" +//R #define M 1 + +//H 10: t_9_021.cpp(14): #define +//H 08: t_9_021.cpp(14): EMPTY= +//H 01: t_9_021.cpp(14): EMPTY +//H 02: +//H 03: _ diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_022.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_022.cpp new file mode 100644 index 000000000..119018e29 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_022.cpp @@ -0,0 +1,18 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Verifies that preprocessing directives are properly recognized only if +// the '#' is really the first character on a line before macro expansion. +// See http://www.open-std.org/jtc1/sc22/wg14/docs/rr/dr_144.html. + +#define EMPTY +# EMPTY define M 1 + +//E t_9_022.cpp(15): error: ill formed preprocessor directive: # EMPTY define M 1 + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_023.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_023.cpp new file mode 100644 index 000000000..de6c4565f --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_023.cpp @@ -0,0 +1,31 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Verifies that preprocessing directives are properly recognized only if +// the '#' is really the first character on a line before macro expansion. +// See http://www.open-std.org/jtc1/sc22/wg14/docs/rr/dr_144.html. + +#define _C_STD_BEGIN + +_C_STD_BEGIN +#ifndef _M_CEE_PURE +_C_LIB_DECL +#endif + +//R #line 18 "t_9_023.cpp" +//R _C_LIB_DECL + +//H 10: t_9_023.cpp(14): #define +//H 08: t_9_023.cpp(14): _C_STD_BEGIN= +//H 01: t_9_023.cpp(14): _C_STD_BEGIN +//H 02: +//H 03: _ +//H 10: t_9_023.cpp(17): #ifndef +//H 11: t_9_023.cpp(17): #ifndef _M_CEE_PURE: 0 +//H 10: t_9_023.cpp(19): #endif diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_024.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_024.cpp new file mode 100644 index 000000000..a57989b5e --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_024.cpp @@ -0,0 +1,35 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2013 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// Verifies resolution of #8848: Wave driver improperly processes 0xFFFFui64 +// token + +//O --long_long +//D __TESTWAVE_SUPPORT_MS_EXTENSIONS__ + +#if defined(__TESTWAVE_SUPPORT_MS_EXTENSIONS__) + +#define TEST 0xFFFFFui64 + +TEST + +//R #line 19 "t_9_024.cpp" +//R 0xFFFFFui64 + +//H 10: t_9_024.cpp(15): #if +//H 11: t_9_024.cpp(15): #if defined(__TESTWAVE_SUPPORT_MS_EXTENSIONS__): 1 +//H 10: t_9_024.cpp(17): #define +//H 08: t_9_024.cpp(17): TEST=0xFFFFFui64 +//H 01: t_9_024.cpp(17): TEST +//H 02: 0xFFFFFui64 +//H 03: 0xFFFFFui64 +//H 10: t_9_024.cpp(33): #endif + +#endif + diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_025.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_025.cpp new file mode 100644 index 000000000..579ffc2d4 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_025.cpp @@ -0,0 +1,13 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//U yes +//R #line 10 "file.hpp" +//R "$P(utf8-test-ßµ™∃/file.hpp)" +#include <utf8-test-ßµ™∃/file.hpp> diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_026.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_026.cpp new file mode 100644 index 000000000..b4accc624 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_026.cpp @@ -0,0 +1,14 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//U yes +//O -S$P(utf8-test-ßµ™∃) +//R #line 10 "file.hpp" +//R "$P(utf8-test-ßµ™∃/file.hpp)" +#include <file.hpp> diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_027.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_027.cpp new file mode 100644 index 000000000..0755acacf --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_027.cpp @@ -0,0 +1,12 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +//O -S$P(utf8-test-ßµ™∃) +//E t_9_027.cpp(12): error: could not find include file: file.hpp +#include <file.hpp> diff --git a/src/boost/libs/wave/test/testwave/testfiles/t_9_028.cpp b/src/boost/libs/wave/test/testwave/testfiles/t_9_028.cpp new file mode 100644 index 000000000..959c6f2ba --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/t_9_028.cpp @@ -0,0 +1,13 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + + +//E t_9_028.cpp(12): error: could not find include file: utf8-test-ßµ™∃/file.hpp +#include <utf8-test-ßµ™∃/file.hpp> + diff --git a/src/boost/libs/wave/test/testwave/testfiles/test.cfg b/src/boost/libs/wave/test/testwave/testfiles/test.cfg new file mode 100644 index 000000000..ffe1a20a6 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/test.cfg @@ -0,0 +1,251 @@ +# +# Boost.Wave: A Standard compliant C++ preprocessor library +# http://www.boost.org/ +# +# Copyright (c) 2003-2013 Hartmut Kaiser. Distributed under the Boost +# Software License, Version 1.0. (See accompanying file +# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +# + +# +# t_1: Macro expansion +# +t_1_001.cpp +t_1_002.cpp +t_1_003.cpp +t_1_004.cpp +t_1_005.cpp +t_1_006.cpp +t_1_007.cpp +t_1_008.cpp +t_1_009.cpp +t_1_010.cpp +t_1_011.cpp +t_1_012.cpp +t_1_013.cpp +# t_1_014 currently disabled because of a known problem in the Wave library +#t_1_014.cpp +t_1_015.cpp +t_1_016.cpp +t_1_017.cpp +t_1_018.cpp +t_1_019.cpp +t_1_020.cpp +t_1_021.cpp +t_1_022.cpp +t_1_023.cpp +t_1_024.cpp +t_1_025.cpp +t_1_026.cpp +t_1_027.cpp +t_1_028.cpp +t_1_029.cpp +t_1_030.cpp +t_1_031.cpp +t_1_032.cpp +t_1_033.cpp +t_1_034.cpp +t_1_035.cpp +t_1_036.cpp +t_1_037.cpp +t_1_038.cpp + +# +# t_2: Preprocessing directives +# +t_2_001.cpp +t_2_002.cpp +t_2_003.cpp +t_2_004.cpp +t_2_005.cpp +t_2_006.cpp +t_2_007.cpp +t_2_008.cpp +t_2_009.cpp +t_2_010.cpp +t_2_011.cpp +t_2_012.cpp +t_2_013.cpp +t_2_014.cpp +t_2_015.cpp +t_2_016.cpp +t_2_017.cpp +t_2_018.cpp +t_2_019.cpp +t_2_020.cpp +t_2_021.cpp +t_2_022.cpp + +# +# t_3: Predefined macros +# +t_3_001.cpp +t_3_002.cpp +t_3_003.cpp +t_3_004.cpp + +# +# Preprocessing expressions +# +t_4_001.cpp +t_4_002.cpp +t_4_003.cpp +t_4_004.cpp + +# +# unit tests from the mcpp preprocessor validation suite +# (general functionality) +# +t_5_001.cpp +t_5_002.cpp +t_5_003.cpp +# t_5_004 is currently disabled because of a known problem in the Wave library +#t_5_004.cpp +t_5_005.cpp +t_5_006.cpp +t_5_007.cpp +t_5_008.cpp +t_5_009.cpp +t_5_010.cpp +t_5_011.cpp +t_5_012.cpp +t_5_013.cpp +t_5_014.cpp +t_5_015.cpp +t_5_016.cpp +t_5_017.cpp +t_5_018.cpp +t_5_019.cpp +t_5_020.cpp +t_5_021.cpp +t_5_022.cpp +t_5_023.cpp +t_5_024.cpp +t_5_025.cpp +t_5_026.cpp +t_5_027.cpp +t_5_028.cpp +t_5_029.cpp +# t_5_030 contains one disabled test +t_5_030.cpp +t_5_031.cpp +t_5_032.cpp +t_5_033.cpp +t_5_034.cpp +t_5_035.cpp + +# +# unit tests from the mcpp preprocessor validation suite +# (error reporting) +# +t_6_001.cpp +t_6_002.cpp +t_6_003.cpp +t_6_004.cpp +t_6_005.cpp +t_6_006.cpp +t_6_007.cpp +t_6_008.cpp +t_6_009.cpp +t_6_010.cpp +t_6_011.cpp +t_6_012.cpp +t_6_013.cpp +t_6_014.cpp +t_6_015.cpp +t_6_016.cpp +t_6_017.cpp +t_6_018.cpp +t_6_019.cpp +t_6_020.cpp +t_6_021.cpp +t_6_022.cpp +t_6_023.cpp +t_6_024.cpp +t_6_025.cpp +t_6_026.cpp +t_6_027.cpp +t_6_028.cpp +t_6_029.cpp +t_6_030.cpp +t_6_031.cpp +t_6_032.cpp +t_6_033.cpp +t_6_034.cpp +t_6_035.cpp +t_6_036.cpp +t_6_037.cpp +t_6_038.cpp +t_6_039.cpp +t_6_040.cpp +t_6_041.cpp +t_6_042.cpp +t_6_043.cpp +t_6_044.cpp +t_6_045.cpp +t_6_046.cpp +t_6_047.cpp +t_6_048.cpp +t_6_049.cpp +t_6_050.cpp +t_6_051.cpp +t_6_052.cpp +t_6_053.cpp +t_6_054.cpp +t_6_055.cpp +t_6_056.cpp +t_6_057.cpp +t_6_058.cpp +t_6_059.cpp +t_6_060.cpp +t_6_061.cpp +t_6_062.cpp +t_6_063.cpp +t_6_064.cpp +t_6_065.cpp +t_6_066.cpp +t_6_067.cpp +t_6_068.cpp +t_6_069.cpp + +# +# t_7: C++0x testing +# +t_7_001.cpp +t_7_002.cpp +t_7_003.cpp +t_7_004.cpp +t_7_005.cpp +t_7_006.cpp + +# +# t_9: General preprocessing problems +# +t_9_001.cpp +t_9_002.cpp +t_9_003.cpp +t_9_004.cpp +t_9_005.cpp +t_9_006.cpp +t_9_007.cpp +t_9_008.cpp +t_9_009.cpp +t_9_010.cpp +t_9_011.cpp +t_9_012.cpp +t_9_013.cpp +t_9_014.cpp +t_9_015.cpp +t_9_016.cpp +t_9_017.cpp +t_9_018.cpp +t_9_019.cpp +t_9_020.cpp +t_9_021.cpp +t_9_022.cpp +t_9_023.cpp +t_9_024.cpp +t_9_025.cpp +t_9_026.cpp +# t_9_027.cpp currently disabled, expected fail only on windows +# t_9_028.cpp currently disabled, expected fail only on windows diff --git a/src/boost/libs/wave/test/testwave/testfiles/utf8-test-ßµ™∃/file.hpp b/src/boost/libs/wave/test/testwave/testfiles/utf8-test-ßµ™∃/file.hpp new file mode 100644 index 000000000..df704b2d0 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testfiles/utf8-test-ßµ™∃/file.hpp @@ -0,0 +1,10 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +__FILE__ diff --git a/src/boost/libs/wave/test/testwave/testwave.cpp b/src/boost/libs/wave/test/testwave/testwave.cpp new file mode 100644 index 000000000..e5e481d0d --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testwave.cpp @@ -0,0 +1,301 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// disable stupid compiler warnings +#include <boost/config/warning_disable.hpp> + +// system headers +#include <string> +#include <iostream> +#include <vector> + +// include boost +#include <boost/config.hpp> +#include <boost/wave.hpp> +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/operations.hpp> + +// test application related headers +#include "cmd_line_utils.hpp" +#include "testwave_app.hpp" + +namespace po = boost::program_options; +namespace fs = boost::filesystem; + +/////////////////////////////////////////////////////////////////////////////// +// +// The debuglevel command line parameter is used to control the amount of text +// printed by the testwave application. +// +// level 0: prints nothing except serious failures preventing the testwave +// executable from running, the return value of the executable is +// equal to the number of failed tests +// level 1: prints a short summary only +// level 2: prints the names of the failed tests only +// level 3: prints the expected and real result for failed tests +// level 4: prints the outcome of every test +// level 5: prints the real result even for succeeded tests +// level 6: prints the real hooks information recorded, even for succeeded +// tests +// +// level 9: prints information about almost everything +// +// The default debug level is 1. +// +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +int +main(int argc, char *argv[]) +{ + int error_count = 0; + int config_file_error_count = 0; + try { + // analyze the command line options and arguments + po::options_description desc_cmdline ("Options allowed on the command line"); + desc_cmdline.add_options() + ("help,h", "print out program usage (this message)") + ("version,v", "print the version number") + ("copyright,c", "print out the copyright statement") + ("config-file", po::value<std::vector<std::string> >()->composing(), + "specify a config file (alternatively: @arg)") + ("hooks", po::value<bool>()->default_value(true), + "test preprocessing hooks") + ("debug,d", po::value<int>(), "set the debug level (0...9)") + ; + + // Hidden options, will be used in in config file analysis to allow to + // recognize positional arguments, will not be shown to the user. + po::options_description desc_hidden("Hidden options"); + desc_hidden.add_options() + ("input", po::value<std::vector<std::string> >()->composing(), + "inputfile") + ; + + // this is the test application object + po::variables_map vm; + testwave_app app(vm); + + // all command line and config file options + po::options_description cmdline_options; + cmdline_options.add(desc_cmdline).add(app.common_options()); + + // parse command line + // (the (int) cast is to make the True64 compiler happy) + using namespace boost::program_options::command_line_style; + po::parsed_options opts(po::parse_command_line(argc, argv, + cmdline_options, (int)unix_style, cmd_line_utils::at_option_parser)); + + po::store(opts, vm); + po::notify(vm); + + // ... act as required + if (vm.count("help")) { + po::options_description desc_help ( + "Usage: testwave [options] [@config-file(s)] file(s)"); + desc_help.add(desc_cmdline).add(app.common_options()); + std::cout << desc_help << std::endl; + return 0; + } + + // debug flag + if (vm.count("debug")) { + int debug_level = vm["debug"].as<int>(); + if (debug_level < 0 || debug_level > 9) { + std::cerr + << "testwave: please use an integer in the range [0..9] " + << "as the parameter to the debug option!" + << std::endl; + } + else { + app.set_debuglevel(debug_level); + } + } + + if (vm.count("version")) { + return app.print_version(); + } + + if (vm.count("copyright")) { + return app.print_copyright(); + } + + // If there is specified at least one config file, parse it and add the + // options to the main variables_map + // Each of the config files is parsed into a separate variables_map to + // allow correct paths handling. + int input_count = 0; + if (vm.count("config-file")) { + std::vector<std::string> const &cfg_files = + vm["config-file"].as<std::vector<std::string> >(); + + if (9 == app.get_debuglevel()) { + std::cerr << "found " << (unsigned)cfg_files.size() + << " config-file arguments" << std::endl; + } + + std::vector<std::string>::const_iterator end = cfg_files.end(); + for (std::vector<std::string>::const_iterator cit = cfg_files.begin(); + cit != end; ++cit) + { + if (9 == app.get_debuglevel()) { + std::cerr << "reading config_file: " << *cit << std::endl; + } + + // parse a single config file and store the results, config files + // may only contain --input and positional arguments + po::variables_map cvm; + if (!cmd_line_utils::read_config_file(app.get_debuglevel(), + *cit, desc_hidden, cvm)) + { + if (9 == app.get_debuglevel()) { + std::cerr << "failed to read config_file: " << *cit + << std::endl; + } + ++config_file_error_count; + } + + if (9 == app.get_debuglevel()) { + std::cerr << "succeeded to read config_file: " << *cit + << std::endl; + } + + // correct the paths parsed into this variables_map + if (cvm.count("input")) { + std::vector<std::string> const &infiles = + cvm["input"].as<std::vector<std::string> >(); + + if (9 == app.get_debuglevel()) { + std::cerr << "found " << (unsigned)infiles.size() + << " entries" << std::endl; + } + + std::vector<std::string>::const_iterator iend = infiles.end(); + for (std::vector<std::string>::const_iterator iit = infiles.begin(); + iit != iend; ++iit) + { + // correct the file name (pre-pend the config file path) + fs::path cfgpath = boost::wave::util::complete_path( + boost::wave::util::create_path(*cit), + boost::wave::util::current_path()); + fs::path filepath = + boost::wave::util::branch_path(cfgpath) / + boost::wave::util::create_path(*iit); + + if (9 == app.get_debuglevel()) { + std::cerr << std::string(79, '-') << std::endl; + std::cerr << "executing test: " + << boost::wave::util::native_file_string(filepath) + << std::endl; + } + + // execute this unit test case + if (!app.test_a_file( + boost::wave::util::native_file_string(filepath))) + { + if (9 == app.get_debuglevel()) { + std::cerr << "failed to execute test: " + << boost::wave::util::native_file_string(filepath) + << std::endl; + } + ++error_count; + } + else if (9 == app.get_debuglevel()) { + std::cerr << "succeeded to execute test: " + << boost::wave::util::native_file_string(filepath) + << std::endl; + } + ++input_count; + + if (9 == app.get_debuglevel()) { + std::cerr << std::string(79, '-') << std::endl; + } + } + } + else if (9 == app.get_debuglevel()) { + std::cerr << "no entries found" << std::endl; + } + } + } + + // extract the arguments from the parsed command line + std::vector<po::option> arguments; + std::remove_copy_if(opts.options.begin(), opts.options.end(), + std::back_inserter(arguments), cmd_line_utils::is_argument()); + + if (9 == app.get_debuglevel()) { + std::cerr << "found " << (unsigned)arguments.size() + << " arguments" << std::endl; + } + + // iterate over remaining arguments + std::vector<po::option>::const_iterator arg_end = arguments.end(); + for (std::vector<po::option>::const_iterator arg = arguments.begin(); + arg != arg_end; ++arg) + { + fs::path filepath(boost::wave::util::create_path((*arg).value[0])); + + if (9 == app.get_debuglevel()) { + std::cerr << std::string(79, '-') << std::endl; + std::cerr << "executing test: " + << boost::wave::util::native_file_string(filepath) + << std::endl; + } + + if (!app.test_a_file(boost::wave::util::native_file_string(filepath))) + { + if (9 == app.get_debuglevel()) { + std::cerr << "failed to execute test: " + << boost::wave::util::native_file_string(filepath) + << std::endl; + } + ++error_count; + } + else if (9 == app.get_debuglevel()) { + std::cerr << "succeeded to execute test: " + << boost::wave::util::native_file_string(filepath) + << std::endl; + } + + if (9 == app.get_debuglevel()) { + std::cerr << std::string(79, '-') << std::endl; + } + ++input_count; + } + + // print a message if no input is given + if (0 == input_count) { + std::cerr + << "testwave: no input file specified, " + << "try --help to get a hint." + << std::endl; + return (std::numeric_limits<int>::max)() - 3; + } + else if (app.get_debuglevel() > 0) { + std::cout + << "testwave: " << input_count-error_count + << " of " << input_count << " test(s) succeeded"; + if (0 != error_count) { + std::cout + << " (" << error_count << " test(s) failed)"; + } + std::cout << "." << std::endl; + } + } + catch (std::exception const& e) { + std::cerr << "testwave: exception caught: " << e.what() << std::endl; + return (std::numeric_limits<int>::max)() - 1; + } + catch (...) { + std::cerr << "testwave: unexpected exception caught." << std::endl; + return (std::numeric_limits<int>::max)() - 2; + } + + return error_count + config_file_error_count; +} diff --git a/src/boost/libs/wave/test/testwave/testwave_app.cpp b/src/boost/libs/wave/test/testwave/testwave_app.cpp new file mode 100644 index 000000000..140408560 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testwave_app.cpp @@ -0,0 +1,1486 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2013 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// disable stupid compiler warnings +#include <boost/config/warning_disable.hpp> + +// system headers +#include <string> +#include <iostream> +#include <vector> +#include <ctime> + +// include boost +#include <boost/config.hpp> +#include <boost/assert.hpp> +#include <boost/throw_exception.hpp> +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/operations.hpp> +#include <boost/detail/workaround.hpp> + +// include Wave + +// always use new hooks +#define BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS 0 + +#include <boost/wave.hpp> + +// include the lexer related stuff +#include <boost/wave/cpplexer/cpp_lex_token.hpp> // token type +#include <boost/wave/cpplexer/cpp_lex_iterator.hpp> // lexer type + +/////////////////////////////////////////////////////////////////////////////// +// Include lexer specifics, import lexer names +#if BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION == 0 +#include <boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp> +#endif + +/////////////////////////////////////////////////////////////////////////////// +// Include the grammar definitions, if these shouldn't be compiled separately +// (ATTENTION: _very_ large compilation times!) +#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION == 0 +#include <boost/wave/grammars/cpp_intlit_grammar.hpp> +#include <boost/wave/grammars/cpp_chlit_grammar.hpp> +#include <boost/wave/grammars/cpp_grammar.hpp> +#include <boost/wave/grammars/cpp_expression_grammar.hpp> +#include <boost/wave/grammars/cpp_predef_macros_grammar.hpp> +#include <boost/wave/grammars/cpp_defined_grammar.hpp> +#endif + +// test application related headers +#include "cmd_line_utils.hpp" +#include "testwave_app.hpp" +#include "collect_hooks_information.hpp" + +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/detail/utf8_codecvt_facet.hpp> + +# ifdef BOOST_NO_STDC_NAMESPACE +namespace std +{ + using ::asctime; using ::gmtime; using ::localtime; + using ::difftime; using ::time; using ::tm; using ::mktime; using ::system; +} +# endif + +namespace po = boost::program_options; +namespace fs = boost::filesystem; + +/////////////////////////////////////////////////////////////////////////////// +// testwave version definitions +#define TESTWAVE_VERSION_MAJOR 0 +#define TESTWAVE_VERSION_MINOR 6 +#define TESTWAVE_VERSION_SUBMINOR 0 + +namespace { + struct fs_path_imbue_utf8 + { + explicit fs_path_imbue_utf8(bool enable) + : m_enabled(enable), m_prevLocale() + { + if (!m_enabled) return; + static std::locale global_loc = std::locale(); + static std::locale utf_8_loc(global_loc, new boost::filesystem::detail::utf8_codecvt_facet); + + m_prevLocale = boost::filesystem::path::imbue(utf_8_loc); + + } + ~fs_path_imbue_utf8() + { + if (!m_enabled) return; + boost::filesystem::path::imbue(m_prevLocale); + } + private: + fs_path_imbue_utf8(); + fs_path_imbue_utf8(fs_path_imbue_utf8 const&); + fs_path_imbue_utf8& operator=(fs_path_imbue_utf8 const&); + + bool m_enabled; + std::locale m_prevLocale; + }; + + /////////////////////////////////////////////////////////////////////////// + template <typename Iterator> + inline bool + handle_next_token(Iterator &it, Iterator const& end, + std::string &result) + { + typedef typename Iterator::value_type token_type; + + token_type tok = *it++; + result = result + tok.get_value().c_str(); + return (it == end) ? false : true; + } + + /////////////////////////////////////////////////////////////////////////// + template <typename String> + String const& handle_quoted_filepath(String &name) + { + using boost::wave::util::impl::unescape_lit; + + String unesc_name = unescape_lit(name.substr(1, name.size()-2)); + fs::path p (boost::wave::util::create_path(unesc_name.c_str())); + + name = String("\"") + boost::wave::util::leaf(p).c_str() + String("\""); + return name; + } + + /////////////////////////////////////////////////////////////////////////// + template <typename Iterator> + bool handle_line_directive(Iterator &it, Iterator const& end, + std::string &result) + { + typedef typename Iterator::value_type token_type; + typedef typename token_type::string_type string_type; + + if (!handle_next_token(it, end, result) || // #line + !handle_next_token(it, end, result) || // whitespace + !handle_next_token(it, end, result) || // number + !handle_next_token(it, end, result)) // whitespace + { + return false; + } + + using boost::wave::util::impl::unescape_lit; + + token_type filename = *it; + string_type name = filename.get_value(); + + handle_quoted_filepath(name); + result = result + name.c_str(); + return true; + } + + template <typename T> + inline T const& + variables_map_as(po::variable_value const& v, T*) + { +#if (__GNUC__ == 3 && (__GNUC_MINOR__ == 2 || __GNUC_MINOR__ == 3)) || \ + BOOST_WORKAROUND(__MWERKS__, < 0x3200) +// gcc 3.2.x and 3.3.x choke on vm[...].as<...>() +// CW 8.3 has problems with the v.as<T>() below + T const* r = boost::any_cast<T>(&v.value()); + if (!r) + boost::throw_exception(boost::bad_any_cast()); + return *r; +#else + return v.as<T>(); +#endif + } + +} + +/////////////////////////////////////////////////////////////////////////// +// +// This function compares the real result and the expected one but first +// replaces all occurrences in the expected result of +// $E: to the result of preprocessing the given expression +// $F: to the passed full filepath +// $P: to the full path +// $B: to the full path (same as $P, but using forward slash '/' on Windows) +// $V: to the current Boost version number +// +/////////////////////////////////////////////////////////////////////////// +bool +testwave_app::got_expected_result(std::string const& filename, + std::string const& result, std::string& expected) +{ + using boost::wave::util::impl::escape_lit; + + std::string full_result; + std::string::size_type pos = 0; + std::string::size_type pos1 = expected.find_first_of("$"); + + if (pos1 != std::string::npos) { + do { + switch(expected[pos1+1]) { + case 'E': // preprocess the given token sequence + { + if ('(' == expected[pos1+2]) { + std::size_t p = expected.find_first_of(")", pos1+1); + if (std::string::npos == p) { + std::cerr + << "testwave: unmatched parenthesis in $E" + " directive" << std::endl; + return false; + } + std::string source = expected.substr(pos1+3, p-pos1-3); + std::string result, error, hooks; + bool pp_result = preprocess_file(filename, source, + result, error, hooks, "", true); + if (!pp_result) { + std::cerr + << "testwave: preprocessing error in $E directive: " + << error << std::endl; + return false; + } + full_result = full_result + + expected.substr(pos, pos1-pos) + result; + pos1 = expected.find_first_of ("$", + pos = pos1 + 4 + source.size()); + } + } + break; + + case 'F': // insert base file name + full_result = full_result + + expected.substr(pos, pos1-pos) + escape_lit(filename); + pos1 = expected.find_first_of ("$", pos = pos1 + 2); + break; + + case 'P': // insert full path + case 'B': // same as 'P', but forward slashes on Windows + { + fs::path fullpath ( + boost::wave::util::complete_path( + boost::wave::util::create_path(filename), + boost::wave::util::current_path()) + ); + + if ('(' == expected[pos1+2]) { + // the $P(basename) syntax is used + std::size_t p = expected.find_first_of(")", pos1+1); + if (std::string::npos == p) { + std::cerr + << "testwave: unmatched parenthesis in $P" + " directive" << std::endl; + return false; + } + std::string base = expected.substr(pos1+3, p-pos1-3); + fullpath = boost::wave::util::branch_path(fullpath) / + boost::wave::util::create_path(base); + full_result += expected.substr(pos, pos1-pos); + if ('P' == expected[pos1+1]) { +#if defined(BOOST_WINDOWS) + std::string p = replace_slashes( + boost::wave::util::native_file_string( + boost::wave::util::normalize(fullpath)), + "/", '\\'); +#else + std::string p ( + boost::wave::util::native_file_string( + boost::wave::util::normalize(fullpath))); +#endif + full_result += escape_lit(p); + } + else { +#if defined(BOOST_WINDOWS) + std::string p = replace_slashes( + boost::wave::util::normalize(fullpath).string()); +#else + std::string p ( + boost::wave::util::normalize(fullpath).string()); +#endif + full_result += escape_lit(p); + } + pos1 = expected.find_first_of ("$", + pos = pos1 + 4 + base.size()); + } + else { + // the $P is used on its own + full_result += expected.substr(pos, pos1-pos); + if ('P' == expected[pos1+1]) { + full_result += escape_lit( + boost::wave::util::native_file_string(fullpath)); + } + else { +#if defined(BOOST_WINDOWS) + std::string p = replace_slashes(fullpath.string()); +#else + std::string p (fullpath.string()); +#endif + full_result += escape_lit(fullpath.string()); + } + pos1 = expected.find_first_of ("$", pos = pos1 + 2); + } + } + break; + + case 'R': // insert relative file name + case 'S': // same as 'R', but forward slashes on Windows + { + fs::path relpath; + boost::wave::util::as_relative_to( + boost::wave::util::create_path(filename), + boost::wave::util::current_path(), + relpath); + + if ('(' == expected[pos1+2]) { + // the $R(basename) syntax is used + std::size_t p = expected.find_first_of(")", pos1+1); + if (std::string::npos == p) { + std::cerr + << "testwave: unmatched parenthesis in $R" + " directive" << std::endl; + return false; + } + std::string base = expected.substr(pos1+3, p-pos1-3); + relpath = boost::wave::util::branch_path(relpath) / + boost::wave::util::create_path(base); + full_result += expected.substr(pos, pos1-pos); + if ('R' == expected[pos1+1]) { + full_result += escape_lit( + boost::wave::util::native_file_string( + boost::wave::util::normalize(relpath))); + } + else { +#if defined(BOOST_WINDOWS) + std::string p = replace_slashes( + boost::wave::util::normalize(relpath).string()); +#else + std::string p ( + boost::wave::util::normalize(relpath).string()); +#endif + full_result += escape_lit(p); + } + pos1 = expected.find_first_of ("$", + pos = pos1 + 4 + base.size()); + } + else { + // the $R is used on its own + full_result += expected.substr(pos, pos1-pos); + if ('R' == expected[pos1+1]) { + full_result += escape_lit( + boost::wave::util::native_file_string(relpath)); + } + else { +#if defined(BOOST_WINDOWS) + std::string p = replace_slashes(relpath.string()); +#else + std::string p (relpath.string()); +#endif + full_result += escape_lit(p); + } + pos1 = expected.find_first_of ("$", pos = pos1 + 2); + } + } + break; + + case 'V': // insert Boost version + full_result = full_result + + expected.substr(pos, pos1-pos) + BOOST_LIB_VERSION; + pos1 = expected.find_first_of ("$", pos = pos1 + 2); + break; + + default: + full_result = full_result + + expected.substr(pos, pos1-pos); + pos1 = expected.find_first_of ("$", (pos = pos1) + 1); + break; + } + + } while(pos1 != std::string::npos); + full_result += expected.substr(pos); + } + else { + full_result = expected; + } + + expected = full_result; + return full_result == result; +} + +/////////////////////////////////////////////////////////////////////////////// +testwave_app::testwave_app(po::variables_map const& vm) +: debuglevel(1), desc_options("Preprocessor configuration options"), + global_vm(vm) +{ + desc_options.add_options() + ("include,I", po::value<cmd_line_utils::include_paths>()->composing(), + "specify an additional include directory") + ("sysinclude,S", po::value<std::vector<std::string> >()->composing(), + "specify an additional system include directory") + ("forceinclude,F", po::value<std::vector<std::string> >()->composing(), + "force inclusion of the given file") + ("define,D", po::value<std::vector<std::string> >()->composing(), + "specify a macro to define (as macro[=[value]])") + ("predefine,P", po::value<std::vector<std::string> >()->composing(), + "specify a macro to predefine (as macro[=[value]])") + ("undefine,U", po::value<std::vector<std::string> >()->composing(), + "specify a macro to undefine") + ("nesting,n", po::value<int>(), + "specify a new maximal include nesting depth") + ("long_long", "enable long long support in C++ mode") + ("preserve", "preserve comments") +#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 + ("variadics", "enable certain C99 extensions in C++ mode") + ("c99", "enable C99 mode (implies --variadics)") +#endif +#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0 + ("noguard,G", "disable include guard detection") +#endif + ("skipped_token_hooks", "record skipped_token hook calls") +#if BOOST_WAVE_SUPPORT_CPP0X != 0 + ("c++11", "enable C++11 mode (implies --variadics and --long_long)") +#endif + ("warning,W", po::value<std::vector<std::string> >()->composing(), + "Warning settings.") + ; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Test the given file (i.e. preprocess the file and compare the result +// against the embedded 'R' comments, if an error occurs compare the error +// message against the given 'E' comments, if no error occurred, compare the +// generated hooks result against the given 'H' comments). +// +/////////////////////////////////////////////////////////////////////////////// +bool +testwave_app::test_a_file(std::string filename) +{ +// read the input file into a string + std::string instr; + if (!read_file(filename, instr)) + return false; // error was reported already + + std::string use_utf8; + extract_special_information(filename, instr, 'U', use_utf8); + fs_path_imbue_utf8 to_utf8(use_utf8.substr(0,3) == "yes"); + + bool test_hooks = true; + if (global_vm.count("hooks")) + test_hooks = variables_map_as(global_vm["hooks"], (bool *)NULL); + + std::string expected_cfg_macro; + extract_special_information(filename, instr, 'D', expected_cfg_macro); + +// extract expected output, preprocess the data and compare results + std::string expected, expected_hooks; + if (extract_expected_output(filename, instr, expected, expected_hooks)) { + bool retval = true; // assume success + bool printed_result = false; + std::string result, error, hooks; + bool pp_result = preprocess_file(filename, instr, result, error, hooks, + expected_cfg_macro); + if (pp_result || !result.empty()) { + // did we expect an error? + std::string expected_error; + if (!extract_special_information(filename, instr, 'E', expected_error)) + return false; + + if (!expected_error.empty() && + !got_expected_result(filename, error, expected_error)) + { + // we expected an error but got none (or a different one) + if (debuglevel > 2) { + std::cerr + << filename << ": failed" << std::endl + << "result: " << std::endl << result << std::endl; + + if (!error.empty()) { + std::cerr << "expected result: " << std::endl + << expected << std::endl; + } + if (!expected_error.empty()) { + std::cerr << "expected error: " << std::endl + << expected_error << std::endl; + } + } + else if (debuglevel > 1) { + std::cerr << filename << ": failed" << std::endl; + } + retval = false; + } + else if (!got_expected_result(filename, result, expected)) { + // no preprocessing error encountered + if (debuglevel > 2) { + std::cerr + << filename << ": failed" << std::endl + << "result: " << std::endl << result << std::endl + << "expected: " << std::endl << expected << std::endl; + } + else if (debuglevel > 1) { + std::cerr << filename << ": failed" << std::endl; + } + retval = false; + } + else { + // preprocessing succeeded, check hook information, if appropriate + if (test_hooks && !expected_hooks.empty() && + !got_expected_result(filename, hooks, expected_hooks)) + { + if (debuglevel > 2) { + std::cerr << filename << ": failed" << std::endl + << "hooks result: " << std::endl << hooks + << std::endl; + std::cerr << "expected hooks result: " << std::endl + << expected_hooks << std::endl; + } + else if (debuglevel > 1) { + std::cerr << filename << ": failed" << std::endl; + } + retval = false; + } + } + + // print success message, if appropriate + if (retval) { + if (debuglevel > 5) { + std::cerr + << filename << ": succeeded" << std::endl + << "result: " << std::endl << result << std::endl + << "hooks result: " << std::endl << hooks << std::endl; + } + else if (debuglevel > 4) { + std::cerr + << filename << ": succeeded" << std::endl + << "result: " << std::endl << result << std::endl; + } + else if (debuglevel > 3) { + std::cerr << filename << ": succeeded" << std::endl; + } + printed_result = true; + } + } + + if (!pp_result) { + // there was a preprocessing error, was it expected? + std::string expected_error; + if (!extract_special_information(filename, instr, 'E', expected_error)) + return false; + + if (!got_expected_result(filename, error, expected_error)) { + // the error was unexpected + if (debuglevel > 2) { + std::cerr + << filename << ": failed" << std::endl; + + if (!expected_error.empty()) { + std::cerr + << "error result: " << std::endl << error << std::endl + << "expected error: " << std::endl + << expected_error << std::endl; + } + else { + std::cerr << "unexpected error: " << error << std::endl; + } + } + else if (debuglevel > 1) { + std::cerr << filename << ": failed" << std::endl; + } + retval = false; + } + + if (retval) { + if (debuglevel > 5) { + std::cerr + << filename << ": succeeded (caught expected error)" + << std::endl << "error result: " << std::endl << error + << std::endl; + + if (!printed_result) { + std::cerr + << "hooks result: " << std::endl << hooks + << std::endl; + } + } + else if (debuglevel > 4) { + std::cerr + << filename << ": succeeded (caught expected error)" + << std::endl << "error result: " << std::endl << error + << std::endl; + } + else if (debuglevel > 3) { + // caught the expected error message + std::cerr << filename << ": succeeded" << std::endl; + } + } + } + return retval; + } + else { + std::cerr + << filename << ": no information about expected results found" + << std::endl; + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// print the current version of this program +// +/////////////////////////////////////////////////////////////////////////////// +int +testwave_app::print_version() +{ +// get time of last compilation of this file +boost::wave::util::time_conversion_helper compilation_time(__DATE__ " " __TIME__); + +// calculate the number of days since Feb 12 2005 +// (the day the testwave project was started) +std::tm first_day; + + using namespace std; // some platforms have memset in namespace std + memset (&first_day, 0, sizeof(std::tm)); + first_day.tm_mon = 1; // Feb + first_day.tm_mday = 12; // 12 + first_day.tm_year = 105; // 2005 + +long seconds = long(std::difftime(compilation_time.get_time(), + std::mktime(&first_day))); + + std::cout + << TESTWAVE_VERSION_MAJOR << '.' + << TESTWAVE_VERSION_MINOR << '.' + << TESTWAVE_VERSION_SUBMINOR << '.' + << seconds/(3600*24) // get number of days from seconds + << std::endl; + return 0; // exit app +} + +/////////////////////////////////////////////////////////////////////////////// +// +// print the copyright statement +// +/////////////////////////////////////////////////////////////////////////////// +int +testwave_app::print_copyright() +{ + char const *copyright[] = { + "", + "Testwave: A test driver for the Boost.Wave C++ preprocessor library", + "http://www.boost.org/", + "", + "Copyright (c) 2001-2012 Hartmut Kaiser, Distributed under the Boost", + "Software License, Version 1.0. (See accompanying file", + "LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)", + 0 + }; + + for (int i = 0; 0 != copyright[i]; ++i) + std::cout << copyright[i] << std::endl; + + return 0; // exit app +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Read the given file into a string +// +/////////////////////////////////////////////////////////////////////////////// +bool +testwave_app::read_file(std::string const& filename, std::string& instr) +{ +// open the given file and report error, if appropriate + std::ifstream instream(filename.c_str()); + if (!instream.is_open()) { + std::cerr << "testwave: could not open input file: " + << filename << std::endl; + return false; + } + else if (9 == debuglevel) { + std::cerr << "read_file: succeeded to open input file: " + << filename << std::endl; + } + instream.unsetf(std::ios::skipws); + +// read the input file into a string + +#if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) +// this is known to be very slow for large files on some systems + std::copy (std::istream_iterator<char>(instream), + std::istream_iterator<char>(), + std::inserter(instr, instr.end())); +#else + instr = std::string(std::istreambuf_iterator<char>(instream.rdbuf()), + std::istreambuf_iterator<char>()); +#endif + + if (9 == debuglevel) { + std::cerr << "read_file: succeeded to read input file: " + << filename << std::endl; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +namespace { + + std::string const& trim_whitespace(std::string& value) + { + std::string::size_type first = value.find_first_not_of(" \t"); + if (std::string::npos == first) + value.clear(); + else { + std::string::size_type last = value.find_last_not_of(" \t"); + BOOST_ASSERT(std::string::npos != last); + value = value.substr(first, last-first+1); + } + return value; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Extract special information from comments marked with the given letter +// +/////////////////////////////////////////////////////////////////////////////// +bool +testwave_app::extract_special_information(std::string const& filename, + std::string const& instr, char flag, std::string& content) +{ + if (9 == debuglevel) { + std::cerr << "extract_special_information: extracting special information ('" + << flag << "') from input file: " << filename << std::endl; + } + +// tokenize the input data into C++ tokens using the C++ lexer + typedef boost::wave::cpplexer::lex_token<> token_type; + typedef boost::wave::cpplexer::lex_iterator<token_type> lexer_type; + typedef token_type::position_type position_type; + + boost::wave::language_support const lang_opts = + (boost::wave::language_support)( + boost::wave::support_option_variadics | + boost::wave::support_option_long_long | + boost::wave::support_option_no_character_validation | + boost::wave::support_option_convert_trigraphs | + boost::wave::support_option_insert_whitespace); + + position_type pos(filename.c_str()); + lexer_type it = lexer_type(instr.begin(), instr.end(), pos, lang_opts); + lexer_type end = lexer_type(); + + try { + // look for C or C++ comments starting with the special character + for (/**/; it != end; ++it) { + using namespace boost::wave; + token_id id = token_id(*it); + if (T_CCOMMENT == id) { + std::string value = (*it).get_value().c_str(); + if (flag == value[2]) { + if (value.size() > 3 && '(' == value[3]) { + std::size_t p = value.find_first_of(")"); + if (std::string::npos == p) { + std::cerr + << "testwave: missing closing parenthesis in '" + << flag << "()' directive" << std::endl; + return false; + } + std::string source = value.substr(4, p-4); + std::string result, error, hooks; + bool pp_result = preprocess_file(filename, source, + result, error, hooks, "", true); + if (!pp_result) { + std::cerr + << "testwave: preprocessing error in '" << flag + << "()' directive: " << error << std::endl; + return false; + } + + // include this text into the extracted information + // only if the result is not zero + using namespace std; // some system have atoi in namespace std + if (0 != atoi(result.c_str())) { + std::string thiscontent(value.substr(p+1)); + if (9 == debuglevel) { + std::cerr << "extract_special_information: extracted: " + << thiscontent << std::endl; + } + trim_whitespace(thiscontent); + content += thiscontent; + } + } + else { + std::string thiscontent(value.substr(3, value.size()-5)); + if (9 == debuglevel) { + std::cerr << "extract_special_information: extracted: " + << thiscontent << std::endl; + } + trim_whitespace(thiscontent); + content += thiscontent; + } + } + } + else if (T_CPPCOMMENT == id) { + std::string value = (*it).get_value().c_str(); + if (flag == value[2]) { + if (value.size() > 3 && '(' == value[3]) { + std::size_t p = value.find_first_of(")"); + if (std::string::npos == p) { + std::cerr + << "testwave: missing closing parenthesis in '" + << flag << "()' directive" << std::endl; + return false; + } + std::string source = value.substr(4, p-4); + std::string result, error, hooks; + bool pp_result = preprocess_file(filename, source, + result, error, hooks, "", true); + if (!pp_result) { + std::cerr + << "testwave: preprocessing error in '" << flag + << "()' directive: " << error << std::endl; + return false; + } + + // include this text into the extracted information + // only if the result is not zero + using namespace std; // some system have atoi in namespace std + if (0 != atoi(result.c_str())) { + std::string thiscontent(value.substr((' ' == value[p+1]) ? p+2 : p+1)); + if (9 == debuglevel) { + std::cerr << "extract_special_information: extracted: " + << thiscontent << std::endl; + } + trim_whitespace(thiscontent); + content += thiscontent; + } + } + else { + std::string thiscontent(value.substr((' ' == value[3]) ? 4 : 3)); + if (9 == debuglevel) { + std::cerr << "extract_special_information: extracted: " + << thiscontent; + } + trim_whitespace(content); + content += thiscontent; + } + } + } + } + } + catch (boost::wave::cpplexer::lexing_exception const &e) { + // some lexing error + std::cerr + << e.file_name() << "(" << e.line_no() << "): " + << e.description() << std::endl; + return false; + } + + if (9 == debuglevel) { + std::cerr << "extract_special_information: succeeded extracting special information ('" + << flag << "')" << std::endl; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Extract the expected output from the given input data +// +// The expected output has to be provided inside of special comments which +// start with a capital 'R'. All such comments are concatenated and returned +// through the parameter 'expected'. +// +/////////////////////////////////////////////////////////////////////////////// +inline bool +testwave_app::extract_expected_output(std::string const& filename, + std::string const& instr, std::string& expected, std::string& expectedhooks) +{ + return extract_special_information(filename, instr, 'R', expected) && + extract_special_information(filename, instr, 'H', expectedhooks); +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Extracts the required preprocessing options from the given input data and +// initialises the given Wave context object accordingly. +// We allow the same (applicable) options to be used as are valid for the wave +// driver executable. +// +/////////////////////////////////////////////////////////////////////////////// +template <typename Context> +bool +testwave_app::extract_options(std::string const& filename, + std::string const& instr, Context& ctx, bool single_line, + po::variables_map& vm) +{ + if (9 == debuglevel) { + std::cerr << "extract_options: extracting options" << std::endl; + } + +// extract the required information from the comments flagged by a +// capital 'O' + std::string options; + if (!extract_special_information(filename, instr, 'O', options)) + return false; + + try { + // parse the configuration information into a program_options_description + // object + cmd_line_utils::read_config_options(debuglevel, options, desc_options, vm); + initialise_options(ctx, vm, single_line); + } + catch (std::exception const &e) { + std::cerr << filename << ": exception caught: " << e.what() + << std::endl; + return false; + } + + if (9 == debuglevel) { + std::cerr << "extract_options: succeeded extracting options" + << std::endl; + } + + return true; +} + +template <typename Context> +bool +testwave_app::initialise_options(Context& ctx, po::variables_map const& vm, + bool single_line) +{ + if (9 == debuglevel) { + std::cerr << "initialise_options: initializing options" << std::endl; + } + + if (vm.count("skipped_token_hooks")) { + if (9 == debuglevel) { + std::cerr << "initialise_options: option: skipped_token_hooks" << std::endl; + } + ctx.get_hooks().set_skipped_token_hooks(true); + } + +// initialize the given context from the parsed options +#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 +// enable C99 mode, if appropriate (implies variadics) + if (vm.count("c99")) { + if (9 == debuglevel) { + std::cerr << "initialise_options: option: c99" << std::endl; + } + ctx.set_language( + boost::wave::language_support( + boost::wave::support_c99 + | boost::wave::support_option_emit_line_directives +#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0 + | boost::wave::support_option_include_guard_detection +#endif +#if BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES != 0 + | boost::wave::support_option_emit_pragma_directives +#endif + | boost::wave::support_option_insert_whitespace + )); + } + else if (vm.count("variadics")) { + // enable variadics and placemarkers, if appropriate + if (9 == debuglevel) { + std::cerr << "initialise_options: option: variadics" << std::endl; + } + ctx.set_language(boost::wave::enable_variadics(ctx.get_language())); + } +#endif // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 + +#if BOOST_WAVE_SUPPORT_CPP0X + if (vm.count("c++11")) { + if (9 == debuglevel) { + std::cerr << "initialise_options: option: c++11" << std::endl; + } + ctx.set_language( + boost::wave::language_support( + boost::wave::support_cpp0x + | boost::wave::support_option_convert_trigraphs + | boost::wave::support_option_long_long + | boost::wave::support_option_emit_line_directives +#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0 + | boost::wave::support_option_include_guard_detection +#endif +#if BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES != 0 + | boost::wave::support_option_emit_pragma_directives +#endif + | boost::wave::support_option_insert_whitespace + )); + } +#endif + +// enable long_long mode, if appropriate + if (vm.count("long_long")) { + if (9 == debuglevel) { + std::cerr << "initialise_options: option: long_long" << std::endl; + } + ctx.set_language(boost::wave::enable_long_long(ctx.get_language())); + } + +// enable preserving comments mode, if appropriate + if (vm.count("preserve")) { + if (9 == debuglevel) { + std::cerr << "initialise_options: option: preserve" << std::endl; + } + ctx.set_language( + boost::wave::enable_preserve_comments(ctx.get_language())); + } + +// disable automatic include guard detection + if (vm.count("noguard")) { + if (9 == debuglevel) { + std::cerr << "initialise_options: option: guard" << std::endl; + } + ctx.set_language( + boost::wave::enable_include_guard_detection(ctx.get_language(), false)); + } + +// enable trigraph conversion + if (9 == debuglevel) { + std::cerr << "initialise_options: option: convert_trigraphs" << std::endl; + } + ctx.set_language(boost::wave::enable_convert_trigraphs(ctx.get_language())); + +// enable single_line mode + if (single_line) { + if (9 == debuglevel) { + std::cerr << "initialise_options: option: single_line" << std::endl; + } + ctx.set_language(boost::wave::enable_single_line(ctx.get_language())); + ctx.set_language(boost::wave::enable_emit_line_directives(ctx.get_language(), false)); + } + +// add include directories to the system include search paths + if (vm.count("sysinclude")) { + std::vector<std::string> const& syspaths = + variables_map_as(vm["sysinclude"], (std::vector<std::string> *)NULL); + + std::vector<std::string>::const_iterator end = syspaths.end(); + for (std::vector<std::string>::const_iterator cit = syspaths.begin(); + cit != end; ++cit) + { + std::string full(*cit); + got_expected_result(ctx.get_current_filename(),"",full); + + if (9 == debuglevel) { + std::cerr << "initialise_options: option: -S" << *cit + << std::endl; + } + ctx.add_sysinclude_path(full.c_str()); + } + } + +// add include directories to the user include search paths + if (vm.count("include")) { + cmd_line_utils::include_paths const &ip = + variables_map_as(vm["include"], (cmd_line_utils::include_paths*)NULL); + std::vector<std::string>::const_iterator end = ip.paths.end(); + + for (std::vector<std::string>::const_iterator cit = ip.paths.begin(); + cit != end; ++cit) + { + std::string full(*cit); + got_expected_result(ctx.get_current_filename(),"",full); + + if (9 == debuglevel) { + std::cerr << "initialise_options: option: -I" << *cit + << std::endl; + } + ctx.add_include_path(full.c_str()); + } + + // if on the command line was given -I- , this has to be propagated + if (ip.seen_separator) { + if (9 == debuglevel) { + std::cerr << "initialise_options: option: -I-" << std::endl; + } + ctx.set_sysinclude_delimiter(); + } + + // add system include directories to the include path + std::vector<std::string>::const_iterator sysend = ip.syspaths.end(); + for (std::vector<std::string>::const_iterator syscit = ip.syspaths.begin(); + syscit != sysend; ++syscit) + { + if (9 == debuglevel) { + std::cerr << "initialise_options: option: -S" << *syscit + << std::endl; + } + ctx.add_sysinclude_path((*syscit).c_str()); + } + } + +// add additional defined macros + if (vm.count("define")) { + std::vector<std::string> const ¯os = + variables_map_as(vm["define"], (std::vector<std::string>*)NULL); + std::vector<std::string>::const_iterator end = macros.end(); + for (std::vector<std::string>::const_iterator cit = macros.begin(); + cit != end; ++cit) + { + if (9 == debuglevel) { + std::cerr << "initialise_options: option: -D" << *cit + << std::endl; + } + ctx.add_macro_definition(*cit, true); + } + } + +// add additional predefined macros + if (vm.count("predefine")) { + std::vector<std::string> const &predefmacros = + variables_map_as(vm["predefine"], (std::vector<std::string>*)NULL); + std::vector<std::string>::const_iterator end = predefmacros.end(); + for (std::vector<std::string>::const_iterator cit = predefmacros.begin(); + cit != end; ++cit) + { + if (9 == debuglevel) { + std::cerr << "initialise_options: option: -P" << *cit + << std::endl; + } + ctx.add_macro_definition(*cit, true); + } + } + +// undefine specified macros + if (vm.count("undefine")) { + std::vector<std::string> const &undefmacros = + variables_map_as(vm["undefine"], (std::vector<std::string>*)NULL); + std::vector<std::string>::const_iterator end = undefmacros.end(); + for (std::vector<std::string>::const_iterator cit = undefmacros.begin(); + cit != end; ++cit) + { + if (9 == debuglevel) { + std::cerr << "initialise_options: option: -U" << *cit + << std::endl; + } + ctx.remove_macro_definition(*cit); + } + } + +// maximal include nesting depth + if (vm.count("nesting")) { + int max_depth = variables_map_as(vm["nesting"], (int*)NULL); + if (max_depth < 1 || max_depth > 100000) { + std::cerr << "testwave: bogus maximal include nesting depth: " + << max_depth << std::endl; + return false; + } + else if (9 == debuglevel) { + std::cerr << "initialise_options: option: -n" << max_depth + << std::endl; + } + ctx.set_max_include_nesting_depth(max_depth); + } + + if (9 == debuglevel) { + std::cerr << "initialise_options: succeeded to initialize options" + << std::endl; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// construct a SIZEOF macro definition string and predefine this macro +template <typename Context> +inline bool +testwave_app::add_sizeof_definition(Context& ctx, char const *name, int value) +{ + BOOST_WAVETEST_OSSTREAM strm; + strm << "__TESTWAVE_SIZEOF_" << name << "__=" << value; + + std::string macro(BOOST_WAVETEST_GETSTRING(strm)); + if (!ctx.add_macro_definition(macro, true)) { + std::cerr << "testwave: failed to predefine macro: " << macro + << std::endl; + return false; + } + else if (9 == debuglevel) { + std::cerr << "add_sizeof_definition: predefined macro: " << macro + << std::endl; + } + return true; +} + +// construct a MIN macro definition string and predefine this macro +template <typename T, typename Context> +inline bool +testwave_app::add_min_definition(Context& ctx, char const *name) +{ + BOOST_WAVETEST_OSSTREAM strm; + if (!std::numeric_limits<T>::is_signed) { + strm << "__TESTWAVE_" << name << "_MIN__=" + << "0x" << std::hex + << (std::numeric_limits<T>::min)() << "U"; + } + else { + strm << "__TESTWAVE_" << name << "_MIN__=( " + << (std::numeric_limits<T>::min)()+1 << "-1)"; + } + + std::string macro(BOOST_WAVETEST_GETSTRING(strm)); + if (!ctx.add_macro_definition(macro, true)) { + std::cerr << "testwave: failed to predefine macro: " << macro + << std::endl; + return false; + } + else if (9 == debuglevel) { + std::cerr << "add_min_definition: predefined macro: " << macro + << std::endl; + } + return true; +} + +// construct a MAX macro definition string and predefine this macro +template <typename T, typename Context> +inline bool +testwave_app::add_max_definition(Context& ctx, char const *name) +{ + BOOST_WAVETEST_OSSTREAM strm; + if (!std::numeric_limits<T>::is_signed) { + strm << "__TESTWAVE_" << name << "_MAX__=" + << "0x" << std::hex + << (std::numeric_limits<T>::max)() << "U"; + } + else { + strm << "__TESTWAVE_" << name << "_MAX__=" + << (std::numeric_limits<T>::max)(); + } + + std::string macro(BOOST_WAVETEST_GETSTRING(strm)); + if (!ctx.add_macro_definition(macro, true)) { + std::cerr << "testwave: failed to predefine macro: " << macro + << std::endl; + return false; + } + else if (9 == debuglevel) { + std::cerr << "add_max_definition: predefined macro: " << macro + << std::endl; + } + return true; +} + +// Predefine __TESTWAVE_HAS_STRICT_LEXER__ +template <typename Context> +inline bool +testwave_app::add_strict_lexer_definition(Context& ctx) +{ + std::string macro("__TESTWAVE_HAS_STRICT_LEXER__=1"); + if (!ctx.add_macro_definition(macro, true)) { + std::cerr << "testwave: failed to predefine macro: " << macro + << std::endl; + return false; + } + else if (9 == debuglevel) { + std::cerr << "add_strict_lexer_definition: predefined macro: " << macro + << std::endl; + } + return true; +} + +#if BOOST_WAVE_SUPPORT_MS_EXTENSIONS +// Predefine __TESTWAVE_SUPPORT_MS_EXTENSIONS__ +template <typename Context> +inline bool +testwave_app::add_support_ms_extensions_definition(Context& ctx) +{ + std::string macro("__TESTWAVE_SUPPORT_MS_EXTENSIONS__=1"); + if (!ctx.add_macro_definition(macro, true)) { + std::cerr << "testwave: failed to predefine macro: " << macro + << std::endl; + return false; + } + else if (9 == debuglevel) { + std::cerr << "add_support_ms_extensions_definition: predefined macro: " + << macro + << std::endl; + } + return true; +} +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// Add special predefined macros to the context object. +// +// This adds a lot of macros to the test environment, which allows to adjust +// the test cases for different platforms. +// +/////////////////////////////////////////////////////////////////////////////// +template <typename Context> +bool +testwave_app::add_predefined_macros(Context& ctx) +{ + // add the __TESTWAVE_SIZEOF_<type>__ macros + if (!add_sizeof_definition(ctx, "CHAR", sizeof(char)) || + !add_sizeof_definition(ctx, "SHORT", sizeof(short)) || + !add_sizeof_definition(ctx, "INT", sizeof(int)) || +#if defined(BOOST_HAS_LONG_LONG) + !add_sizeof_definition(ctx, "LONGLONG", sizeof(boost::long_long_type)) || +#endif + !add_sizeof_definition(ctx, "LONG", sizeof(long))) + { + std::cerr << "testwave: failed to add a predefined macro (SIZEOF)." + << std::endl; + return false; + } + + // add the __TESTWAVE_<type>_MIN__ macros + if (/*!add_min_definition<char>(ctx, "CHAR") ||*/ + /*!add_min_definition<unsigned char>(ctx, "UCHAR") ||*/ + !add_min_definition<short>(ctx, "SHORT") || + !add_min_definition<unsigned short>(ctx, "USHORT") || + !add_min_definition<int>(ctx, "INT") || + !add_min_definition<unsigned int>(ctx, "UINT") || +#if defined(BOOST_HAS_LONG_LONG) + !add_min_definition<boost::long_long_type>(ctx, "LONGLONG") || + !add_min_definition<boost::ulong_long_type>(ctx, "ULONGLONG") || +#endif + !add_min_definition<long>(ctx, "LONG") || + !add_min_definition<unsigned long>(ctx, "ULONG")) + { + std::cerr << "testwave: failed to add a predefined macro (MIN)." + << std::endl; + } + + // add the __TESTWAVE_<type>_MAX__ macros + if (/*!add_max_definition<char>(ctx, "CHAR") ||*/ + /*!add_max_definition<unsigned char>(ctx, "UCHAR") ||*/ + !add_max_definition<short>(ctx, "SHORT") || + !add_max_definition<unsigned short>(ctx, "USHORT") || + !add_max_definition<int>(ctx, "INT") || + !add_max_definition<unsigned int>(ctx, "UINT") || +#if defined(BOOST_HAS_LONG_LONG) + !add_max_definition<boost::long_long_type>(ctx, "LONGLONG") || + !add_max_definition<boost::ulong_long_type>(ctx, "ULONGLONG") || +#endif + !add_max_definition<long>(ctx, "LONG") || + !add_max_definition<unsigned long>(ctx, "ULONG")) + { + std::cerr << "testwave: failed to add a predefined macro (MAX)." + << std::endl; + } + +#if BOOST_WAVE_SUPPORT_MS_EXTENSIONS +// Predefine __TESTWAVE_SUPPORT_MS_EXTENSIONS__ + if (!add_support_ms_extensions_definition(ctx)) + { + std::cerr << "testwave: failed to add a predefined macro " + "(__TESTWAVE_SUPPORT_MS_EXTENSIONS__)." + << std::endl; + } +#endif + +#if BOOST_WAVE_USE_STRICT_LEXER != 0 + return add_strict_lexer_definition(ctx); +#else + return true; +#endif +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Preprocess the given input data and return the generated output through +// the parameter 'result'. +// +/////////////////////////////////////////////////////////////////////////////// +bool +testwave_app::preprocess_file(std::string filename, std::string const& instr, + std::string& result, std::string& error, std::string& hooks, + std::string const& expected_cfg_macro, bool single_line) +{ +// create the wave::context object and initialize it from the file to +// preprocess (may contain options inside of special comments) + typedef boost::wave::cpplexer::lex_token<> token_type; + typedef boost::wave::cpplexer::lex_iterator<token_type> lexer_type; + typedef boost::wave::context< + std::string::const_iterator, lexer_type, + boost::wave::iteration_context_policies::load_file_to_string, + collect_hooks_information<token_type> > + context_type; + + if (9 == debuglevel) { + std::cerr << "preprocess_file: preprocessing input file: " << filename + << std::endl; + } + + try { + // create preprocessing context + context_type ctx(instr.begin(), instr.end(), filename.c_str(), + collect_hooks_information<token_type>(hooks)); + + // initialize the context from the options given on the command line + if (!initialise_options(ctx, global_vm, single_line)) + return false; + + // extract the options from the input data and initialize the context + boost::program_options::variables_map local_vm; + if (!extract_options(filename, instr, ctx, single_line, local_vm)) + return false; + + // add special predefined macros + if (!add_predefined_macros(ctx)) + return false; + + if (!expected_cfg_macro.empty() && + !ctx.is_defined_macro(expected_cfg_macro)) + { + // skip this test as it is for a disabled configuration + return false; + } + + // preprocess the input, loop over all generated tokens collecting the + // generated text + context_type::iterator_type it = ctx.begin(); + context_type::iterator_type end = ctx.end(); + + if (local_vm.count("forceinclude")) { + // add the filenames to force as include files in _reverse_ order + // the second parameter 'is_last' of the force_include function should + // be set to true for the last (first given) file. + std::vector<std::string> const &force = + local_vm["forceinclude"].as<std::vector<std::string> >(); + std::vector<std::string>::const_reverse_iterator rend = force.rend(); + for (std::vector<std::string>::const_reverse_iterator cit = force.rbegin(); + cit != rend; /**/) + { + std::string forceinclude(*cit); + if (9 == debuglevel) { + std::cerr << "preprocess_file: option: forceinclude (" + << forceinclude << ")" << std::endl; + } + it.force_include(forceinclude.c_str(), ++cit == rend); + } + } + + // perform actual preprocessing + for (/**/; it != end; ++it) + { + using namespace boost::wave; + + if (T_PP_LINE == token_id(*it)) { + // special handling of the whole #line directive is required to + // allow correct file name matching + if (!handle_line_directive(it, end, result)) + return false; // unexpected eof + } + else { + // add the value of the current token + result = result + (*it).get_value().c_str(); + } + } + error.clear(); + } + catch (boost::wave::cpplexer::lexing_exception const& e) { + // some lexer error + BOOST_WAVETEST_OSSTREAM strm; + std::string filename = e.file_name(); + strm + << handle_filepath(filename) << "(" << e.line_no() << "): " + << e.description() << std::endl; + + error = BOOST_WAVETEST_GETSTRING(strm); + return false; + } + catch (boost::wave::cpp_exception const& e) { + // some preprocessing error + BOOST_WAVETEST_OSSTREAM strm; + std::string filename = e.file_name(); + strm + << handle_filepath(filename) << "(" << e.line_no() << "): " + << e.description() << std::endl; + + error = BOOST_WAVETEST_GETSTRING(strm); + return false; + } + + if (9 == debuglevel) { + std::cerr << "preprocess_file: succeeded to preprocess input file: " + << filename << std::endl; + } + + return true; +} + diff --git a/src/boost/libs/wave/test/testwave/testwave_app.hpp b/src/boost/libs/wave/test/testwave/testwave_app.hpp new file mode 100644 index 000000000..755b6a103 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testwave_app.hpp @@ -0,0 +1,135 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2013 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#if !defined(BOOST_WAVE_LIBS_WAVE_TEST_TESTWAVE_APP_HPP) +#define BOOST_WAVE_LIBS_WAVE_TEST_TESTWAVE_APP_HPP + +#include <string> +#include <vector> + +// include boost +#include <boost/config.hpp> + +#include "cmd_line_utils.hpp" + +/////////////////////////////////////////////////////////////////////////////// +class testwave_app +{ +public: + testwave_app(boost::program_options::variables_map const& vm); + + // Test the given file (i.e. preprocess the file and compare the result + // against the embedded 'R' comments, if an error occurs compare the error + // message against the given 'E' comments). + bool test_a_file(std::string filename); + + // print the current version of this program + int print_version(); + + // print the copyright statement + int print_copyright(); + + // access the common options used for the command line and the config + // options inside the test files + boost::program_options::options_description const& common_options() const + { + return desc_options; + } + + void set_debuglevel(int debuglevel_) + { + debuglevel = debuglevel_; + } + int get_debuglevel() const + { + return debuglevel; + } + +protected: + // Read the given file into a string + bool read_file(std::string const& filename, std::string& instr); + + // Extract special information from comments marked with the given letter + bool extract_special_information(std::string const& filename, + std::string const& instr, char flag, std::string& content); + + // Extract the expected output and expected hooks information from the + // given input data. + // The expected output has to be provided inside of special comments which + // start with a capital 'R' ('H' for the hooks information). All such + // comments are concatenated and returned through the parameter 'expected' + // ('expectedhooks' for hooks information). + bool extract_expected_output(std::string const& filename, + std::string const& instr, std::string& expected, + std::string& expectedhooks); + + // Extracts the required preprocessing options from the given input data + // and initializes the given Wave context object accordingly. + // We allow the same (applicable) options to be used as are valid for the + // wave driver executable. + template <typename Context> + bool extract_options(std::string const& filename, + std::string const& instr, Context& ctx, bool single_line, + boost::program_options::variables_map& vm); + + // transfers the options collected in the vm parameter into the given + // context + template <typename Context> + bool initialise_options(Context& ctx, + boost::program_options::variables_map const& vm, bool single_line); + + // Preprocess the given input data and return the generated output through + // the parameter 'result'. + bool preprocess_file(std::string filename, std::string const& instr, + std::string& result, std::string& error, std::string& hooks, + std::string const& expected_cfg_macro, bool single_line = false); + + // Add special predefined macros to the context object + template <typename Context> + bool add_predefined_macros(Context& ctx); + + // This function compares the real result and the expected one but first + // replaces all occurrences in the expected result of + // $E: to the result of preprocessing the given expression + // $F: to the passed full filepath + // $P: to the full path + // $R: to the relative path + // $V: to the current Boost version number + bool got_expected_result(std::string const& filename, + std::string const& result, std::string& expected); + + // construct a SIZEOF macro definition string and predefine this macro + template <typename Context> + bool add_sizeof_definition(Context& ctx, char const *name, int value); + + // construct a MIN macro definition string and predefine this macro + template <typename T, typename Context> + bool add_min_definition(Context& ctx, char const *name); + + // construct a MAX macro definition string and predefine this macro + template <typename T, typename Context> + bool add_max_definition(Context& ctx, char const *name); + + // Predefine __TESTWAVE_HAS_STRICT_LEXER__ + template <typename Context> + bool add_strict_lexer_definition(Context& ctx); + +#if BOOST_WAVE_SUPPORT_MS_EXTENSIONS + // Predefine __TESTWAVE_SUPPORT_MS_EXTENSIONS__ + template <typename Context> + bool add_support_ms_extensions_definition(Context& ctx); +#endif + +private: + int debuglevel; + boost::program_options::options_description desc_options; + boost::program_options::variables_map const& global_vm; +}; + +#endif // !defined(BOOST_WAVE_LIBS_WAVE_TEST_TESTWAVE_APP_HPP) diff --git a/src/boost/libs/wave/test/testwave/testwave_app_dll.cpp b/src/boost/libs/wave/test/testwave/testwave_app_dll.cpp new file mode 100644 index 000000000..ccc194831 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testwave_app_dll.cpp @@ -0,0 +1,13 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// This file is necessary only because Boost.Build V2 isn't able to handle +// several testcases using the same source files. + +#include "testwave_app.cpp" diff --git a/src/boost/libs/wave/test/testwave/testwave_dll.cpp b/src/boost/libs/wave/test/testwave/testwave_dll.cpp new file mode 100644 index 000000000..ac671b392 --- /dev/null +++ b/src/boost/libs/wave/test/testwave/testwave_dll.cpp @@ -0,0 +1,13 @@ +/*============================================================================= + Boost.Wave: A Standard compliant C++ preprocessor library + http://www.boost.org/ + + Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost + Software License, Version 1.0. (See accompanying file + LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +// This file is necessary only because Boost.Build V2 isn't able to handle +// several testcases using the same source files. + +#include "testwave.cpp" |