Ticket #54 (closed defect: fixed)

Opened 22 months ago

Last modified 22 months ago

write_n warnings on OS X

Reported by: hobu Owned by: mloskot
Priority: major Milestone: 1.0.0
Component: Base Library Version: svn-trunk
Keywords: Cc:
LAS Format Version: Not Applicable

Description (last modified by mloskot) (diff)

Suspicious warnings that should be cleaned:

g++ -DPACKAGE_NAME=\"las\" -DPACKAGE_TARNAME=\"las\" -DPACKAGE_VERSION=\"0.9.7\" "-DPACKAGE_STRING=\"las 0.9.7\"" -DPACKAGE_BUGREPORT=\"hobu.inc@gmail.com\" -DPACKAGE=\"las\" -DVERSION=\"0.9.7\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_STRING_H=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_LONG_LONG=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_BZERO=1 -DHAVE_MEMSET=1 -DHAVE_MEMCPY=1 -DHAVE_BCOPY=1 -I. -I../../include -I../../include/detail -I/usr/local/include -DHAVE_LIBGEOTIFF=1 -Wall -Wno-long-long -pedantic -std=c++98 -g -DDEBUG -MT writer11.lo -MD -MP -MF .deps/writer11.Tpo -c writer11.cpp  -fno-common -DPIC -o .libs/writer11.o
../../include/liblas/detail/utility.hpp: In function 'void liblas::detail::write_n(std::ostream&, const T&, const std::streamsize&) [with T = liblas::uint16_t]':
writer11.cpp:102:   instantiated from here
../../include/liblas/detail/utility.hpp:336: warning: left-hand operand of comma has no effect
../../include/liblas/detail/utility.hpp:336: warning: right-hand operand of comma has no effect
../../include/liblas/detail/utility.hpp: In function 'void liblas::detail::write_n(std::ostream&, const T&, const std::streamsize&) [with T = liblas::uint32_t]':
writer11.cpp:115:   instantiated from here
../../include/liblas/detail/utility.hpp:336: warning: left-hand operand of comma has no effect
../../include/liblas/detail/utility.hpp:336: warning: right-hand operand of comma has no effect
../../include/liblas/detail/utility.hpp: In function 'void liblas::detail::write_n(std::ostream&, const T&, const std::streamsize&) [with T = liblas::uint8_t [8]]':
writer11.cpp:118:   instantiated from here
../../include/liblas/detail/utility.hpp:336: warning: left-hand operand of comma has no effect
../../include/liblas/detail/utility.hpp:336: warning: right-hand operand of comma has no effect
../../include/liblas/detail/utility.hpp: In function 'void liblas::detail::write_n(std::ostream&, const T&, const std::streamsize&) [with T = liblas::uint8_t]':
writer11.cpp:123:   instantiated from here
../../include/liblas/detail/utility.hpp:336: warning: left-hand operand of comma has no effect
../../include/liblas/detail/utility.hpp:336: warning: right-hand operand of comma has no effect
../../include/liblas/detail/utility.hpp: In function 'void liblas::detail::write_n(std::ostream&, const T&, const std::streamsize&) [with T = liblas::uint32_t [5]]':
writer11.cpp:184:   instantiated from here
../../include/liblas/detail/utility.hpp:336: warning: left-hand operand of comma has no effect
../../include/liblas/detail/utility.hpp:336: warning: right-hand operand of comma has no effect
../../include/liblas/detail/utility.hpp: In function 'void liblas::detail::write_n(std::ostream&, const T&, const std::streamsize&) [with T = double]':
writer11.cpp:187:   instantiated from here
../../include/liblas/detail/utility.hpp:336: warning: left-hand operand of comma has no effect
../../include/liblas/detail/utility.hpp:336: warning: right-hand operand of comma has no effect
../../include/liblas/detail/utility.hpp: In function 'void liblas::detail::write_n(std::ostream&, const T&, const std::streamsize&) [with T = const char*]':
writer11.cpp:259:   instantiated from here
../../include/liblas/detail/utility.hpp:336: warning: left-hand operand of comma has no effect
../../include/liblas/detail/utility.hpp:336: warning: right-hand operand of comma has no effect

Change History

Changed 22 months ago by mloskot

  • status changed from new to assigned
  • component changed from General to Base Library

Hobu,

Can you tell me what OS X version or what GCC version throws this warning?

The warning refers to macro LIBLAS_SWAP_BYTES_N:

for(; first < last; ++first, --last) { 

and comma between

++first, --last

It can be suppressed with simple trick:

(void)++first, --last

but I'm wondering if only old GCC warns about it.

I suppose this is because of high warning level we use, W4, which is good anyway :-)

Changed 22 months ago by mloskot

  • description modified (diff)

Changed 22 months ago by hobu

gcc 4.0.1 on x86_64 Leopard

Changed 22 months ago by mloskot

  • status changed from assigned to closed
  • resolution set to fixed

I was completely wrong in the comment above. The warning was caused by stupid bug I made while constructing the bytes swapping macro :-)

Fixed in trunk (r761)

Note: See TracTickets for help on using tickets.