[cfe-dev] Tool oddity

Peter Stirling peter at pjstirling.plus.com
Wed Mar 25 10:32:52 PDT 2015


Hi,

I'm seeing some odd behaviour that I hope someone can suggest a solution 
for:

Recently, when I run my tool on my test file I get errors that I don't 
get if I run clang++ with equivalent options -


In file included from 
/home/peter/Programming/llvm/llvm/tools/clang/tools/extra/quaff/dummy.cc:6:
In file included from /usr/include/taglib/taglib.h:47:
In file included from 
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/string:40:
In file included from 
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/bits/char_traits.h:39:
In file included from 
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/bits/stl_algobase.h:63:
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:58:35: 
error: invalid operands to binary expression ('float' and 'unsigned long')
       static const _Value __min = __glibcxx_min(_Value);
                                   ^~~~~~~~~~~~~~~~~~~~~
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:48:35: 
note: expanded from macro '__glibcxx_min'
   (__glibcxx_signed(_Tp) ? (_Tp)1 << __glibcxx_digits(_Tp) : (_Tp)0)
                            ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:55:12: 
note: in instantiation of template class 
'__gnu_cxx::__numeric_traits_integer<float>' requested here
     struct __numeric_traits_integer
            ^
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:59:35: 
error: invalid operands to binary expression ('float' and 'unsigned long')
       static const _Value __max = __glibcxx_max(_Value);
                                   ^~~~~~~~~~~~~~~~~~~~~
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:52:15: 
note: expanded from macro '__glibcxx_max'
    (((((_Tp)1 << (__glibcxx_digits(_Tp) - 1)) - 1) << 1) + 1) : ~(_Tp)0)
        ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:58:35: 
error: invalid operands to binary expression ('double' and 'unsigned long')
       static const _Value __min = __glibcxx_min(_Value);
                                   ^~~~~~~~~~~~~~~~~~~~~
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:48:35: 
note: expanded from macro '__glibcxx_min'
   (__glibcxx_signed(_Tp) ? (_Tp)1 << __glibcxx_digits(_Tp) : (_Tp)0)
                            ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:55:12: 
note: in instantiation of template class 
'__gnu_cxx::__numeric_traits_integer<double>' requested here
     struct __numeric_traits_integer
            ^
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:59:35: 
error: invalid operands to binary expression ('double' and 'unsigned long')
       static const _Value __max = __glibcxx_max(_Value);
                                   ^~~~~~~~~~~~~~~~~~~~~
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:52:15: 
note: expanded from macro '__glibcxx_max'
    (((((_Tp)1 << (__glibcxx_digits(_Tp) - 1)) - 1) << 1) + 1) : ~(_Tp)0)
        ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:58:35: 
error: invalid operands to binary expression ('long double' and 
'unsigned long')
       static const _Value __min = __glibcxx_min(_Value);
                                   ^~~~~~~~~~~~~~~~~~~~~
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:48:35: 
note: expanded from macro '__glibcxx_min'
   (__glibcxx_signed(_Tp) ? (_Tp)1 << __glibcxx_digits(_Tp) : (_Tp)0)
                            ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:55:12: 
note: in instantiation of template class 
'__gnu_cxx::__numeric_traits_integer<long double>' requested here
     struct __numeric_traits_integer
            ^
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:59:35: 
error: invalid operands to binary expression ('long double' and 
'unsigned long')
       static const _Value __max = __glibcxx_max(_Value);
                                   ^~~~~~~~~~~~~~~~~~~~~
/../lib/gcc/x86_64-redhat-linux/4.9.2/../../../../include/c++/4.9.2/ext/numeric_traits.h:52:15: 
note: expanded from macro '__glibcxx_max'
    (((((_Tp)1 << (__glibcxx_digits(_Tp) - 1)) - 1) << 1) + 1) : ~(_Tp)0)
        ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~

I extracted the command line produced by the FixedCompilationDatabase 
and printed it with quotes for extra paranoia:

'clang-tool' '-Wall' '-std=c++11' '-fcolor-diagnosticsoo' 
'/home/peter/Programming/llvm/llvm/tools/clang/tools/extra/quaff/dummy.cc'

First thing to observe is that -fcolor-diagnosticsoo seems a bit weird. 
Second is that running clang++ -Wall -std=c++11 
/home/peter/Programming/llvm/llvm/tools/clang/tools/extra/quaff/dummy.cc 
doesn't error.

This is on a fedora box, if that makes a difference.



More information about the cfe-dev mailing list