From 981a445319f1acfe1194e61b320a9218a8a7a481 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sat, 8 May 2010 17:10:16 +0000 Subject: Implemented PUGIXML_DEPRECATED for GCC and MSVC7+ git-svn-id: http://pugixml.googlecode.com/svn/trunk@387 99668b35-9821-0410-8761-19e4c4f06640 --- Jamrules.jam | 1 + src/pugixml.hpp | 25 +++++++++++++++++++------ tests/test_deprecated.cpp | 4 ++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Jamrules.jam b/Jamrules.jam index 02bbe6f..e362eac 100644 --- a/Jamrules.jam +++ b/Jamrules.jam @@ -12,6 +12,7 @@ if ( $(toolset:I=^mingw) || $(toolset) = "gcc" ) } CCFLAGS += -D$(defines) ; + CCFLAGS += -Wno-deprecated-declarations ; if ( $(configuration) = "debug" ) { diff --git a/src/pugixml.hpp b/src/pugixml.hpp index 86798e3..6e3fc99 100644 --- a/src/pugixml.hpp +++ b/src/pugixml.hpp @@ -38,7 +38,13 @@ namespace std // Macro for deprecated features #ifndef PUGIXML_DEPRECATED -# define PUGIXML_DEPRECATED(message) +# if defined(__GNUC__) +# define PUGIXML_DEPRECATED __attribute__((deprecated)) +# elif defined(_MSC_VER) && _MSC_VER >= 1300 +# define PUGIXML_DEPRECATED __declspec(deprecated) +# else +# define PUGIXML_DEPRECATED +# endif #endif // No XPath without STL @@ -285,7 +291,8 @@ namespace pugi */ const unsigned int format_write_bom = 0x02; - PUGIXML_DEPRECATED("Use format_write_bom instead") const unsigned int format_write_bom_utf8 = format_write_bom; + // \deprecated This constant is deprecated and will be removed in future versions; use format_write_bom instead + PUGIXML_DEPRECATED const unsigned int format_write_bom_utf8 = format_write_bom; /** * If this flag is on, no indentation is performed and no line breaks are written to output file. @@ -1753,7 +1760,7 @@ namespace pugi * Struct used to distinguish parsing with ownership transfer from parsing without it. * \see xml_document::parse */ - PUGIXML_DEPRECATED("Use xml_document::load_buffer_inplace_own instead") struct transfer_ownership_tag {}; + struct transfer_ownership_tag {}; /** * Parsing status enumeration, returned as part of xml_parse_result struct @@ -1874,8 +1881,10 @@ namespace pugi * \param xmlstr - readwrite string with xml data * \param options - parsing options * \return parsing result + * + * \deprecated This function is deprecated and will be removed in future versions; use xml_document::load_buffer_inplace instead */ - PUGIXML_DEPRECATED("Use xml_document::load_buffer_inplace instead") xml_parse_result parse(char* xmlstr, unsigned int options = parse_default); + PUGIXML_DEPRECATED xml_parse_result parse(char* xmlstr, unsigned int options = parse_default); /** * Parse the given XML string in-situ (gains ownership). @@ -1886,8 +1895,10 @@ namespace pugi * \param xmlstr - readwrite string with xml data * \param options - parsing options * \return parsing result + * + * \deprecated This function is deprecated and will be removed in future versions; use xml_document::load_buffer_inplace_own instead */ - PUGIXML_DEPRECATED("Use xml_document::load_buffer_inplace_own instead") xml_parse_result parse(const transfer_ownership_tag&, char* xmlstr, unsigned int options = parse_default); + PUGIXML_DEPRECATED xml_parse_result parse(const transfer_ownership_tag&, char* xmlstr, unsigned int options = parse_default); /** * Load document from file @@ -2234,8 +2245,10 @@ namespace pugi * * \param str - input UTF8 string * \return output wide string string + * + * \deprecated This function is deprecated and will be removed in future versions; use as_wide instead */ - PUGIXML_DEPRECATED("Use as_wide instead") std::basic_string, std::allocator > PUGIXML_FUNCTION as_utf16(const char* str); + PUGIXML_DEPRECATED std::basic_string, std::allocator > PUGIXML_FUNCTION as_utf16(const char* str); /** * Convert utf8 to wide string diff --git a/tests/test_deprecated.cpp b/tests/test_deprecated.cpp index e251876..f401fbd 100644 --- a/tests/test_deprecated.cpp +++ b/tests/test_deprecated.cpp @@ -6,6 +6,10 @@ #include "writer_string.hpp" +#ifdef _MSC_VER +# pragma warning(disable: 4996) +#endif + // format_write_bom_utf8 - it's now format_write_bom! TEST_XML(document_save_bom_utf8, "") { -- cgit v1.2.3