Opened 15 years ago

Closed 15 years ago

#1488 closed Bugs (fixed)

Lots of warnings in ptr_container header files

Reported by: rcdailey@… Owned by: Thorsten Ottosen
Milestone: To Be Determined Component: ptr_container
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

I'm getting many warnings in a few ptr_container related header files in boost. Below are the warnings I'm getting. My IDE is Visual Studio 2008 (VS9). These also occur on Visual Studio 2005 (VS8):

1>c:\it\personal\collision\sdk\boost\boost\ptr_container\detail\move.hpp(23) : warning C4512: 'boost::ptr_container_detail::move_ptrs::move_source<Ptr>' : assignment operator could not be generated
1>        with
1>        [
1>            Ptr=boost::ptr_container_detail::static_move_ptr<Object,boost::ptr_container_detail::clone_deleter<boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<Object,std::vector<void *,std::allocator<void *>>>,boost::heap_clone_allocator>::null_clone_allocator<false>>>
1>        ]
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\ptr_sequence_adapter.hpp(182) : see reference to class template instantiation 'boost::ptr_container_detail::move_ptrs::move_source<Ptr>' being compiled
1>        with
1>        [
1>            Ptr=boost::ptr_container_detail::static_move_ptr<Object,boost::ptr_container_detail::clone_deleter<boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<Object,std::vector<void *,std::allocator<void *>>>,boost::heap_clone_allocator>::null_clone_allocator<false>>>
1>        ]
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\ptr_sequence_adapter.hpp(179) : while compiling class template member function 'void boost::ptr_sequence_adapter<T,VoidPtrSeq,CloneAllocator>::push_back(Object *)'
1>        with
1>        [
1>            T=Object,
1>            VoidPtrSeq=std::vector<void *,std::allocator<void *>>,
1>            CloneAllocator=boost::heap_clone_allocator
1>        ]
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\ptr_vector.hpp(35) : see reference to class template instantiation 'boost::ptr_sequence_adapter<T,VoidPtrSeq,CloneAllocator>' being compiled
1>        with
1>        [
1>            T=Object,
1>            VoidPtrSeq=std::vector<void *,std::allocator<void *>>,
1>            CloneAllocator=boost::heap_clone_allocator
1>        ]
1>        c:\it\personal\collision\source\world.h(20) : see reference to class template instantiation 'boost::ptr_vector<T>' being compiled
1>        with
1>        [
1>            T=Object
1>        ]
1>c:\it\personal\collision\sdk\boost\boost\ptr_container\detail\reversible_ptr_container.hpp(245) : warning C4127: conditional expression is constant
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\detail\reversible_ptr_container.hpp(244) : while compiling class template member function 'void boost::ptr_container_detail::reversible_ptr_container<Config,CloneAllocator>::enforce_null_policy(const Object *,const char *)'
1>        with
1>        [
1>            Config=boost::ptr_container_detail::sequence_config<Object,std::vector<void *,std::allocator<void *>>>,
1>            CloneAllocator=boost::heap_clone_allocator
1>        ]
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\ptr_sequence_adapter.hpp(132) : see reference to class template instantiation 'boost::ptr_container_detail::reversible_ptr_container<Config,CloneAllocator>' being compiled
1>        with
1>        [
1>            Config=boost::ptr_container_detail::sequence_config<Object,std::vector<void *,std::allocator<void *>>>,
1>            CloneAllocator=boost::heap_clone_allocator
1>        ]
1>c:\it\personal\collision\sdk\boost\boost\ptr_container\detail\reversible_ptr_container.hpp(247) : warning C4127: conditional expression is constant
1>c:\it\personal\collision\sdk\boost\boost\ptr_container\detail\reversible_ptr_container.hpp(110) : warning C4127: conditional expression is constant
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\detail\reversible_ptr_container.hpp(109) : while compiling class template member function 'void boost::ptr_container_detail::reversible_ptr_container<Config,CloneAllocator>::null_clone_allocator<allow_null_values>::deallocate_clone(const Object *)'
1>        with
1>        [
1>            Config=boost::ptr_container_detail::sequence_config<Object,std::vector<void *,std::allocator<void *>>>,
1>            CloneAllocator=boost::heap_clone_allocator,
1>            allow_null_values=false
1>        ]
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\detail\reversible_ptr_container.hpp(52) : see reference to class template instantiation 'boost::ptr_container_detail::reversible_ptr_container<Config,CloneAllocator>::null_clone_allocator<allow_null_values>' being compiled
1>        with
1>        [
1>            Config=boost::ptr_container_detail::sequence_config<Object,std::vector<void *,std::allocator<void *>>>,
1>            CloneAllocator=boost::heap_clone_allocator,
1>            allow_null_values=false
1>        ]
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\detail\static_move_ptr.hpp(85) : see reference to function template instantiation 'void boost::ptr_container_detail::clone_deleter<CloneAllocator>::operator ()<Object>(const T *) const' being compiled
1>        with
1>        [
1>            CloneAllocator=boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<Object,std::vector<void *,std::allocator<void *>>>,boost::heap_clone_allocator>::null_clone_allocator<false>,
1>            T=Object
1>        ]
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\detail\static_move_ptr.hpp(85) : while compiling class template member function 'boost::ptr_container_detail::static_move_ptr<T,Deleter>::~static_move_ptr(void)'
1>        with
1>        [
1>            T=Object,
1>            Deleter=boost::ptr_container_detail::clone_deleter<boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<Object,std::vector<void *,std::allocator<void *>>>,boost::heap_clone_allocator>::null_clone_allocator<false>>
1>        ]
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\ptr_sequence_adapter.hpp(182) : see reference to class template instantiation 'boost::ptr_container_detail::static_move_ptr<T,Deleter>' being compiled
1>        with
1>        [
1>            T=Object,
1>            Deleter=boost::ptr_container_detail::clone_deleter<boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<Object,std::vector<void *,std::allocator<void *>>>,boost::heap_clone_allocator>::null_clone_allocator<false>>
1>        ]
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\ptr_sequence_adapter.hpp(179) : while compiling class template member function 'void boost::ptr_sequence_adapter<T,VoidPtrSeq,CloneAllocator>::push_back(Object *)'
1>        with
1>        [
1>            T=Object,
1>            VoidPtrSeq=std::vector<void *,std::allocator<void *>>,
1>            CloneAllocator=boost::heap_clone_allocator
1>        ]

Attachments (2)

reversible_ptr_container.patch (622 bytes ) - added by Richard Webb <richard.webb@…> 15 years ago.
silence 4127 warnings from reversible_ptr_container.hpp
move.patch (528 bytes ) - added by Richard Webb <richard.webb@…> 15 years ago.
patch to silence C4512 warning on VC8+

Download all attachments as: .zip

Change History (18)

comment:1 by Jens Seidel <jensseidel@…>, 15 years ago

Hi,

it may be a very stupid response but I do not see any warning at all. I see only the template parameters but it is also hard to scroll in the webpage.

I suggest you post the warnings - and only these - again.

in reply to:  1 ; comment:2 by anonymous, 15 years ago

Replying to Jens Seidel <jensseidel@users.sf.net>:

Hi,

it may be a very stupid response but I do not see any warning at all. I see only the template parameters but it is also hard to scroll in the webpage.

I suggest you post the warnings - and only these - again.

I don't really understand what you're trying to say. What's the problem? Please elaborate.

in reply to:  2 ; comment:3 by Jens Seidel <jensseidel@…>, 15 years ago

Replying to anonymous:

I don't really understand what you're trying to say. What's the problem? Please elaborate.

Isn't it obvious? Look at the webpage (not your mail copy) http://svn.boost.org/trac/boost/ticket/1488 and tell me a single warning!

Ah, forget it. I copied the message and included it in another editor and could now read "warning C4512: '[snip']: assignment operator could not be generated"

Previously I read only the first columns and lines similar to: 1> with 1> [

I'm sure I even scrolled to the right side but navigation in the code snippet is very, very ugly! I wish a normal file attachment had beed used instead of unreadable Wiki syntax.

in reply to:  3 ; comment:4 by anonymous, 15 years ago

Replying to Jens Seidel <jensseidel@users.sf.net>:

Ah, forget it. I copied the message and included it in another editor and could now read

I'm sure I even scrolled to the right side but navigation in the code snippet is very, very ugly! I wish a normal file attachment had beed used instead of unreadable Wiki syntax.

I still have yet to see the problem. I can read everything just fine. At the bottom of the code block is a horizontal scroll bar. You can use that to view the parts that are clipped by the edge of the code block box.

in reply to:  4 ; comment:5 by Jens Seidel <jensseidel@…>, 15 years ago

Replying to anonymous:

Replying to Jens Seidel <jensseidel@users.sf.net>:

I'm sure I even scrolled to the right side but navigation in the code snippet is very, very ugly! I wish a normal file attachment had beed used instead of unreadable Wiki syntax.

I still have yet to see the problem. I can read everything just fine. At the bottom of the code block is a horizontal scroll bar. You can use that to view the parts that are clipped by the edge of the code block box.

Maybe it is a browser issue. I use Konqueror in Debian Sid.

I used the horizontal scrollbar at the bottom. But this way I see only the last lines of the bug report which do not include "warning C[0-9]+" but only the callstack and something as T=Object,.

Probably the solution is to check the first columns which are displayed very carefully, after this scroll a few columns to the right and restart reading at the top, the rescroll again and ...

OK, the problem is that the few "warning C[0-9]+" strings are just not easy to find in the large output. Just remember this for future reports or use maybe colors, ...

in reply to:  5 comment:6 by anonymous, 15 years ago

Replying to Jens Seidel <jensseidel@users.sf.net>:

Maybe it is a browser issue. I use Konqueror in Debian Sid.

I used the horizontal scrollbar at the bottom. But this way I see only the last lines of the bug report which do not include "warning C[0-9]+" but only the callstack and something as T=Object,.

Probably the solution is to check the first columns which are displayed very carefully, after this scroll a few columns to the right and restart reading at the top, the rescroll again and ...

OK, the problem is that the few "warning C[0-9]+" strings are just not easy to find in the large output. Just remember this for future reports or use maybe colors, ...

Don't blame me, blame Visual Studio. I would make it more readable if I could. In any case, the majority of people will be able to read it just fine. I'll attach a file later on for the visually impaired.

comment:7 by Thorsten Ottosen, 15 years ago

Please submit a patch that get's rid of these warnings

Thanks

-Thorsten

by Richard Webb <richard.webb@…>, 15 years ago

silence 4127 warnings from reversible_ptr_container.hpp

comment:8 by Richard Webb <richard.webb@…>, 15 years ago

Attached is a patch that silences the 4127 warnings from reversible_ptr_container.hpp on VC8/VC9.

The patch turns off the warning for the whole file, as it comes from several places (e.g. the usage of allow_null_values). Is this ok, or would you prefer the warnings disabled more locally?

comment:9 by Thorsten Ottosen, 15 years ago

Status: newassigned

I have applied it to trunk

-Thorsten

comment:10 by anonymous, 15 years ago

Thanks for updating the trunk. While most of the warnings are gone, there's still one more:

1>c:\it\personal\collision\sdk\boost\boost\ptr_container\detail\move.hpp(23) : warning C4512: 'boost::ptr_container_detail::move_ptrs::move_source<Ptr>' : assignment operator could not be generated
1>        with
1>        [
1>            Ptr=boost::ptr_container_detail::static_move_ptr<Object,boost::ptr_container_detail::clone_deleter<boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<Object,std::vector<void *,std::allocator<void *>>>,boost::heap_clone_allocator>::null_clone_allocator<false>>>
1>        ]
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\ptr_sequence_adapter.hpp(182) : see reference to class template instantiation 'boost::ptr_container_detail::move_ptrs::move_source<Ptr>' being compiled
1>        with
1>        [
1>            Ptr=boost::ptr_container_detail::static_move_ptr<Object,boost::ptr_container_detail::clone_deleter<boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<Object,std::vector<void *,std::allocator<void *>>>,boost::heap_clone_allocator>::null_clone_allocator<false>>>
1>        ]
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\ptr_sequence_adapter.hpp(179) : while compiling class template member function 'void boost::ptr_sequence_adapter<T,VoidPtrSeq,CloneAllocator>::push_back(Object *)'
1>        with
1>        [
1>            T=Object,
1>            VoidPtrSeq=std::vector<void *,std::allocator<void *>>,
1>            CloneAllocator=boost::heap_clone_allocator
1>        ]
1>        c:\it\personal\collision\sdk\boost\boost\ptr_container\ptr_vector.hpp(35) : see reference to class template instantiation 'boost::ptr_sequence_adapter<T,VoidPtrSeq,CloneAllocator>' being compiled
1>        with
1>        [
1>            T=Object,
1>            VoidPtrSeq=std::vector<void *,std::allocator<void *>>,
1>            CloneAllocator=boost::heap_clone_allocator
1>        ]
1>        c:\it\personal\collision\source\world.h(20) : see reference to class template instantiation 'boost::ptr_vector<T>' being compiled
1>        with
1>        [
1>            T=Object
1>        ]

by Richard Webb <richard.webb@…>, 15 years ago

Attachment: move.patch added

patch to silence C4512 warning on VC8+

comment:11 by Richard Webb <richard.webb@…>, 15 years ago

Patch to move.hpp to silence C4512 warning on VC8+ attached

in reply to:  11 comment:12 by anonymous, 15 years ago

Replying to Richard Webb <richard.webb@boldonjames.com>:

Patch to move.hpp to silence C4512 warning on VC8+ attached

Thanks for your patch. I tried to apply the patch using TortoiseSVN however it is saying that the patch is out of date? I'm not sure what this means.

comment:13 by Richard Webb <Richard.Webb@…>, 15 years ago

I'm not sure either, but i tried applying the patch locally before submitting it and it was ok then.

comment:14 by Thorsten Ottosen, 15 years ago

I applied it to trunk, and can merge it to the release tomorrow.

-Thorsten

in reply to:  14 comment:15 by anonymous, 15 years ago

Replying to nesotto:

I applied it to trunk, and can merge it to the release tomorrow.

-Thorsten

It seems like all the warnings have gone. Thanks a lot for this, you did a great job. Keep up the great work on BOOST guys. I love it!

PS: How do I resolve this ticket?

comment:16 by Thorsten Ottosen, 15 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.