[LLVMdev] Regular Expression lib support

Török Edwin edwintorok at gmail.com
Fri Aug 28 03:35:49 PDT 2009


On 2009-08-28 11:53, Daniel Dunbar wrote:
> Nice!
>
> This looks good to me but probably Chris or someone else should sign off on it.
>   

Thanks, I'll wait till Chris approves.

> There were two minor warnings on Darwin:
>   

The warnings are harmless, but I can shut them up.

> --
> In file included from /Volumes/Data/Users/ddunbar/llvm/lib/Support/regexec.c:81:
> /Volumes/Data/Users/ddunbar/llvm/lib/Support/regengine.inc: In
> function 'sbackref':
> /Volumes/Data/Users/ddunbar/llvm/lib/Support/regengine.inc:665:
> warning: control reaches end of non-void function
> In file included from
> /Volumes/Data/Users/ddunbar/llvm/lib/Support/regexec.c:130:
> /Volumes/Data/Users/ddunbar/llvm/lib/Support/regengine.inc: In
> function 'lbackref':
> /Volumes/Data/Users/ddunbar/llvm/lib/Support/regengine.inc:665:
> warning: control reaches end of non-void function
>   

There is an assert(0) there, but asserts are disabled by default in the
regex code.
I'll add a return NULL to shut up the warnings.

> /Volumes/Data/Users/ddunbar/llvm/lib/Support/regexec.c: In function
> 'llvm_regexec':
> /Volumes/Data/Users/ddunbar/llvm/lib/Support/regexec.c:157: warning:
> comparison between signed and unsigned
>   

nstates is signed here:
if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))

Should I cast it to unsigned to shutup the warning? It only chooses
another matcher
if the number of states is small enough.

> --
>
> And one in the unittest:
> --
> /Volumes/Data/Users/ddunbar/llvm/utils/unittest/googletest/include/gtest/gtest.h:
> In function 'testing::AssertionResult
> testing::internal::CmpHelperEQ(const char*, const char*, const T1&,
> const T2&) [with T1 = int, T2 = long unsigned int]':
> /Volumes/Data/Users/ddunbar/llvm/utils/unittest/googletest/include/gtest/gtest.h:650:
>   instantiated from 'static testing::AssertionResult
> testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*,
> const char*, const T1&, const T2&) [with T1 = int, T2 = size_t, bool
> lhs_is_null_literal = false]'
> /Volumes/Data/Users/ddunbar/llvm/unittests/Support/RegexTest.cpp:29:
> instantiated from here
> /Volumes/Data/Users/ddunbar/llvm/utils/unittest/googletest/include/gtest/gtest.h:617:
> warning: comparison between signed and unsigned integer expressions
>   

I think I have to use 1u there to shut this up.

Best regards,
--Edwin



More information about the llvm-dev mailing list