[squid-dev] g++ 4.8.x and std::regex poblems

Amos Jeffries squid3 at treenet.co.nz
Wed Nov 30 13:14:12 UTC 2016

On 30/11/2016 10:23 p.m., Christos Tsantilas wrote:
> On 29/11/2016 09:46 μμ, Amos Jeffries wrote:
>> I'm thinking it might be useful to add a how-to in the release notes for
>> v4+ to make the compiler update easier. Would you be able to write that
>> now that you have gone through the process?
> I upgraded to newer OS, not just the compiler :-). It is something I
> would have to do in the next months so I decide to do it now.
> However major linux distributions still does not provide stable releases
> with gcc-5.x.
>> It is faster, but also has a different pattern syntax and API. So we
>> would need both a config directive to specify what syntax was in use and
>> a wrapper layer for portability.
>> Which is exactly what std::regex provides . Though I have not gone so
>> far as to add the config directive for changing the used syntax. It
>> makes a lot more sense to go through the transition pain once instead of
>> twice (GNURegex -> PCRE -> std::regex).
> My sense is that std::regex is not a wrapper layer. It is just a
> different implementation. Maybe it is the faster implementation, OK.

Whether its a wrapper or completely different implementation is up to
the library. At the very least it is a consistent API regardless of the
regex grammar being presented.

And the extra requirement of std::regex is that all 6 grammars be
presented one way or another, not limited to a subset of them the
library wants to implement.

> We are using regex expressions in very few places and actually I believe
> that we should use RegexPattern class instead of direct calls to the
> external regex libraries. A such RegexPattern class can be small and can
> be adjusted to use many regex implementations.

That is what the class was made for, yes.

> I know that this is a new project, I am not saying that we should
> implement support for multiple regex libraries right now, but I believe
> that it is something we should have in our mind when we are planning squid.

My point was that we dont have to. All we have to do is migrate to
std::regex usage and the underlying library is no longer our concern.

Once we are using std::regex we just add squid.conf flag(s) in relevant
places to set a users prefered grammar. The RegexPattern class sends
std::regex API a grammar flag depending on what the user configured.

The C++11 implementation guarantees availability of all the common
grammars as listed in the first table at
No worries about detecting libraries or what to link against for
multiple grammar support.

But them nice toys are stuck waiting for the CentOS 7 compiler to be
irrelevant. I hope we dont have to wait the next 14 years for its EOL date.


More information about the squid-dev mailing list