Qpid
  1. Qpid
  2. QPID-2574

Mismatch uint32_t / size_t generates many compile warnings, esp in 64-bit

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 0.6
    • Fix Version/s: None
    • Component/s: C++ Broker, C++ Client
    • Labels:
      None

      Description

      There are many places in the C++ code that mix uint32_t, usually in the form of an encoding or Buffer size, with size_t, usually the result of a size() call to a string or some other container. In a Windows 64-bit build this produces a warning for each occurrence similar to:

      3>C:\ace\exported\qpid\trunk\qpid\cpp\src\qpid/broker/Exchange.h(122) : warning C4267: 'return' : conversion from 'size_t' to 'uint32_t', possible loss of data

      This type of code is present in both hand-written and generated code, which is why I included the Code generator in the Components.

      Some can be removed with a cast - for example, the Uuid::encodedSize method isn't going to return a value greater than 2^32-1, so it can be safely cast away. But the problem should be dealt with more cleanly, I think.

        Activity

        Hide
        Steve Huston added a comment -

        Chuck, you and I have both been around the block enough times to know that without the warnings constantly annoying people, the problems will never get fixed.

        Show
        Steve Huston added a comment - Chuck, you and I have both been around the block enough times to know that without the warnings constantly annoying people, the problems will never get fixed.
        Hide
        Chuck Rolke added a comment -

        This condition of the source code is a major annoyance for those who compile on 64-bit windows. A single build of qpid produces 874 warnings and makes build logs hard to read. If you are interested in seeing where the issues are please see: http://people.apache.org/~chug/QPID-2574-error-enumeration.txt (sorted and unique for easier reading).

        With the -pedantic nature of the compile switch set I think a great addition would be -Wconversion. Then gcc builds would get the same errors as windows builds.

        Failing that, I propose adding "/wd4267" in CMakeLists.txt to suppress the warnings in windows builds. Then one day when the warnings are actually fixed we can remove warning switch in windows and add the warning switch in gcc.

        Show
        Chuck Rolke added a comment - This condition of the source code is a major annoyance for those who compile on 64-bit windows. A single build of qpid produces 874 warnings and makes build logs hard to read. If you are interested in seeing where the issues are please see: http://people.apache.org/~chug/QPID-2574-error-enumeration.txt (sorted and unique for easier reading). With the -pedantic nature of the compile switch set I think a great addition would be -Wconversion. Then gcc builds would get the same errors as windows builds. Failing that, I propose adding "/wd4267" in CMakeLists.txt to suppress the warnings in windows builds. Then one day when the warnings are actually fixed we can remove warning switch in windows and add the warning switch in gcc.

          People

          • Assignee:
            Unassigned
            Reporter:
            Steve Huston
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development