Skip to content

Commit 9712546

Browse files
authored
Merge pull request boostorg#105 from eldiener/develop
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74
2 parents d961318 + f712b89 commit 9712546

37 files changed

+181
-72
lines changed

example/snippets/regex_grep_example_4.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* using a C++ Builder closure as a callback.
1818
*/
1919

20-
#ifdef __BORLANDC__
20+
#if defined(__BORLANDC__) && !defined(__clang__)
2121

2222
#include <boost/regex.hpp>
2323
#include <string>
@@ -140,7 +140,7 @@ int main(int argc, const char** argv)
140140
return 0;
141141
}
142142

143-
#else // __BORLANDC__
143+
#else // __BORLANDC__ && !defined(__clang__)
144144

145145
int main()
146146
{

example/snippets/regex_match_example.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ int process_ftp(const char* response, std::string* msg)
4949
return -1;
5050
}
5151

52-
#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550))
52+
#if defined(BOOST_MSVC) || (defined(BOOST_BORLANDC) && (BOOST_BORLANDC == 0x550))
5353
//
5454
// problem with std::getline under MSVC6sp3
5555
istream& getline(istream& is, std::string& s)

example/snippets/regex_split_example_1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ unsigned tokenise(std::list<std::string>& l, std::string& s)
3030
using namespace std;
3131

3232

33-
#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550))
33+
#if defined(BOOST_MSVC) || (defined(BOOST_BORLANDC) && (BOOST_BORLANDC == 0x550))
3434
//
3535
// problem with std::getline under MSVC6sp3
3636
istream& getline(istream& is, std::string& s)

example/snippets/regex_token_iterator_eg_1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
using namespace std;
2424

2525

26-
#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550))
26+
#if defined(BOOST_MSVC) || (defined(BOOST_BORLANDC) && (BOOST_BORLANDC == 0x550))
2727
//
2828
// problem with std::getline under MSVC6sp3
2929
istream& getline(istream& is, std::string& s)

example/timer/regex_timer.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class string_out_iterator
8989
};
9090

9191
namespace boost{
92-
#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550)) || defined(__SGI_STL_PORT)
92+
#if defined(BOOST_MSVC) || (defined(BOOST_BORLANDC) && (BOOST_BORLANDC == 0x550)) || defined(__SGI_STL_PORT)
9393
//
9494
// problem with std::getline under MSVC6sp3
9595
// and C++ Builder 5.5, is this really that hard?
@@ -367,16 +367,9 @@ int main(int argc, char**argv)
367367
}
368368

369369
#if defined(_WIN32) && defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(UNDER_CE)
370+
#if !defined(BOOST_EMBTC)
370371
#pragma comment(lib, "user32.lib")
372+
#else
373+
#pragma comment(lib, "user32.a")
374+
#endif
371375
#endif
372-
373-
374-
375-
376-
377-
378-
379-
380-
381-
382-

include/boost/regex/config.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* Borland C++ Fix/error check
2323
* this has to go *before* we include any std lib headers:
2424
*/
25-
#if defined(__BORLANDC__)
25+
#if defined(__BORLANDC__) && !defined(__clang__)
2626
# include <boost/regex/config/borland.hpp>
2727
#endif
2828
#include <boost/version.hpp>
@@ -279,9 +279,14 @@
279279
#endif
280280

281281
#if defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)
282+
#if defined(__clang__)
283+
# define BOOST_REGEX_CALL __cdecl
284+
# define BOOST_REGEX_CCALL __cdecl
285+
#else
282286
# define BOOST_REGEX_CALL __fastcall
283287
# define BOOST_REGEX_CCALL __stdcall
284288
#endif
289+
#endif
285290

286291
#ifndef BOOST_REGEX_CALL
287292
# define BOOST_REGEX_CALL
@@ -378,7 +383,7 @@ if(0 == (x))\
378383

379384
#if !defined(BOOST_REGEX_NO_W32) && !defined(BOOST_REGEX_V3)
380385
# if(defined(_WIN32) || defined(_WIN64) || defined(_WINCE)) \
381-
&& !defined(__GNUC__) \
386+
&& !(defined(__GNUC__) || defined(__BORLANDC__) && defined(__clang__)) \
382387
&& !(defined(__BORLANDC__) && (__BORLANDC__ >= 0x600)) \
383388
&& !(defined(__MWERKS__) && (__MWERKS__ <= 0x3003))
384389
# define BOOST_REGEX_HAS_MS_STACK_GUARD

include/boost/regex/config/borland.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818

1919

20-
#if defined(__BORLANDC__)
20+
#if defined(__BORLANDC__) && !defined(__clang__)
2121
# if (__BORLANDC__ == 0x550) || (__BORLANDC__ == 0x551)
2222
// problems with std::basic_string and dll RTL:
2323
# if defined(_RTLDLL) && defined(_RWSTD_COMPILE_INSTANTIATE)

include/boost/regex/v4/cpp_regex_traits.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
616616
// std::collate<wchar_t>::transform returns a different string!
617617
// So as a workaround, we'll truncate the string at the first NULL
618618
// which _seems_ to work....
619-
#if BOOST_WORKAROUND(__BORLANDC__, < 0x580)
619+
#if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x580)
620620
result.erase(result.find(charT(0)));
621621
#else
622622
//
@@ -669,7 +669,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
669669
return pos->second;
670670
}
671671
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
672-
&& !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
672+
&& !BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x0551)
673673
std::string name(p1, p2);
674674
#else
675675
std::string name;
@@ -679,7 +679,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
679679
#endif
680680
name = lookup_default_collate_name(name);
681681
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
682-
&& !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
682+
&& !BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x0551)
683683
if(name.size())
684684
return string_type(name.begin(), name.end());
685685
#else

include/boost/regex/v4/cregex.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ struct pred4;
231231

232232
} /* namespace BOOST_REGEX_DETAIL_NS */
233233

234-
#if (defined(BOOST_MSVC) || defined(__BORLANDC__)) && !defined(BOOST_DISABLE_WIN32)
234+
#if (defined(BOOST_MSVC) || defined(BOOST_BORLANDC)) && !defined(BOOST_DISABLE_WIN32)
235235
typedef bool (__cdecl *GrepCallback)(const RegEx& expression);
236236
typedef bool (__cdecl *GrepFileCallback)(const char* file, const RegEx& expression);
237237
typedef bool (__cdecl *FindFilesCallback)(const char* file);

include/boost/regex/v4/fileiter.hpp

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ class BOOST_REGEX_DECL mapfile_iterator
270270
return *this;
271271
}
272272

273+
#if !defined(BOOST_EMBTC)
274+
273275
friend inline bool operator==(const mapfile_iterator& i, const mapfile_iterator& j)
274276
{
275277
return (i.file == j.file) && (i.node == j.node) && (i.offset == j.offset);
@@ -308,8 +310,64 @@ class BOOST_REGEX_DECL mapfile_iterator
308310
{
309311
return i.position() - j.position();
310312
}
313+
314+
#else
315+
316+
friend bool operator==(const mapfile_iterator& i, const mapfile_iterator& j);
317+
friend bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j);
318+
friend bool operator<(const mapfile_iterator& i, const mapfile_iterator& j);
319+
friend bool operator>(const mapfile_iterator& i, const mapfile_iterator& j);
320+
friend bool operator<=(const mapfile_iterator& i, const mapfile_iterator& j);
321+
friend bool operator>=(const mapfile_iterator& i, const mapfile_iterator& j);
322+
friend mapfile_iterator operator + (const mapfile_iterator& i, long off);
323+
friend mapfile_iterator operator + (long off, const mapfile_iterator& i);
324+
friend mapfile_iterator operator - (const mapfile_iterator& i, long off);
325+
friend long operator - (const mapfile_iterator& i, const mapfile_iterator& j);
326+
327+
#endif
328+
311329
};
312330

331+
#if defined(BOOST_EMBTC)
332+
333+
inline bool operator==(const mapfile_iterator& i, const mapfile_iterator& j)
334+
{
335+
return (i.file == j.file) && (i.node == j.node) && (i.offset == j.offset);
336+
}
337+
338+
inline bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j)
339+
{
340+
return !(i == j);
341+
}
342+
343+
inline bool operator<(const mapfile_iterator& i, const mapfile_iterator& j)
344+
{
345+
return i.position() < j.position();
346+
}
347+
inline bool operator>(const mapfile_iterator& i, const mapfile_iterator& j)
348+
{
349+
return i.position() > j.position();
350+
}
351+
inline bool operator<=(const mapfile_iterator& i, const mapfile_iterator& j)
352+
{
353+
return i.position() <= j.position();
354+
}
355+
inline bool operator>=(const mapfile_iterator& i, const mapfile_iterator& j)
356+
{
357+
return i.position() >= j.position();
358+
}
359+
mapfile_iterator operator + (long off, const mapfile_iterator& i)
360+
{
361+
mapfile_iterator tmp(i);
362+
return tmp += off;
363+
}
364+
inline long operator - (const mapfile_iterator& i, const mapfile_iterator& j)
365+
{
366+
return i.position() - j.position();
367+
}
368+
369+
#endif
370+
313371
#endif
314372

315373
// _fi_sep determines the directory separator, either '\\' or '/'
@@ -351,6 +409,8 @@ class BOOST_REGEX_DECL file_iterator
351409
file_iterator operator++(int);
352410
const char* operator*() { return path(); }
353411

412+
#if !defined(BOOST_EMBTC)
413+
354414
friend inline bool operator == (const file_iterator& f1, const file_iterator& f2)
355415
{
356416
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
@@ -361,8 +421,29 @@ class BOOST_REGEX_DECL file_iterator
361421
return !(f1 == f2);
362422
}
363423

424+
#else
425+
426+
friend bool operator == (const file_iterator& f1, const file_iterator& f2);
427+
friend bool operator != (const file_iterator& f1, const file_iterator& f2);
428+
429+
#endif
430+
364431
};
365432

433+
#if defined(BOOST_EMBTC)
434+
435+
inline bool operator == (const file_iterator& f1, const file_iterator& f2)
436+
{
437+
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
438+
}
439+
440+
inline bool operator != (const file_iterator& f1, const file_iterator& f2)
441+
{
442+
return !(f1 == f2);
443+
}
444+
445+
#endif
446+
366447
// dwa 9/13/00 - suppress unused parameter warning
367448
inline bool operator < (const file_iterator&, const file_iterator&)
368449
{
@@ -401,6 +482,8 @@ class BOOST_REGEX_DECL directory_iterator
401482

402483
static const char* separator() { return _fi_sep; }
403484

485+
#if !defined(BOOST_EMBTC)
486+
404487
friend inline bool operator == (const directory_iterator& f1, const directory_iterator& f2)
405488
{
406489
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
@@ -412,8 +495,30 @@ class BOOST_REGEX_DECL directory_iterator
412495
return !(f1 == f2);
413496
}
414497

498+
#else
499+
500+
friend bool operator == (const directory_iterator& f1, const directory_iterator& f2);
501+
friend bool operator != (const directory_iterator& f1, const directory_iterator& f2);
502+
503+
#endif
504+
415505
};
416506

507+
#if defined(BOOST_EMBTC)
508+
509+
inline bool operator == (const directory_iterator& f1, const directory_iterator& f2)
510+
{
511+
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
512+
}
513+
514+
515+
inline bool operator != (const directory_iterator& f1, const directory_iterator& f2)
516+
{
517+
return !(f1 == f2);
518+
}
519+
520+
#endif
521+
417522
inline bool operator < (const directory_iterator&, const directory_iterator&)
418523
{
419524
return false;

0 commit comments

Comments
 (0)