[cfe-users] Help! Can not disable -Wsign-conversion!
David Blaikie
dblaikie at gmail.com
Mon Sep 9 11:39:41 PDT 2013
Works for me:
$ cat > sign.cpp
#include <vector>
int main() {
std::vector<int> v;
int cnt = 3;
v.resize(cnt * 3);
}
blaikie at blaikie:~/dev/scratch$ clang++ sign.cpp -Wsign-conversion
sign.cpp:5:16: warning: implicit conversion changes signedness: 'int' to
'size_type' (aka 'unsigned long') [-Wsign-conversion]
v.resize(cnt * 3);
~ ~~~~^~~
1 warning generated.
blaikie at blaikie:~/dev/scratch$ clang++ sign.cpp -g -D_FILE_OFFSET_BITS=64
-Wall -Wextra -Werror -Wno-error=sign-conversion -Wconversion
-Wno-sign-conversion -Wno-unused-parameter -Wold-style-cast
-Woverloaded-virtual -Wpointer-arith -Wshadow -Wwrite-strings -march=native
-Wno-null-conversion -Wno-tautological-compare -Wno-unused-function
-std=c++0x -O0
So I assume your build system is putting your CXX_FLAGS before some other
flags that are re-enabling this warning/error.
On Sun, Sep 8, 2013 at 1:07 AM, robbinfam <tianjiao08 at gmail.com> wrote:
> yes,the flags passed to the clang
>
> 发自我的 iPhone
>
> 在 2013-9-8,0:04,David Blaikie <dblaikie at gmail.com> 写道:
>
>
>
>
> On Sat, Sep 7, 2013 at 8:57 AM, Fan Yu <tianjiao08 at gmail.com> wrote:
>
>> Hi, I got a problem when using clang++ 3.2 at my C++ project.
>>
>> I use CXXFLAGS like :
>>
>> -- CXX_FLAGS = -g -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Werror
>> -Wno-error=sign-conversion -Wconversion -Wno-sign-conversion
>> -Wno-unused-parameter -Wold-style-cast -Woverloaded-virtual -Wpointer-arith
>> -Wshadow -Wwrite-strings -march=native -Wno-null-conversion
>> -Wno-tautological-compare -Wno-unused-function -std=c++0x -O0
>>
>
> Are you sure those flags are actually getting passed to your compile
> command?
>
>
>>
>> I use -Wno-sign-conversion to disable the warning, but I still got the
>> error, How can I disable it, anyone can help me? thank you
>> /home/ubuntu/claire/claire-common/claire/common/eventloop/poller/EPollPoller.cc:112:13:
>> error: implicit conversion changes signedness: 'int' to 'unsigned int'
>> [-Werror,-Wsign-conversion]
>> if (channel->events() & ~(got))
>> ^~~~~~~~~~~~~~~~~ ~
>> /home/ubuntu/claire/claire-common/claire/common/eventloop/poller/EPollPoller.cc:132:41:
>> error: implicit conversion changes signedness: 'uint32_t' (aka 'unsigned
>> int') to 'int'
>> [-Werror,-Wsign-conversion]
>> channel->set_revents(events_[i].events);
>> ~~~~~~~ ~~~~~~~~~~~^~~~~~
>> /home/ubuntu/claire/claire-common/claire/common/eventloop/poller/EPollPoller.cc:138:27:
>> error: implicit conversion changes signedness: 'int' to 'size_type' (aka
>> 'unsigned long')
>> [-Werror,-Wsign-conversion]
>> events_.resize(cnt*2);
>> ~~~~~~~ ~~~^~
>> /home/ubuntu/claire/claire-common/claire/common/eventloop/poller/EPollPoller.cc:143:73:
>> error: implicit conversion changes signedness: 'const int' to 'size_type'
>> (aka 'unsigned long') [-Werror,-Wsign-conversion]
>> if (static_cast<size_t>((*it)) < channels_.size() &&
>> !channels_[*it].channel->IsNoneEvent())
>> ~~~~~~~~~
>> ^~~
>> /home/ubuntu/claire/claire-common/claire/common/eventloop/poller/EPollPoller.cc:145:42:
>> error: implicit conversion changes signedness: 'const int' to 'size_type'
>> (aka 'unsigned long') [-Werror,-Wsign-conversion]
>> actives->push_back(channels_[*it].channel);
>> ~~~~~~~~~ ^~~
>>
>>
>> _______________________________________________
>> cfe-users mailing list
>> cfe-users at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20130909/c8af8718/attachment.html>
More information about the cfe-users
mailing list