Fix FTBFS problem with GCC-6 sandbox/dkson95/gcc6
authorDongkyun, Son <dongkyun.s@samsung.com>
Wed, 2 Nov 2016 09:12:20 +0000 (18:12 +0900)
committerDongkyun, Son <dongkyun.s@samsung.com>
Wed, 2 Nov 2016 09:13:20 +0000 (18:13 +0900)
GCC-6 is pickier about some of the type conversions causing the Fedora
24 mass rebuild the build of oprofile failed with:

make[3]: Entering directory
'/builddir/build/BUILD/oprofile-1.1.0/libutil++'
g++ -DHAVE_CONFIG_H -I. -I.. -I ../libutil -I ../libop -I ../libpp -W
-Wall -fno-common -ftemplate-depth-50 -O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686
-mtune=atom -fasynchronous-unwind-tables -c -o op_bfd.o op_bfd.cpp
op_bfd.cpp: In member function 'void
op_bfd::get_symbol_range(symbol_index_t, long long unsigned int&, long
long unsigned int&) const':
op_bfd.cpp:538:47: error: cannot convert 'std::ostream {aka
std::basic_ostream<char>}' to 'const bool' in initialization
bool const verbose = cverb << (vbfd & vlevel1);
^
op_bfd.cpp:546:7: error: in argument to unary !
if (!verbose)
^~~~~~~

Avoid the intermediate bool type to make GCC-6 happy.

Signed-off-by: William Cohen <wcohen@redhat.com>
Signed-off-by: Dongkyun, Son <dongkyun.s@samsung.com>
libutil++/op_bfd.cpp

index 389c92018ad58acd172466356e31ec3ac4bf1641..f2eb42b0f749ace7a66112417e34d580a9a570a5 100644 (file)
@@ -535,15 +535,13 @@ void op_bfd::get_symbol_range(symbol_index_t sym_idx,
 {
        op_bfd_symbol const & sym = syms[sym_idx];
 
-       bool const verbose = cverb << (vbfd & vlevel1);
-
        if (anon_obj)
                start = sym.vma();
        else
                start = sym.filepos();
        end = start + sym.size();
 
-       if (!verbose)
+       if (!(cverb << (vbfd & vlevel1)))
                return;
 
        io_state state(cverb << (vbfd & vlevel1));