[ 
https://issues.apache.org/activemq/browse/AMQCPP-56?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_38017
 ] 

Albert Strasheim commented on AMQCPP-56:
----------------------------------------

GCC 4.1.1 doesn't seem to like the AMQCPP_UNUSED macro -- something about 
__attribute__. You might consider simply leaving out the parameter name or 
exception name. I think most compilers support that?

A few more warning I spotted:

{noformat}
activemq/io/DataInputStream.cpp:305: warning: comparison between signed and 
unsigned integer expressions
activemq/io/BufferedOutputStream.cpp:92: warning: comparison between signed and 
unsigned integer expressions
activemq/io/BufferedOutputStream.cpp:106: warning: comparison between signed 
and unsigned integer expressions
activemq/connector/stomp/StompCommandReader.cpp:111: warning: comparison of 
unsigned expression >= 0 is always true
activemq/network/ServerSocket.cpp:157: warning: dereferencing type-punned 
pointer might break strict-aliasing rules
activemq/network/ServerSocket.cpp:203: warning: dereferencing type-punned 
pointer might break strict-aliasing rules
activemq/network/TcpSocket.cpp:190: warning: dereferencing type-punned pointer 
might break strict-aliasing rules
activemq/network/SocketOutputStream.cpp:84: warning: comparison between signed 
and unsigned integer expressions
{noformat}

Some of these might be inevitable signed<->unsigned conversions, which probably 
calls for some static_casts.

Not sure how to address those warnings in ServerSocket. I googled around a bit 
but couldn't find a definite answer on how one should handle that cast.


> GCC warnings and possible SocketFactory bug on 64-bit Linux
> -----------------------------------------------------------
>
>                 Key: AMQCPP-56
>                 URL: https://issues.apache.org/activemq/browse/AMQCPP-56
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Albert Strasheim
>         Assigned To: Nathan Mittler
>            Priority: Minor
>             Fix For: 2.0
>
>
> When compiling on 64-bit Linux with GCC 4.0.3, I see the following warnings:
> {noformat}
> activemq/concurrent/PooledThread.cpp:56: warning: 'task$first' may be used 
> uninitialized in this function
> activemq/concurrent/PooledThread.cpp:56: warning: 'task$second' may be used 
> uninitialized in this function
> activemq/network/SocketFactory.cpp:46: warning: comparison is always false 
> due to limited range of data type
> activemq/connector/openwire/marshal/v2/ConnectionControlMarshaller.cpp:82: 
> warning: unused variable 'info'
> activemq/connector/openwire/marshal/v2/IntegerResponseMarshaller.cpp:60: 
> warning: unused variable 'info'
> activemq/connector/openwire/marshal/v2/ReplayCommandMarshaller.cpp:61: 
> warning: unused variable 'info'
> activemq/connector/openwire/marshal/v2/ResponseMarshaller.cpp:60: warning: 
> unused variable 'info'
> {noformat}
> The first three warnings probably need to be looked at, especially the one in 
> SocketFactory.
> In my opinion, AMQCPP is using ints and unsigned ints in places where 
> std::size_t might be more appropriate. MSVC's warning level 3 catches many of 
> these issues, so we might consider upping the warning level and properly 
> dealing with the type conversion issues: mostly use std::size_t and 
> static_cast where we really intend to convert. I can prepare a few patches 
> along these lines if you think this is worthwhile.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to