[TRE-general] minimal build
Ville Laurikari
ville at laurikari.net
Sun May 21 08:28:17 EEST 2006
On Sun, May 21, 2006 at 01:03:45PM +1000, skaller wrote:
> I'm trying to do a minimal build of tre 0.7.2 (modified to C++).
Why not 0.7.3?
> This involves turning off all the options: no GNU, no I18n,
> no multibyte etc (I want 100% pure ISO C++ so it compiles
> on all platforms).
I don't see how turning these off helps you, other than slightly
reducing the amount of code you need to deal with.
> The macros are a bit confusing, some require 0 or 1 value,
> others either to be #defined or not #defined. There are
> also two config files which define common symbols, which is
> a bit confusing :)
config.h is used during compilation, tre-config.h is used with the
installed TRE headers and contains only things needed in regex.h.
> However I get this:
>
> ./lpsrc/tre.pak:493: error: cannot convert ???const char*??? to ???const
> tre_char_t*??? for argument ???2??? to ???int tre_compile(regex_t*, const
> tre_char_t*, size_t, int)???
>
> which is also going to be an error in C. This is because of
> this definition:
It's going to be a warning, not an error, unless you use some extra
compiler option which treats pointer signedness mismatches as errors.
> #ifdef TRE_WCHAR
> typedef wchar_t tre_char_t;
> #else /* !TRE_WCHAR */
> typedef unsigned char tre_char_t;
> #endif /* !TRE_WCHAR */
>
> Should be typedefed to char, not unsigned char.
The type needs to be unsigned, because the character values are
occasionally used as array subscripts. Things blow up spectacularly
if you define it to a signed type :)
This warning is better fixed by a cast at the call site:
ret = tre_compile(preg, (const tre_char_t *)regex, n, cflags);
As it turns out, I had already added this cast for 0.7.4.
--
http://www.iki.fi/vl/
More information about the TRE-general
mailing list