Skip to content

Commit 4cbcd30

Browse files
committed
Merge branch 'develop'
2 parents a851f21 + 237e69c commit 4cbcd30

File tree

13 files changed

+171
-65
lines changed

13 files changed

+171
-65
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,31 @@ jobs:
6464
- name: Test
6565
run: ../../../b2 toolset=$TOOLSET
6666
working-directory: ../boost-root/libs/regex/test
67+
ubuntu-jammy-standalone:
68+
runs-on: ubuntu-22.04
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
compiler: [ g++ ]
73+
standard: [ c++11, c++14, c++17, c++2a ]
74+
steps:
75+
- uses: actions/checkout@v2
76+
with:
77+
fetch-depth: '0'
78+
- uses: mstachniuk/ci-skip@v1
79+
with:
80+
commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]'
81+
commit-filter-separator: ';'
82+
fail-fast: true
83+
- name: Set TOOLSET
84+
run: echo ${{ matrix.compiler }} | awk '/^g/ { print "TOOLSET=gcc" } /^clang/ { print "TOOLSET=clang" }' >> $GITHUB_ENV
85+
- name: Add repository
86+
run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
87+
- name: Install packages
88+
run: sudo apt install libicu-dev
89+
- name: Test
90+
run: ${{ matrix.compiler }} -std=${{ matrix.standard }} -I../../include *.cpp ../../src/*.cpp -o regress && ./regress
91+
working-directory: ./test/regress
6792
ubuntu-bionic:
6893
runs-on: ubuntu-18.04
6994
strategy:
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<html>
2+
<head>
3+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4+
<title>Use in Standalone Mode (without the rest of Boost)</title>
5+
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6+
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7+
<link rel="home" href="../../index.html" title="Boost.Regex 7.0.1">
8+
<link rel="up" href="../configuration.html" title="Configuration">
9+
<link rel="prev" href="compiler.html" title="Compiler Setup">
10+
<link rel="next" href="locale.html" title="Locale and traits class selection">
11+
</head>
12+
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13+
<table cellpadding="2" width="100%"><tr>
14+
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15+
<td align="center"><a href="../../../../../../index.html">Home</a></td>
16+
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17+
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18+
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19+
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
20+
</tr></table>
21+
<hr>
22+
<div class="spirit-nav">
23+
<a accesskey="p" href="compiler.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="locale.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24+
</div>
25+
<div class="section">
26+
<div class="titlepage"><div><div><h3 class="title">
27+
<a name="boost_regex.configuration.standalone"></a><a class="link" href="standalone.html" title="Use in Standalone Mode (without the rest of Boost)">Use in Standalone
28+
Mode (without the rest of Boost)</a>
29+
</h3></div></div></div>
30+
<p>
31+
This library may now be used in "standalone" mode without the rest
32+
of the Boost C++ libraries, in order to do this you must either:
33+
</p>
34+
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
35+
<li class="listitem">
36+
Have a C++17 compiler that supports <code class="computeroutput"><span class="identifier">__has_include</span></code>,
37+
in this case if <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">config</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code> is <span class="bold"><strong>not</strong></span>
38+
present then the library will automoatically enter standalone mode. Or:
39+
</li>
40+
<li class="listitem">
41+
Define BOOST_REGEX_STANDALONE when building.
42+
</li>
43+
</ul></div>
44+
<p>
45+
The main difference between the 2 modes, is that when Boost.Config is present
46+
the library will automatically configure itself around various compiler defects.
47+
In particular in order to use the library with exception support turned off,
48+
you will either need a copy of Boost.Config in your include path, or else
49+
manually define BOOST_NO_EXCEPTIONS when building.
50+
</p>
51+
</div>
52+
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
53+
<td align="left"></td>
54+
<td align="right"><div class="copyright-footer">Copyright © 1998-2013 John Maddock<p>
55+
Distributed under the Boost Software License, Version 1.0. (See accompanying
56+
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
57+
</p>
58+
</div></td>
59+
</tr></table>
60+
<hr>
61+
<div class="spirit-nav">
62+
<a accesskey="p" href="compiler.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../configuration.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="locale.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
63+
</div>
64+
</body>
65+
</html>

doc/html/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
</p>
216216
</div>
217217
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
218-
<td align="left"><p><small>Last revised: March 08, 2022 at 11:25:00 GMT</small></p></td>
218+
<td align="left"><p><small>Last revised: December 09, 2022 at 16:44:04 GMT</small></p></td>
219219
<td align="right"><div class="copyright-footer"></div></td>
220220
</tr></table>
221221
<hr>

include/boost/regex/v4/regex_workaround.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
198198
const char *strSource
199199
)
200200
{
201-
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
202-
if (lenSourceWithNull > sizeInBytes)
201+
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
202+
if (lenSourceWithNull > sizeInBytes)
203203
return 1;
204-
std::memcpy(strDestination, strSource, lenSourceWithNull);
204+
std::memcpy(strDestination, strSource, lenSourceWithNull);
205205
return 0;
206206
}
207207
inline std::size_t strcat_s(
@@ -210,11 +210,11 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
210210
const char *strSource
211211
)
212212
{
213-
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
214-
std::size_t lenDestination = std::strlen(strDestination);
215-
if (lenSourceWithNull + lenDestination > sizeInBytes)
213+
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
214+
std::size_t lenDestination = std::strlen(strDestination);
215+
if (lenSourceWithNull + lenDestination > sizeInBytes)
216216
return 1;
217-
std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
217+
std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
218218
return 0;
219219
}
220220

include/boost/regex/v5/icu.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ class icu_regex_traits
190190
constexpr char_class_type mask_xdigit = char_class_type(1) << offset_xdigit;
191191
constexpr char_class_type mask_underscore = char_class_type(1) << offset_underscore;
192192
constexpr char_class_type mask_unicode = char_class_type(1) << offset_unicode;
193-
constexpr char_class_type mask_any = char_class_type(1) << offset_any;
194-
constexpr char_class_type mask_ascii = char_class_type(1) << offset_ascii;
193+
//constexpr char_class_type mask_any = char_class_type(1) << offset_any;
194+
//constexpr char_class_type mask_ascii = char_class_type(1) << offset_ascii;
195195
constexpr char_class_type mask_horizontal = char_class_type(1) << offset_horizontal;
196196
constexpr char_class_type mask_vertical = char_class_type(1) << offset_vertical;
197197

@@ -365,15 +365,15 @@ class icu_regex_traits
365365

366366
static char_class_type lookup_icu_mask(const ::UChar32* p1, const ::UChar32* p2)
367367
{
368-
constexpr char_class_type mask_blank = char_class_type(1) << offset_blank;
369-
constexpr char_class_type mask_space = char_class_type(1) << offset_space;
370-
constexpr char_class_type mask_xdigit = char_class_type(1) << offset_xdigit;
371-
constexpr char_class_type mask_underscore = char_class_type(1) << offset_underscore;
372-
constexpr char_class_type mask_unicode = char_class_type(1) << offset_unicode;
368+
//constexpr char_class_type mask_blank = char_class_type(1) << offset_blank;
369+
//constexpr char_class_type mask_space = char_class_type(1) << offset_space;
370+
//constexpr char_class_type mask_xdigit = char_class_type(1) << offset_xdigit;
371+
//constexpr char_class_type mask_underscore = char_class_type(1) << offset_underscore;
372+
//constexpr char_class_type mask_unicode = char_class_type(1) << offset_unicode;
373373
constexpr char_class_type mask_any = char_class_type(1) << offset_any;
374374
constexpr char_class_type mask_ascii = char_class_type(1) << offset_ascii;
375-
constexpr char_class_type mask_horizontal = char_class_type(1) << offset_horizontal;
376-
constexpr char_class_type mask_vertical = char_class_type(1) << offset_vertical;
375+
//constexpr char_class_type mask_horizontal = char_class_type(1) << offset_horizontal;
376+
//constexpr char_class_type mask_vertical = char_class_type(1) << offset_vertical;
377377

378378
static const ::UChar32 prop_name_table[] = {
379379
/* any */ 'a', 'n', 'y',

include/boost/regex/v5/regex_workaround.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
116116
const char *strSource
117117
)
118118
{
119-
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
120-
if (lenSourceWithNull > sizeInBytes)
119+
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
120+
if (lenSourceWithNull > sizeInBytes)
121121
return 1;
122-
std::memcpy(strDestination, strSource, lenSourceWithNull);
122+
std::memcpy(strDestination, strSource, lenSourceWithNull);
123123
return 0;
124124
}
125125
inline std::size_t strcat_s(
@@ -128,11 +128,11 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
128128
const char *strSource
129129
)
130130
{
131-
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
132-
std::size_t lenDestination = std::strlen(strDestination);
133-
if (lenSourceWithNull + lenDestination > sizeInBytes)
131+
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
132+
std::size_t lenDestination = std::strlen(strDestination);
133+
if (lenSourceWithNull + lenDestination > sizeInBytes)
134134
return 1;
135-
std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
135+
std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
136136
return 0;
137137
}
138138

src/posix_api.cpp

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818

1919
#define BOOST_REGEX_SOURCE
2020

21-
#include <boost/config.hpp>
2221
#include <boost/regex.hpp>
2322
#include <boost/cregex.hpp>
2423
#include <cstdio>
2524

26-
#if defined(BOOST_NO_STDC_NAMESPACE)
27-
namespace std{
28-
using ::sprintf;
29-
using ::strcpy;
30-
using ::strcmp;
31-
}
25+
#ifndef BOOST_WORKAROUND
26+
#define BOOST_WORKAROUND(x, y) false
3227
#endif
3328

29+
#ifndef BOOST_REGEX_STANDALONE
30+
#include <boost/core/snprintf.hpp>
31+
#else
32+
namespace boost { namespace core { using std::snprintf; } }
33+
#endif
3434

3535
namespace boost{
3636

@@ -87,7 +87,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char
8787
return REG_E_MEMORY;
8888
#endif
8989
// set default flags:
90-
boost::uint_fast32_t flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? regex::extended : regex::basic);
90+
unsigned flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? regex::extended : regex::basic);
9191
expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default;
9292
// and translate those that are actually set:
9393

@@ -176,23 +176,15 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
176176
// We're converting an integer i to a string, and since i <= REG_E_UNKNOWN
177177
// a five character string is *always* large enough:
178178
//
179-
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
180-
int r = (::sprintf_s)(localbuf, 5, "%d", i);
181-
#else
182-
int r = (std::sprintf)(localbuf, "%d", i);
183-
#endif
179+
int r = (boost::core::snprintf)(localbuf, 5, "%d", i);
184180
if(r < 0)
185181
return 0; // sprintf failed
186182
if(std::strlen(localbuf) < buf_size)
187183
BOOST_REGEX_DETAIL_NS::strcpy_s(buf, buf_size, localbuf);
188184
return std::strlen(localbuf) + 1;
189185
}
190186
}
191-
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
192-
int r = (::sprintf_s)(localbuf, 5, "%d", 0);
193-
#else
194-
int r = (std::sprintf)(localbuf, "%d", 0);
195-
#endif
187+
int r = (boost::core::snprintf)(localbuf, 5, "%d", 0);
196188
if(r < 0)
197189
return 0; // sprintf failed
198190
if(std::strlen(localbuf) < buf_size)

src/wide_posix_api.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@
2525
#include <boost/regex.hpp>
2626
#include <boost/cregex.hpp>
2727

28+
#ifndef BOOST_REGEX_STANDALONE
29+
#include <boost/core/snprintf.hpp>
30+
#else
31+
namespace boost { namespace core { using std::swprintf; } }
32+
#endif
33+
34+
#ifndef BOOST_WORKAROUND
35+
#define BOOST_WORKAROUND(x, y) false
36+
#endif
37+
2838
#include <cstdio>
2939
#include <cstring>
3040
#include <cwchar>
@@ -33,15 +43,6 @@
3343
#pragma warning(disable:981)
3444
#endif
3545

36-
#if defined(BOOST_NO_STDC_NAMESPACE) || defined(__NetBSD__)
37-
namespace std{
38-
# ifndef BOOST_NO_SWPRINTF
39-
using ::swprintf;
40-
# endif
41-
}
42-
#endif
43-
44-
4546
namespace boost{
4647

4748
namespace {
@@ -97,7 +98,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha
9798
return REG_E_MEMORY;
9899
#endif
99100
// set default flags:
100-
boost::uint_fast32_t flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? wregex::extended : wregex::basic);
101+
unsigned flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? wregex::extended : wregex::basic);
101102
expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default;
102103

103104
// and translate those that are actually set:
@@ -177,7 +178,6 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
177178
}
178179
return result;
179180
}
180-
#if !defined(BOOST_NO_SWPRINTF)
181181
if(code == REG_ATOI)
182182
{
183183
wchar_t localbuf[5];
@@ -190,7 +190,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
190190
#if defined(_WIN32_WCE) && !defined(UNDER_CE)
191191
(std::swprintf)(localbuf, L"%d", i);
192192
#else
193-
(std::swprintf)(localbuf, 5, L"%d", i);
193+
(boost::core::swprintf)(localbuf, 5, L"%d", i);
194194
#endif
195195
if(std::wcslen(localbuf) < buf_size)
196196
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
@@ -204,7 +204,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
204204
#if defined(_WIN32_WCE) && !defined(UNDER_CE)
205205
(std::swprintf)(localbuf, L"%d", 0);
206206
#else
207-
(std::swprintf)(localbuf, 5, L"%d", 0);
207+
(boost::core::swprintf)(localbuf, 5, L"%d", 0);
208208
#endif
209209
if(std::wcslen(localbuf) < buf_size)
210210
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
@@ -214,7 +214,6 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
214214
#endif
215215
return std::wcslen(localbuf) + 1;
216216
}
217-
#endif
218217
if(code <= (int)REG_E_UNKNOWN)
219218
{
220219
std::string p;

test/regress/basic_tests.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@
1616
* DESCRIPTION: main regex test declarations.
1717
*/
1818

19-
#include <boost/detail/workaround.hpp>
20-
21-
#if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x560)
22-
// we get unresolved externals from basic_string
23-
// unless we do this, a well known Borland bug:
24-
#define _RWSTD_COMPILE_INSTANTIATE
25-
#endif
26-
2719
#include "test.hpp"
2820

2921
#ifdef BOOST_MSVC

test/regress/main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,13 @@ int main(int argc, char * argv[])
217217
return cpp_main(argc, argv);
218218
}
219219

220+
#elif defined(BOOST_REGEX_STANDALONE)
221+
222+
int main(int argc, char* argv[])
223+
{
224+
return cpp_main(argc, argv);
225+
}
226+
220227
#else
221228

222229
#include <boost/detail/lightweight_main.hpp>

0 commit comments

Comments
 (0)