From f913683002a79f19810c2e41feda0f413fa0cf6d Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 15 May 2001 11:00:01 +0000 Subject: [PATCH] Fixed some issues with calling conventions for Borland/Microsoft compilers [SVN r10114] --- appendix.htm | 3 ++- changes.txt | 2 ++ include/boost/cregex.hpp | 8 +------- include/boost/regex.hpp | 8 +------- include/boost/regex/detail/fileiter.hpp | 8 +------- include/boost/regex/detail/regex_compile.hpp | 12 +++--------- include/boost/regex/detail/regex_config.hpp | 17 ++++++----------- include/boost/regex/detail/regex_cstring.hpp | 8 +------- include/boost/regex/detail/regex_format.hpp | 8 +------- include/boost/regex/detail/regex_kmp.hpp | 8 +------- include/boost/regex/detail/regex_match.hpp | 8 +------- include/boost/regex/detail/regex_raw_buffer.hpp | 8 +------- include/boost/regex/detail/regex_split.hpp | 8 +------- include/boost/regex/detail/regex_stack.hpp | 8 +------- include/boost/regex/detail/regex_synch.hpp | 8 +------- include/boost/regex/pattern_except.hpp | 8 +------- include/boost/regex/regex_traits.hpp | 8 +------- test/regress/bcb5.mak | 3 ++- test/regress/tests.cpp | 6 +++++- 19 files changed, 33 insertions(+), 114 deletions(-) diff --git a/appendix.htm b/appendix.htm index beff497e..36e02eb1 100644 --- a/appendix.htm +++ b/appendix.htm @@ -1200,8 +1200,9 @@ It is provided "as is" without express or implied warranty.


Further Information (Contacts and Acknowledgements)

The author can be contacted at John_Maddock@compuserve.com, the home page for this library is at http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm, and the official boost version can be obtained from www.boost.org/libraries.htm.

-

I am indebted to Robert Sedgewick's "Algorithms in C++" for forcing me to think about algorithms and their performance, and to the folks at boost for forcing me to think, period. The following people have all contributed useful comments or fixes: Dave Abrahams, Mike Allison, Edan Ayal, Jayashree Balasubramanian, Beman Dawes, Paul Baxter, David Dennerline, Edward Diener, Robert Dunn, , Fabio Forno, Rob Gillen, Chris Hecker, Nick Hodapp, Jesse Jones, Jan Hermelink, Max Leung, Wei-hao Lin, Jens Maurer, Heiko Schmidt, Scobie Smith, Hervé Poirier, Marc Recht, Alexey Voinov, Jerry Waldorf, Rob Ward, Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to the manuals supplied with the Henry Spencer, Perl and GNU regular expression libraries - wherever possible I have tried to maintain compatibility with these libraries and with the POSIX standard - the code however is entirely my own, including any bugs! I can absolutely guarantee that I will not fix any bugs I don't know about, so if you have any comments or spot any bugs, please get in touch.

+

I am indebted to Robert Sedgewick's "Algorithms in C++" for forcing me to think about algorithms and their performance, and to the folks at boost for forcing me to think, period. The following people have all contributed useful comments or fixes: Dave Abrahams, Mike Allison, Edan Ayal, Jayashree Balasubramanian, Beman Dawes, Paul Baxter, David Dennerline, Edward Diener, Robert Dunn, , Fabio Forno, Tobias Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan Hermelink, Max Leung, Wei-hao Lin, Jens Maurer, Heiko Schmidt, Scobie Smith, Alexander Sokolovsky, Hervé Poirier, Marc Recht, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward, Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to the manuals supplied with the Henry Spencer, Perl and GNU regular expression libraries - wherever possible I have tried to maintain compatibility with these libraries and with the POSIX standard - the code however is entirely my own, including any bugs! I can absolutely guarantee that I will not fix any bugs I don't know about, so if you have any comments or spot any bugs, please get in touch.

Useful further information can be found at:

+

A short tutorial on regular expressions can be found here.

The Open Unix Specification contains a wealth of useful material, including the regular expression syntax, and specifications for <regex.h> and <nl_types.h>.

The Pattern Matching Pointers site is a "must visit" resource for anyone interested in pattern matching.

Glimpse and Agrep, use a simplified regular expression syntax to achieve faster search times.

diff --git a/changes.txt b/changes.txt index b04d18ac..7beaa70e 100644 --- a/changes.txt +++ b/changes.txt @@ -1,6 +1,7 @@ Version 311: FIXED: Support for STLPort 4.1b6. FIXED: Library calling convention for VC6 debug builds. +FIXED: Borland compiler support when using non-default calling convention. CHANGED: Reorganised and simplified config setup. Version 310: @@ -257,5 +258,6 @@ BUG: character sets don't function correctly when regbase::char_classes + diff --git a/include/boost/cregex.hpp b/include/boost/cregex.hpp index b549d799..6f46e46d 100644 --- a/include/boost/cregex.hpp +++ b/include/boost/cregex.hpp @@ -27,11 +27,7 @@ #include #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve - #endif + #pragma option push -a4 -b -Ve -pc #endif /* include these defs only for POSIX compatablity */ @@ -287,9 +283,7 @@ public: }; #ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 #pragma option pop - #endif #endif } // namespace boost diff --git a/include/boost/regex.hpp b/include/boost/regex.hpp index 2221a1dd..500bce3f 100644 --- a/include/boost/regex.hpp +++ b/include/boost/regex.hpp @@ -55,11 +55,7 @@ namespace boost{ #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve - #endif + #pragma option push -a4 -b -Ve -pc #endif namespace re_detail{ @@ -1464,9 +1460,7 @@ iterator BOOST_RE_CALL re_is_set_member(iterator next, } // namepsace re_detail #ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 #pragma option pop - #endif #endif } // namespace boost diff --git a/include/boost/regex/detail/fileiter.hpp b/include/boost/regex/detail/fileiter.hpp index 5da3cbed..b3fa6c2f 100644 --- a/include/boost/regex/detail/fileiter.hpp +++ b/include/boost/regex/detail/fileiter.hpp @@ -79,11 +79,7 @@ namespace boost{ namespace re_detail{ #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve - #endif + #pragma option push -a4 -b -Ve -pc #endif struct _fi_find_data @@ -422,9 +418,7 @@ inline bool operator < (const directory_iterator&, const directory_iterator&) } #ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 #pragma option pop - #endif #endif diff --git a/include/boost/regex/detail/regex_compile.hpp b/include/boost/regex/detail/regex_compile.hpp index ad45ab54..e8455e7b 100644 --- a/include/boost/regex/detail/regex_compile.hpp +++ b/include/boost/regex/detail/regex_compile.hpp @@ -25,15 +25,11 @@ #define BOOST_REGEX_COMPILE_HPP namespace boost{ +#ifdef __BORLANDC__ + #pragma option push -a4 -b -Ve -pc +#endif namespace re_detail{ -#ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve - #endif -#endif template struct kmp_translator @@ -2035,9 +2031,7 @@ void BOOST_RE_CALL reg_expression::fail(unsigned int e #endif #ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 #pragma option pop - #endif #endif } // namespace boost diff --git a/include/boost/regex/detail/regex_config.hpp b/include/boost/regex/detail/regex_config.hpp index 69b591d9..250fc3c9 100644 --- a/include/boost/regex/detail/regex_config.hpp +++ b/include/boost/regex/detail/regex_config.hpp @@ -249,7 +249,7 @@ full list of macros and their usage. // for now we'll always define these // unless we know that the platform can cope // with wide character strings: - #if !defined(linux) + #if !defined(linux) || (defined(__GLIBCPP__) && !defined(_GLIBCPP_USE_WCHAR_T)) #define BOOST_RE_NO_WCTYPE_H #define BOOST_RE_NO_WCSTRING #endif @@ -580,11 +580,7 @@ namespace boost{ namespace re_detail{ #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b - #endif + #pragma option push -a4 -b -Ve -pc #endif // add our destroy functions: @@ -735,11 +731,6 @@ inline bool BOOST_RE_CALL boolify(I val) #define BOOST_RE_MAKE_BOOL(x) x #endif -#ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 - #pragma option pop - #endif -#endif template struct rebind_allocator @@ -760,6 +751,9 @@ std::ptrdiff_t distance(const T& x, const T& y) using std::distance; #endif +#ifdef __BORLANDC__ + #pragma option pop +#endif } // namespace re_detail } // namespace boost @@ -1101,5 +1095,6 @@ namespace std{ + diff --git a/include/boost/regex/detail/regex_cstring.hpp b/include/boost/regex/detail/regex_cstring.hpp index 0307a5b0..7525db53 100644 --- a/include/boost/regex/detail/regex_cstring.hpp +++ b/include/boost/regex/detail/regex_cstring.hpp @@ -35,11 +35,7 @@ namespace boost{ namespace re_detail{ #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve - #endif + #pragma option push -a4 -b -Ve -pc #endif // @@ -124,9 +120,7 @@ inline void BOOST_RE_CALL re_strfree(charT* p) } #ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 #pragma option pop - #endif #endif } // namespace re_detail diff --git a/include/boost/regex/detail/regex_format.hpp b/include/boost/regex/detail/regex_format.hpp index 453853b4..1dfff46a 100644 --- a/include/boost/regex/detail/regex_format.hpp +++ b/include/boost/regex/detail/regex_format.hpp @@ -39,11 +39,7 @@ enum format_flags_t{ namespace re_detail{ #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve -w-8037 - #endif + #pragma option push -a4 -b -Ve -pc #endif template @@ -569,9 +565,7 @@ std::basic_string regex_merge(const std::basic_string& s, } #ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 #pragma option pop - #endif #endif } // namespace boost diff --git a/include/boost/regex/detail/regex_kmp.hpp b/include/boost/regex/detail/regex_kmp.hpp index 11ac3b02..500f58ac 100644 --- a/include/boost/regex/detail/regex_kmp.hpp +++ b/include/boost/regex/detail/regex_kmp.hpp @@ -34,11 +34,7 @@ namespace boost{ namespace re_detail{ #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve - #endif + #pragma option push -a4 -b -Ve -pc #endif template @@ -102,9 +98,7 @@ kmp_info* kmp_compile(iterator first, iterator last, charT, Trans transla } #ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 #pragma option pop - #endif #endif } // namepsace re_detail diff --git a/include/boost/regex/detail/regex_match.hpp b/include/boost/regex/detail/regex_match.hpp index aceb1ac3..63af6bc7 100644 --- a/include/boost/regex/detail/regex_match.hpp +++ b/include/boost/regex/detail/regex_match.hpp @@ -31,11 +31,7 @@ namespace boost{ namespace re_detail{ #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve - #endif + #pragma option push -a4 -b -Ve -pc #endif template @@ -1811,9 +1807,7 @@ inline unsigned int regex_grep(bool (*foo)(const match_results 0x520 #pragma option pop - #endif #endif } // namespace boost diff --git a/include/boost/regex/detail/regex_raw_buffer.hpp b/include/boost/regex/detail/regex_raw_buffer.hpp index 8f504eeb..6818eb2a 100644 --- a/include/boost/regex/detail/regex_raw_buffer.hpp +++ b/include/boost/regex/detail/regex_raw_buffer.hpp @@ -33,11 +33,7 @@ namespace boost{ namespace re_detail{ #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve - #endif + #pragma option push -a4 -b -Ve -pc #endif struct empty_padding{}; @@ -236,9 +232,7 @@ void* BOOST_RE_CALL raw_storage::insert(size_type pos, size_type n) } #ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 #pragma option pop - #endif #endif } // namespace re_detail diff --git a/include/boost/regex/detail/regex_split.hpp b/include/boost/regex/detail/regex_split.hpp index 09543923..eb699a28 100644 --- a/include/boost/regex/detail/regex_split.hpp +++ b/include/boost/regex/detail/regex_split.hpp @@ -28,11 +28,7 @@ namespace boost{ #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve - #endif + #pragma option push -a4 -b -Ve -pc #endif namespace re_detail{ @@ -145,9 +141,7 @@ inline std::size_t regex_split(OutputIterator out, } #ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 #pragma option pop - #endif #endif } // namespace boost diff --git a/include/boost/regex/detail/regex_stack.hpp b/include/boost/regex/detail/regex_stack.hpp index 08bccd36..e8dbef07 100644 --- a/include/boost/regex/detail/regex_stack.hpp +++ b/include/boost/regex/detail/regex_stack.hpp @@ -36,11 +36,7 @@ namespace boost{ namespace re_detail{ #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve - #endif + #pragma option push -a4 -b -Ve -pc #endif // @@ -211,9 +207,7 @@ jstack::~jstack() } #ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 #pragma option pop - #endif #endif } // namespace re_detail diff --git a/include/boost/regex/detail/regex_synch.hpp b/include/boost/regex/detail/regex_synch.hpp index b9a2e767..d5af6a24 100644 --- a/include/boost/regex/detail/regex_synch.hpp +++ b/include/boost/regex/detail/regex_synch.hpp @@ -42,11 +42,7 @@ namespace boost{ namespace re_detail{ #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve - #endif + #pragma option push -a4 -b -Ve -pc #endif void BOOST_RE_CALL re_init_threads(); @@ -167,9 +163,7 @@ BOOST_RE_IX_DECL extern unsigned int re_lock_count; #endif // BOOST_RE_THREADS #ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 #pragma option pop - #endif #endif } // namespace re_detail diff --git a/include/boost/regex/pattern_except.hpp b/include/boost/regex/pattern_except.hpp index 8018e3e7..90c65494 100644 --- a/include/boost/regex/pattern_except.hpp +++ b/include/boost/regex/pattern_except.hpp @@ -28,11 +28,7 @@ namespace boost{ #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve - #endif + #pragma option push -a4 -b -Ve -pc #endif class BOOST_RE_IX_DECL bad_pattern : public std::runtime_error @@ -51,9 +47,7 @@ public: #ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 #pragma option pop - #endif #endif } // namespace boost diff --git a/include/boost/regex/regex_traits.hpp b/include/boost/regex/regex_traits.hpp index 34721d17..254817de 100644 --- a/include/boost/regex/regex_traits.hpp +++ b/include/boost/regex/regex_traits.hpp @@ -29,11 +29,7 @@ namespace boost{ #ifdef __BORLANDC__ - #if __BORLANDC__ == 0x530 - #pragma option push -a4 -b -Ve - #elif __BORLANDC__ > 0x530 - #pragma option push -a8 -b -Ve - #endif + #pragma option push -a4 -b -Ve -pc #endif template @@ -786,9 +782,7 @@ class regex_traits : public cpp_regex_traits #endif #ifdef __BORLANDC__ - #if __BORLANDC__ > 0x520 #pragma option pop - #endif #endif } // namespace boost diff --git a/test/regress/bcb5.mak b/test/regress/bcb5.mak index 5b98b060..dfe5a264 100644 --- a/test/regress/bcb5.mak +++ b/test/regress/bcb5.mak @@ -14,7 +14,7 @@ TLINK32 = $(BCROOT)\bin\ILink32.exe IDE_LinkFLAGS32 = -L$(BCROOT)\LIB LINKOPTS= -ap -Tpe -x -CFLAGS= -O2 -tWC -DSTRICT; -w-inl -w-aus -w-csu -w-eff -w-rch -I$(BCROOT)\include;..\..\..\..\; -L..\..\build\bcb5 +CFLAGS= -O2 -tWC -DSTRICT; -w-inl -w-aus -w-csu -w-eff -w-rch -I$(BCROOT)\include;..\..\..\..\; -L..\..\build\bcb5 $(CXXFLAGS) all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1v.exe r2v.exe r3v.exe r4v.exe r5v.exe r6v.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1lm.exe r2lm.exe r3lm.exe r4lm.exe r5lm.exe r6lm.exe r1lv.exe r2lv.exe r3lv.exe r4lv.exe r5lv.exe r6lv.exe echo testing static single threaded version.... @@ -185,3 +185,4 @@ r6lv.exe : tests.cpp parse.cpp regress.cpp + diff --git a/test/regress/tests.cpp b/test/regress/tests.cpp index 08a8b91d..36e42f97 100644 --- a/test/regress/tests.cpp +++ b/test/regress/tests.cpp @@ -438,7 +438,11 @@ void cpp_tests(const reg_expression& e, bool recurse = true) unsigned int hl_match_id; -bool hl_grep_test_proc(const RegEx& e) +bool +#if defined(__BORLANDC__) || defined(BOOST_MSVC) +__cdecl +#endif +hl_grep_test_proc(const RegEx& e) { int start, end; start = e.Position(0);