From b8adb4df007f8b2f1db42570c1eaceebb3b63226 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Mon, 26 Mar 2001 11:09:49 +0000 Subject: [PATCH] regex updates: compatability fixes for Como and sunpro compilers [SVN r9642] --- configure | 97 +++++++++++++---------- configure.in | 11 ++- include/boost/re_detail/fileiter.hpp | 2 +- include/boost/re_detail/regex_compile.hpp | 40 +++++----- include/boost/re_detail/regex_config.hpp | 11 ++- include/boost/re_detail/regex_synch.hpp | 2 +- include/boost/regex.hpp | 4 +- src/c_regex_traits.cpp | 28 +++---- src/fileiter.cpp | 6 +- src/w32_regex_traits.cpp | 10 +-- 10 files changed, 119 insertions(+), 92 deletions(-) diff --git a/configure b/configure index de745fe7..dc32ae9d 100644 --- a/configure +++ b/configure @@ -2304,7 +2304,7 @@ pthread_mutex_t m; int main() { - pthread_mutex_init(&m, NULL); + pthread_mutex_init(&m, 0); pthread_mutex_lock(&m); pthread_mutex_unlock(&m); pthread_mutex_destroy(&m); @@ -2832,16 +2832,24 @@ cat > conftest.$ac_ext < +#include +#include #include "confdefs.h" std::locale l; +// +// regex locale support also requires +// std::map to be working so we test this +// as well here: +// +std::map m; int main() { ; return 0; } EOF -if { (eval echo configure:2845: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2853: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 ac_have_locale='yes' @@ -2863,9 +2871,9 @@ fi if test "$enable_stl" != "no"; then echo $ac_n "checking for ""... $ac_c" 1>&6 -echo "configure:2867: checking for " >&5 +echo "configure:2875: checking for " >&5 cat > conftest.$ac_ext < @@ -2881,7 +2889,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2885: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2893: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 @@ -2901,9 +2909,9 @@ rm -f conftest* fi echo $ac_n "checking for std::distance""... $ac_c" 1>&6 -echo "configure:2905: checking for std::distance" >&5 +echo "configure:2913: checking for std::distance" >&5 cat > conftest.$ac_ext < @@ -2917,7 +2925,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2921: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2929: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -2934,7 +2942,7 @@ rm -f conftest* if test "$enable_stl" != "no" && test "$have_dist" != "yes"; then cat > conftest.$ac_ext < @@ -2948,7 +2956,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2952: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2960: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -2974,9 +2982,9 @@ fi if test "$enable_stl" != "no" && test "$have_si" != "yes"; then echo $ac_n "checking for standard iterator syntax""... $ac_c" 1>&6 -echo "configure:2978: checking for standard iterator syntax" >&5 +echo "configure:2986: checking for standard iterator syntax" >&5 cat > conftest.$ac_ext < @@ -2993,7 +3001,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:2997: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3005: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -3017,7 +3025,7 @@ fi if test "$enable_stl" != "no" && test "$have_si" != "yes"; then cat > conftest.$ac_ext < @@ -3034,7 +3042,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3046: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -3065,9 +3073,9 @@ fi if test "$have_oi" != "yes"; then echo $ac_n "checking for output iterator syntax""... $ac_c" 1>&6 -echo "configure:3069: checking for output iterator syntax" >&5 +echo "configure:3077: checking for output iterator syntax" >&5 cat > conftest.$ac_ext < @@ -3080,7 +3088,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3084: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3092: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -3106,9 +3114,9 @@ fi if test "$enable_stl" != "no" && test "$have_ii" != "yes"; then echo $ac_n "checking for input iterator syntax""... $ac_c" 1>&6 -echo "configure:3110: checking for input iterator syntax" >&5 +echo "configure:3118: checking for input iterator syntax" >&5 cat > conftest.$ac_ext < @@ -3121,7 +3129,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -3140,7 +3148,7 @@ fi if test "$enable_stl" != "no" && test "$have_ii" != "yes"; then cat > conftest.$ac_ext < @@ -3153,7 +3161,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3165: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -3179,9 +3187,9 @@ fi if test "$enable_stl" != "no" && test "$have_fi" != "yes"; then echo $ac_n "checking for forward iterator syntax""... $ac_c" 1>&6 -echo "configure:3183: checking for forward iterator syntax" >&5 +echo "configure:3191: checking for forward iterator syntax" >&5 cat > conftest.$ac_ext < @@ -3194,7 +3202,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -3220,9 +3228,9 @@ fi if test "$enable_stl" != "no" && test "$have_bi" != "yes"; then echo $ac_n "checking for bidirectional iterator syntax""... $ac_c" 1>&6 -echo "configure:3224: checking for bidirectional iterator syntax" >&5 +echo "configure:3232: checking for bidirectional iterator syntax" >&5 cat > conftest.$ac_ext < @@ -3235,7 +3243,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3247: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -3261,9 +3269,9 @@ fi if test "$enable_stl" != "no" && test "$have_ri" != "yes"; then echo $ac_n "checking for random access iterator syntax""... $ac_c" 1>&6 -echo "configure:3265: checking for random access iterator syntax" >&5 +echo "configure:3273: checking for random access iterator syntax" >&5 cat > conftest.$ac_ext < @@ -3276,7 +3284,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3280: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3288: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -3302,9 +3310,9 @@ fi if test "$enable_stl" != "no"; then echo $ac_n "checking for output iterator assignment""... $ac_c" 1>&6 -echo "configure:3306: checking for output iterator assignment" >&5 +echo "configure:3314: checking for output iterator assignment" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3351: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 @@ -3475,9 +3483,9 @@ old_libs="$LIBS" LIBS="conf2.cpp $old_libs" echo $ac_n "checking for link time template merging""... $ac_c" 1>&6 -echo "configure:3479: checking for link time template merging" >&5 +echo "configure:3487: checking for link time template merging" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -3514,9 +3522,9 @@ if eval "$CXX $CXXFLAGS -c conf2.cpp" && eval "ar -rc libconf2.a conf2$ac_obj_ex LIBS="-L./ -lconf2 $old_libs" echo $ac_n "checking for link time template merging from archive files""... $ac_c" 1>&6 -echo "configure:3518: checking for link time template merging from archive files" >&5 +echo "configure:3526: checking for link time template merging from archive files" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -3658,9 +3666,9 @@ old_libs="$LIBS" LIBS="conf2.cpp $old_libs" echo $ac_n "checking for link time template merging of switch statements""... $ac_c" 1>&6 -echo "configure:3662: checking for link time template merging of switch statements" >&5 +echo "configure:3670: checking for link time template merging of switch statements" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -4054,5 +4062,6 @@ rm -f jm_opt.out + diff --git a/configure.in b/configure.in index dde4fc15..ef3d5031 100644 --- a/configure.in +++ b/configure.in @@ -753,7 +753,7 @@ pthread_mutex_t m; ], [ - pthread_mutex_init(&m, NULL); + pthread_mutex_init(&m, 0); pthread_mutex_lock(&m); pthread_mutex_unlock(&m); pthread_mutex_destroy(&m); @@ -1055,9 +1055,17 @@ AC_MSG_CHECKING(for ) AC_TRY_COMPILE( [ #include +#include +#include #include "confdefs.h" std::locale l; +// +// regex locale support also requires +// std::map to be working so we test this +// as well here: +// +std::map m; ], [ ], @@ -1687,5 +1695,6 @@ rm -f jm_opt.out + diff --git a/include/boost/re_detail/fileiter.hpp b/include/boost/re_detail/fileiter.hpp index 442330c2..1a3637e3 100644 --- a/include/boost/re_detail/fileiter.hpp +++ b/include/boost/re_detail/fileiter.hpp @@ -95,7 +95,7 @@ struct _fi_find_data struct _fi_priv_data; typedef _fi_priv_data* _fi_find_handle; -#define _fi_invalid_handle NULL +#define _fi_invalid_handle 0 #define _fi_dir 1 _fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindFileData); diff --git a/include/boost/re_detail/regex_compile.hpp b/include/boost/re_detail/regex_compile.hpp index a71c5743..cd1adf63 100644 --- a/include/boost/re_detail/regex_compile.hpp +++ b/include/boost/re_detail/regex_compile.hpp @@ -418,7 +418,7 @@ void BOOST_RE_CALL reg_expression::compile_maps() // always compile the first _map: std::memset(startmap, 0, 256); record->can_be_null = 0; - compile_map(record, startmap, NULL, re_detail::mask_all); + compile_map(record, startmap, 0, re_detail::mask_all); while(record->type != re_detail::syntax_element_match) { @@ -432,7 +432,7 @@ void BOOST_RE_CALL reg_expression::compile_maps() else { record->can_be_null = 0; - compile_map(record, NULL, &(record->can_be_null), re_detail::mask_all); + compile_map(record, 0, &(record->can_be_null), re_detail::mask_all); } record = record->next.p; } @@ -717,7 +717,7 @@ re_detail::re_syntax_base* BOOST_RE_CALL reg_expression::difference_type difference_type; typedef typename std::iterator_traits::value_type char_type; #else diff --git a/src/c_regex_traits.cpp b/src/c_regex_traits.cpp index 6e88e0d1..81cb68ae 100644 --- a/src/c_regex_traits.cpp +++ b/src/c_regex_traits.cpp @@ -221,9 +221,9 @@ void BOOST_RE_CALL re_free_classes() void BOOST_RE_CALL re_update_classes() { BOOST_RE_GUARD_STACK - if(*re_cls_name != std::setlocale(LC_CTYPE, NULL)) + if(*re_cls_name != std::setlocale(LC_CTYPE, 0)) { - *re_cls_name = std::setlocale(LC_CTYPE, NULL); + *re_cls_name = std::setlocale(LC_CTYPE, 0); char buf[256]; unsigned int i; for(i = 0; i < re_classes_max; ++i) @@ -265,9 +265,9 @@ void BOOST_RE_CALL re_free_collate() void BOOST_RE_CALL re_update_collate() { BOOST_RE_GUARD_STACK - if(*re_coll_name != std::setlocale(LC_COLLATE, NULL)) + if(*re_coll_name != std::setlocale(LC_COLLATE, 0)) { - *re_coll_name = std::setlocale(LC_COLLATE, NULL); + *re_coll_name = std::setlocale(LC_COLLATE, 0); char buf[256]; unsigned int i = 400; re_get_message(buf, 256, i); @@ -296,7 +296,7 @@ unsigned int BOOST_RE_CALL _re_get_message(char* buf, unsigned int len, unsigned #if !defined(BOOST_RE_NO_CAT) if(message_cat != (nl_catd)-1) { - const char* m = catgets(message_cat, 0, id, NULL); + const char* m = catgets(message_cat, 0, id, 0); if(m) { unsigned int size = std::strlen(m) + 1; @@ -329,7 +329,7 @@ void BOOST_RE_CALL re_message_update() // // called whenever the global locale changes: // - std::string l(std::setlocale(LC_MESSAGES, NULL)); + std::string l(std::setlocale(LC_MESSAGES, 0)); if(*mess_locale != l) { *mess_locale = l; @@ -547,7 +547,7 @@ bool BOOST_RE_CALL c_regex_traits::lookup_collatename(std::basic_string { BOOST_RE_GUARD_STACK std::basic_string s(first, last); - unsigned int len = strnarrow((char*)NULL, 0, s.c_str()); + unsigned int len = strnarrow((char*)0, 0, s.c_str()); scoped_array buf(new char[len]); strnarrow(buf.get(), len, s.c_str()); std::string t_out; @@ -604,15 +604,15 @@ void c_regex_traits::update() re_detail::cs_guard g(*re_detail::p_re_lock); #endif re_message_update(); - if(*collate_name != std::setlocale(LC_COLLATE, NULL)) + if(*collate_name != std::setlocale(LC_COLLATE, 0)) { do_update_collate(); - *collate_name = std::setlocale(LC_COLLATE, NULL); + *collate_name = std::setlocale(LC_COLLATE, 0); } - if(*ctype_name != std::setlocale(LC_CTYPE, NULL)) + if(*ctype_name != std::setlocale(LC_CTYPE, 0)) { do_update_ctype(); - *ctype_name = std::setlocale(LC_CTYPE, NULL); + *ctype_name = std::setlocale(LC_CTYPE, 0); } sort_type = re_detail::find_sort_syntax(&i, &sort_delim); } @@ -769,7 +769,7 @@ bool BOOST_RE_CALL c_regex_traits::do_lookup_collate(std::basic_string< { BOOST_RE_GUARD_STACK std::basic_string s(first, last); - unsigned int len = strnarrow((char*)NULL, 0, s.c_str()); + unsigned int len = strnarrow((char*)0, 0, s.c_str()); scoped_array buf(new char[len]); strnarrow(buf.get(), len, s.c_str()); std::string t_out; @@ -794,7 +794,7 @@ void BOOST_RE_CALL c_regex_traits::update() re_message_update(); re_update_classes(); re_update_collate(); - std::string l(std::setlocale(LC_CTYPE, NULL)); + std::string l(std::setlocale(LC_CTYPE, 0)); if(*wlocale_name != l) { *wlocale_name = l; @@ -979,7 +979,7 @@ int BOOST_RE_CALL c_regex_traits::toi(const wchar_t*& first, const wcha jm_uintfast32_t BOOST_RE_CALL c_regex_traits::lookup_classname(const wchar_t* first, const wchar_t* last) { std::basic_string s(first, last); - unsigned int len = strnarrow((char*)NULL, 0, s.c_str()); + unsigned int len = strnarrow((char*)0, 0, s.c_str()); scoped_array buf(new char[len]); strnarrow(buf.get(), len, s.c_str()); len = do_lookup_class(buf.get()); diff --git a/src/fileiter.cpp b/src/fileiter.cpp index 673c6258..a0ba841f 100644 --- a/src/fileiter.cpp +++ b/src/fileiter.cpp @@ -69,7 +69,7 @@ void mapfile::open(const char* file) #endif if(hfile != INVALID_HANDLE_VALUE) { - hmap = CreateFileMapping(hfile, NULL, PAGE_READONLY, 0, 0, 0); + hmap = CreateFileMapping(hfile, 0, PAGE_READONLY, 0, 0, 0); if(hmap == INVALID_HANDLE_VALUE) { CloseHandle(hfile); @@ -782,13 +782,13 @@ _fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindF DIR* h = opendir(dat->root); dat->d = h; - if(h != NULL) + if(h != 0) { if(_fi_FindNextFile(dat, lpFindFileData)) return dat; } delete dat; - return NULL; + return 0; } bool _fi_FindNextFile(_fi_find_handle dat, _fi_find_data* lpFindFileData) diff --git a/src/w32_regex_traits.cpp b/src/w32_regex_traits.cpp index 5b9c1116..b3f86ffa 100644 --- a/src/w32_regex_traits.cpp +++ b/src/w32_regex_traits.cpp @@ -556,7 +556,7 @@ bool BOOST_RE_CALL w32_regex_traits::lookup_collatename(std::basic_stri { BOOST_RE_GUARD_STACK std::basic_string s(first, last); - unsigned int len = strnarrow((char*)NULL, 0, s.c_str()); + unsigned int len = strnarrow((char*)0, 0, s.c_str()); scoped_array buf(new char[len]); strnarrow(buf.get(), len, s.c_str()); std::string t_out; @@ -596,7 +596,7 @@ bool BOOST_RE_CALL w32_regex_traits::do_lookup_collate(std::basic_strin { BOOST_RE_GUARD_STACK std::basic_string s(first, last); - unsigned int len = strnarrow((char*)NULL, 0, s.c_str()); + unsigned int len = strnarrow((char*)0, 0, s.c_str()); scoped_array buf(new char[len]); strnarrow(buf.get(), len, s.c_str()); std::string t_out; @@ -759,7 +759,7 @@ int BOOST_RE_CALL w32_regex_traits::toi(const wchar_t*& first, const wc jm_uintfast32_t BOOST_RE_CALL w32_regex_traits::lookup_classname(const wchar_t* first, const wchar_t* last) { std::basic_string s(first, last); - unsigned int len = strnarrow((char*)NULL, 0, s.c_str()); + unsigned int len = strnarrow((char*)0, 0, s.c_str()); scoped_array buf(new char[len]); strnarrow(buf.get(), len, s.c_str()); len = do_lookup_class(buf.get()); @@ -780,10 +780,10 @@ w32_regex_traits w32_regex_traits::init_; unsigned int BOOST_RE_CALL w32_regex_traits::strnarrow(char *s1, unsigned int len, const wchar_t *s2) { BOOST_RE_GUARD_STACK - unsigned int size = WideCharToMultiByte(CP_ACP, 0, s2, -1, s1, 0, NULL, NULL); + unsigned int size = WideCharToMultiByte(CP_ACP, 0, s2, -1, s1, 0, 0, 0); if(size > len) return size; - return WideCharToMultiByte(CP_ACP, 0, s2, -1, s1, len, NULL, NULL); + return WideCharToMultiByte(CP_ACP, 0, s2, -1, s1, len, 0, 0); } unsigned int BOOST_RE_CALL w32_regex_traits::strwiden(wchar_t *s1, unsigned int len, const char *s2)