Project

General

Profile

Bug #897

New Compilation Warnings

Added by Abhinav Badola over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
build
Target version:
Start date:
26 Mar 2013
Due date:
% Done:

0%

Estimated time:

Description

libtool: compile:  g++ -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wcast-align -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Woverloaded-virtual -W -MMD -I. -DEXV_LOCALEDIR=\"/usr/local/share/locale\" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 basicio.cpp  -fPIC -DPIC -o .libs/basicio.o
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147483649u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484007u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484008u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484009u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484016u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484020u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484021u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484040u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484041u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484179u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484210u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484212u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484214u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484240u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]                         
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484242u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]                         
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484244u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]                         
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484257u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]                         
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484272u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]                         
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484289u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]                         
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484293u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]                         
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484294u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]                         
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484295u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]                         
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484296u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]                         
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484311u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484312u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484417u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:184:5: warning: narrowing conversion of ‘2147484418u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:190:5: warning: narrowing conversion of ‘2415919104u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]
canonmn.cpp:190:5: warning: narrowing conversion of ‘2684354560u’ from ‘unsigned int’ to ‘long int’ inside { } is ill-formed in C++11 [-Wnarrowing]

I found these compilation errors are new, and should not occur.
Didn't use to occur in previous versions.


Related issues

Related to Exiv2 - Bug #898: GCC warning when including exiv2.hppClosed10 Apr 2013

Actions

History

#1

Updated by Robin Mills over 8 years ago

  • Category set to build
  • Status changed from New to Assigned
  • Assignee set to Robin Mills
  • Priority changed from Low to Normal
  • Target version set to 0.24

Abhinav

Thanks for reporting this.

I also discovered this last week when one of the GSoC students wanted to use #include <regex> in his code. All manner of mayhem resulted. In that case, we skipped the regex code and used string find or something (not as good, however sufficient). I wasn't willing to take <regex> into the Exiv2 code base because it isn't in older C++ libraries (such an MSVC/2003).

However you are quite right. We should fix warning from all compilers. Warnings are there to help us! There are also warnings from the Clang compiler to be dealt with. We could do with another build engineer to work on some of this stuff. Shawn? Can you help us?

Robin

#2

Updated by Niels Kristian Bech Jensen over 8 years ago

These warnings came with GCC 4.7+. They can be suppressed by adding static_casts to the declared type like I did in the UFRaw code base: http://ufraw.cvs.sourceforge.net/viewvc/ufraw/ufraw/dcraw.cc?r1=1.280&r2=1.281&diff_format=u

Regards,
Niels Kristian

#3

Updated by Robin Mills over 8 years ago

Niels

Thanks for the tip/solution. Much appreciated.

Abhinav:
I never like to say "can't reproduce". I've built on Linux with three compilers: gcc 4.7.2, gcc 4.8.0 and clang 3.0.6. I'm building the trunk.

$ uname -a
Linux rmills-linux 3.5.0-24-generic #37-Ubuntu SMP Thu Feb 7 01:50:30 UTC 2013 x86_64
x86_64 x86_64 GNU/Linux

1035 rmills@rmills-linux:~/gnu/exiv2/test.build $ svn info .
Path: .
Working Copy Root Path: /home/rmills/gnu/exiv2/test.build
URL: svn://dev.exiv2.org/svn/trunk
Repository Root: svn://dev.exiv2.org/svn
Repository UUID: b7c8b350-86e7-0310-a4b4-de8f6a8f16a3
Revision: 3003
Node Kind: directory
Schedule: normal
Last Changed Author: nkbj
Last Changed Rev: 3003
Last Changed Date: 2013-03-28 05:52:21 -0700 (Thu, 28 Mar 2013)

$ C=/usr/bin/g++; T=canonmn ; touch src/$T.cpp ; $C --version ; make src/$T.o CXX=$C 
g++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

/usr/bin/g++    -c -o src/canonmn.o src/canonmn.cpp

$ C=/usr/local/bin/g++; T=canonmn ; touch src/$T.cpp ; $C --version ; make src/$T.o CXX=$C 
g++ (GCC) 4.8.0
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

/usr/local/bin/g++    -c -o src/canonmn.o src/canonmn.cpp

$ C=/usr/bin/clang; T=canonmn ; touch src/$T.cpp ; $C --version ; make src/$T.o CXX=$C 
Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
/usr/bin/clang    -c -o src/canonmn.o src/canonmn.cpp

I've built from

$ make clean ; make config ; ./configure ; make

with GCC 4.8.0 and the command issued is the same as you have above:

libtool: compile:  g++ -O2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wcast-align -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Woverloaded-virtual -W -MMD -I. -DEXV_LOCALEDIR=\"/usr/local/share/locale\" -I../xmpsdk/include -c -DEXV_BUILDING_LIB=1 basicio.cpp  -fPIC -DPIC -o .libs/basicio.o

Any ideas?

#4

Updated by Abhinav Badola over 8 years ago

I've built from[...]

with GCC 4.8.0 and the command issued is the same as you have above:[...]

Any ideas?

Hi Robin,
Last year, the same happened with me. I was not able to produce compilation warnings at my end.
So Andreas suggested me to use,

-ggdb instead of -O2

These changes are to be made in config.mk file.
It worked for me back then, hope it would work for you as well.

Note
[1] config.mk file can be found in config folder.
[2] config.mk is not created till the step make config has been executed.

#5

Updated by Robin Mills over 8 years ago

  • Status changed from Assigned to Resolved

Thanks, Abhinav.

I always try to avoid editing anything in the config directory because magic is best left in its safe hiding place.

You can change compiler and linker flags using ./configure ENV=value and/or make ENV=value. CC/CXX=C/C++ compiler, CXXFLAGS/CFLAGS to set compiler flags and LDFLAGS for linking flags. I'm sure there are many others that I've never thought to use.

I built with GCC 4.8.0 CXXFLAGS=-std=c++2011 and I'm very pleased to say that exiv2 built and passed the test suite. There were numerous warnings about 'autoptr' is deprecated. Something to visit in future.

One curiosity was that exiv2 -v -V threw an exception as it couldn't load library dl to call dlopen. No problem, I think libtool linked the wrong version of libdl.so

$ locate libdl | grep x86_64
/lib/x86_64-linux-gnu/libdl-2.15.so
/lib/x86_64-linux-gnu/libdl.so.2
/usr/lib/x86_64-linux-gnu/libdl.a
/usr/lib/x86_64-linux-gnu/libdl.so  <-- that's the one I want

$ touch src/version.cpp ; make LDFLAGS=-L/usr/lib/x86_64-linux=gnu ; sudo make install ; bin/.libs/exiv2 -v -V
....
exiv2=0.23.0
platform=linux
compiler=G++
bits=64
dll=1
debug=0
version=4.8.0
date=Apr  3 2013
time=18:51:58
executable=/home/rmills/gnu/exiv2/test.build/bin/.libs/exiv2
library=/lib/x86_64-linux-gnu/libdl.so.2
library=/usr/local/lib/libexiv2.so.12
...

Getting back to this bug report, I still haven't seen those warnings from canonmn.cpp. So, I'm going to advance this to "resolved" using the lame excuse "Can't replicate". If anybody knows exactly how to reproduce these messages, then they can explain and change the status to "feedback". When/if that happens, I'll give this further attention.

#6

Updated by Abhinav Badola over 8 years ago

Thank you Robin for looking into the matter.
I will update my compiler and see if the compilation warning exists.

Niels Kristian Bech Jensen wrote:

These warnings came with GCC 4.7+. They can be suppressed by adding static_casts to the declared type like I did in the UFRaw code base: http://ufraw.cvs.sourceforge.net/viewvc/ufraw/ufraw/dcraw.cc?r1=1.280&r2=1.281&diff_format=u

Regards,
Niels Kristian

Hi Niels,
I have a doubt, is it possible that by adding static_casts, the data may get deprecated or truncated..?

#7

Updated by Robin Mills over 8 years ago

Abhinav

The deprecated warning has to do with C++2011 - the new C++ standard. The template std::autoptr will be removed at sometime in the future.
[[http://en.wikipedia.org/wiki/Auto_ptr]]
[[http://stackoverflow.com/questions/2404115/is-auto-ptr-deprecated]]

So, I'm not concerned about those warnings (yet). I'm very pleased that the code has successfully built and passed the test suite using the C++2011 compiler.

Robin

#8

Updated by Robin Mills over 8 years ago

  • Status changed from Resolved to Closed

Fixed in 0.24.

Also available in: Atom PDF