[xpressive] Warning from one compiler but not another.

One of our compilers is giving a warning and I cannot understand why. Maybe I'm missing a #define somewhere? I don't understand how the compiler got past the BOOST_MPL_ASSERT_RELATION macros to even "see" the offending line. Given the following code: #include <boost/xpressive/xpressive.hpp> using namespace boost::xpressive; int main(int argc, char **argv) { sregex re_ = (*_ >> "CALL" >> *_ >> "CONNECTED" >> *_); return(0); } gcc (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2) compiles and links successfully with no warnings. On the other hand, our [arm-softfloat-linux-gnu-gcc (GCC) 3.3.3] compiler gives the following warnings: Building file: ../main.cpp arm-softfloat-linux-gnu-g++ -D_REENTRANT -DARCH=ARM -I/usr/local/boost_1_33_1 -O3 -Wall -c -fmessage-length=0 -Wno-non-virtual-dtor -omain.o ../main.cpp [snip...snip,snip...snip] ../main.cpp:7: instantiated from here /usr/local/boost_1_33_1/boost/xpressive/traits/cpp_regex_traits.hpp:241: warning: comparison is always false due to limited range of data type /usr/local/boost_1_33_1/boost/xpressive/traits/cpp_regex_traits.hpp:241: warning: comparison is always false due to limited range of data type Finished building: ../main.cpp Building target: parse_warning arm-softfloat-linux-gnu-g++ -o parse_warning main.o Finished building: parse_warning Build complete for project parse_warning Here is the "offending" code: static bool is_newline(Char ch) { BOOST_MPL_ASSERT_RELATION('\r', ==, L'\r'); BOOST_MPL_ASSERT_RELATION('\n', ==, L'\n'); BOOST_MPL_ASSERT_RELATION('\f', ==, L'\f'); 241 ==> return L'\r' == ch || L'\n' == ch || L'\f' == ch || (1 < SizeOfChar && (0x2028u == ch || 0x2029u == ch || 0x85u == ch)); } Thanks for your time. Any assistance you could provide would be greatly appreciated. Regards, Dick Bridges

Dick Bridges wrote:
/usr/local/boost_1_33_1/boost/xpressive/traits/cpp_regex_traits.hpp:241: warning: comparison is always false due to limited range of data type /usr/local/boost_1_33_1/boost/xpressive/traits/cpp_regex_traits.hpp:241: warning: comparison is always false due to limited range of data type
<snip>
Here is the "offending" code:
static bool is_newline(Char ch) { BOOST_MPL_ASSERT_RELATION('\r', ==, L'\r'); BOOST_MPL_ASSERT_RELATION('\n', ==, L'\n'); BOOST_MPL_ASSERT_RELATION('\f', ==, L'\f'); 241 ==> return L'\r' == ch || L'\n' == ch || L'\f' == ch || (1 < SizeOfChar && (0x2028u == ch || 0x2029u == ch || 0x85u == ch)); }
This warning is harmless. It's because I was lazy and only wanted to write one function instead of splitting it into one for narrow chars and one for wide. I'll put it on my ToDo list. Thanks, -- Eric Niebler Boost Consulting www.boost-consulting.com
participants (2)
-
Dick Bridges
-
Eric Niebler