Skip to content

Instantly share code, notes, and snippets.

@bstaletic
Last active March 28, 2018 22:45
Show Gist options
  • Save bstaletic/79d64460d658defef9a72c04d6bb1ecc to your computer and use it in GitHub Desktop.
Save bstaletic/79d64460d658defef9a72c04d6bb1ecc to your computer and use it in GitHub Desktop.

Android

  • Empty on my laptop.

Boost

  • Empty on my laptop.

Bug Prone

  • Empty on my laptop.

Cert

  • cert-err58-cpp
/home/bstaletic/Temp/ycmd/cpp/ycm/IdentifierUtils.cpp:65:32: warning: initialization of 'LANG_TO_FILETYPE' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]
      StringEqualityComparer > LANG_TO_FILETYPE = {
                               ^
/usr/include/c++/v1/unordered_map:827:5: note: possibly throwing constructor declared here
    unordered_map(initializer_list<value_type> __il);

Clang Analyzer

  • clang-analyzer-deadcode.DeadStores
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePoint.cpp:58:14: warning: Value stored to 'it' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
  for ( auto it = first; count > 0; ) {
             ^
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePoint.cpp:58:14: note: Value stored to 'it' during its initialization is never read

CppCoreGuidelines

  • cppcoreguidelines-pro-bounds-pointer-arithmetic
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/ClangHelpers.cpp:179:21: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
    CXToken token = tokens[ i ];
                    ^
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/ClangHelpers.cpp:226:44: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
    CXCompletionResult completion_result = results->Results[ i ];
  • cppcoreguidelines-pro-type-const-cast
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/TranslationUnit.cpp:102:27: warning: do not use const_cast [cppcoreguidelines-pro-type-const-cast]
                          const_cast<CXUnsavedFile *>( unsaved ),
                          ^
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/TranslationUnit.cpp:181:27: warning: do not use const_cast [cppcoreguidelines-pro-type-const-cast]
                          const_cast<CXUnsavedFile *>( unsaved ),
  • cppcoreguidelines-pro-type-member-init
/home/bstaletic/Temp/ycmd/cpp/ycm/Candidate.cpp:70:1: warning: constructor does not initialize these fields: text_is_lowercase_ [cppcoreguidelines-pro-type-member-init]
Candidate::Candidate( const std::string &text )
^
  • cppcoreguidelines-owning-memory
/home/bstaletic/Temp/ycmd/cpp/ycm/CandidateRepository.cpp:80:26: warning: initializing non-owner argument of type 'std::__1::unique_ptr<YouCompleteMe::Candidate, std::__1::default_delete<YouCompleteMe::Candidate> >::pointer' (aka 'YouCompleteMe::Candidate *') with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
        candidate.reset( new Candidate( validated_candidate_text ) );
                         ^
/home/bstaletic/Temp/ycmd/cpp/ycm/CharacterRepository.cpp:64:33: warning: initializing non-owner argument of type 'std::__1::unique_ptr<YouCompleteMe::Character, std::__1::default_delete<YouCompleteMe::Character> >::pointer' (aka 'YouCompleteMe::Character *') with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
        character_object.reset( new Character( character ) );
                                ^
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePointRepository.cpp:64:34: warning: initializing non-owner argument of type 'std::__1::unique_ptr<YouCompleteMe::CodePoint, std::__1::default_delete<YouCompleteMe::CodePoint> >::pointer' (aka 'YouCompleteMe::CodePoint *') with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
        code_point_object.reset( new CodePoint( code_point ) );
                                 ^
/home/bstaletic/Temp/ycmd/cpp/ycm/IdentifierDatabase.cpp:132:23: warning: initializing non-owner argument of type 'std::__1::set<const YouCompleteMe::Candidate *, std::__1::less<const YouCompleteMe::Candidate *>, std::__1::allocator<const YouCompleteMe::Candidate *> > *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
    candidates.reset( new std::set< const Candidate * >() );
                      ^
  • cppcoreguidelines-pro-bounds-array-to-pointer-decay
/home/bstaletic/Temp/ycmd/cpp/ycm/ycm_core.cpp:68:1: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
BOOST_PYTHON_MODULE(ycm_core)
^
../BoostParts/boost/python/module.hpp:11:30: note: expanded from macro 'BOOST_PYTHON_MODULE'
# define BOOST_PYTHON_MODULE BOOST_PYTHON_MODULE_INIT
                             ^
../BoostParts/boost/python/module_init.hpp:71:32: note: expanded from macro 'BOOST_PYTHON_MODULE_INIT'
extern "C" BOOST_SYMBOL_EXPORT _BOOST_PYTHON_MODULE_INIT(name)
                               ^
../BoostParts/boost/python/module_init.hpp:45:9: note: expanded from macro '_BOOST_PYTHON_MODULE_INIT'
        initial_methods, \
        ^

Fuchsia

  • fuchsia-overloaded-operator
/home/bstaletic/Temp/ycmd/cpp/ycm/IdentifierUtils.cpp:51:3: warning: cannot overload 'operator()' [fuchsia-overloaded-operator]
  bool operator()( const std::string &a, const std::string &b ) const {
  ^
  • fuchsia-default-arguments
/home/bstaletic/Temp/ycmd/cpp/ycm/ycm_core.cpp:59:1: warning: declaring a parameter with a default argument is disallowed [fuchsia-default-arguments]
BOOST_PYTHON_FUNCTION_OVERLOADS( FilterAndSortCandidatesOverloads,
^
../BoostParts/boost/python/detail/defaults_gen.hpp:368:5: note: expanded from macro 'BOOST_PYTHON_FUNCTION_OVERLOADS'
    BOOST_PYTHON_GEN_FUNCTION_STUB(                                                         \
    ^
../BoostParts/boost/python/detail/defaults_gen.hpp:264:9: note: expanded from macro 'BOOST_PYTHON_GEN_FUNCTION_STUB'
        BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args, n_dflts)        \
        ^
../BoostParts/boost/python/detail/defaults_gen.hpp:207:17: note: expanded from macro 'BOOST_PYTHON_OVERLOAD_CONSTRUCTORS'
    fstubs_name(char const* doc = 0)                                                        \
                ^
/home/bstaletic/Temp/ycmd/cpp/ycm/ycm_core.cpp:60:34: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments]
                                 FilterAndSortCandidates,
                                 ^
./PythonSupport.h:35:3: note: default parameter was declared here
  const size_t max_candidates = 0 );
  ^

Google

  • gogle-readability-braces-around-statements
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePoint.cpp:62:20: warning: statement should be inside braces [google-readability-braces-around-statements]
    if ( cmp == 0 )
                   ^
                    {
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePoint.cpp:67:11: warning: statement should be inside braces [google-readability-braces-around-statements]
    } else
          ^
           {
/home/bstaletic/Temp/ycmd/cpp/ycm/Result.cpp:105:52: warning: statement should be inside braces [google-readability-braces-around-statements]
         other.first_char_same_in_query_and_text_ )
                                                   ^
                                                    {
/home/bstaletic/Temp/ycmd/cpp/ycm/Word.cpp:40:45: warning: statement should be inside braces [google-readability-braces-around-statements]
  if ( code_point_pos == code_points.end() )
                                            ^
                                             {
  • google-build-using-namespace
/home/bstaletic/Temp/ycmd/cpp/ycm/ycm_core.cpp:47:1: warning: do not use namespace using-directives; use using-declarations instead [google-build-using-namespace]
using namespace boost::python;
^
/home/bstaletic/Temp/ycmd/cpp/ycm/ycm_core.cpp:48:1: warning: do not use namespace using-directives; use using-declarations instead [google-build-using-namespace]
using namespace YouCompleteMe;
^
  • google-explicit-constructor
/home/bstaletic/Temp/ycmd/cpp/ycm/ycm_core.cpp:59:34: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
BOOST_PYTHON_FUNCTION_OVERLOADS( FilterAndSortCandidatesOverloads,
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 explicit
../BoostParts/boost/python/detail/defaults_gen.hpp:370:9: note: expanded from macro 'BOOST_PYTHON_FUNCTION_OVERLOADS'
        generator_name,                                                                     \
        ^
../BoostParts/boost/python/detail/defaults_gen.hpp:264:44: note: expanded from macro 'BOOST_PYTHON_GEN_FUNCTION_STUB'
        BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args, n_dflts)        \
                                           ^
../BoostParts/boost/python/detail/defaults_gen.hpp:207:5: note: expanded from macro 'BOOST_PYTHON_OVERLOAD_CONSTRUCTORS'
    fstubs_name(char const* doc = 0)                                                        \
    ^
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/TranslationUnit.cpp:484:3: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-e
xplicit-constructor]
  sort_by_location( int column ) : column_( column ) { }
  ^~~~~~~~~~~~~~~~
  explicit
  • google-runtime-references
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/ClangHelpers.cpp:87:16: warning: non-const reference parameter 'full_diagnostic_text', make it const or use a pointer [google-runtime-referenc
es]
  std::string& full_diagnostic_text,
               ^
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/ClangHelpers.cpp:88:25: warning: non-const reference parameter 'fixits', make it const or use a pointer [google-runtime-references]
  std::vector< FixIt >& fixits,
                        ^
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/TranslationUnit.cpp:59:62: warning: non-const reference parameter 'flags', make it const or use a pointer [google-runtime-references]
void EnsureCompilerNamePresent( std::vector< const char * > &flags ) {
                                                             ^
  • google-readability-namespace-comments
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/ClangHelpers.cpp:87:16: warning: non-const reference parameter 'full_diagnostic_text', make it const or use a pointer [google-runtime-referenc
es]
  std::string& full_diagnostic_text,
               ^
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/ClangHelpers.cpp:88:25: warning: non-const reference parameter 'fixits', make it const or use a pointer [google-runtime-references]
  std::vector< FixIt >& fixits,
                        ^
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/TranslationUnit.cpp:59:62: warning: non-const reference parameter 'flags', make it const or use a pointer [google-runtime-references]
void EnsureCompilerNamePresent( std::vector< const char * > &flags ) {
                                                             ^

Hicpp

  • hicpp-member-init
Candidate::Candidate( const std::string &text )
^
  • hicpp-signed-bitwise
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePoint.cpp:30:10: warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
  if ( ( leading_byte & 0x80 ) == 0x00 ) {
         ^
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePoint.cpp:34:10: warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
  if ( ( leading_byte & 0xe0 ) == 0xc0 ) {
         ^
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePoint.cpp:38:10: warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
  if ( ( leading_byte & 0xf0 ) == 0xe0 ) {
         ^
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePoint.cpp:42:10: warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
  if ( ( leading_byte & 0xf8 ) == 0xf0 ) {
         ^
  • hicpp-braces-around-statements
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePoint.cpp:62:20: warning: statement should be inside braces [hicpp-braces-around-statements]
    if ( cmp == 0 )
                   ^
                    {
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePoint.cpp:67:11: warning: statement should be inside braces [hicpp-braces-around-statements]
    } else
          ^
           {
  • hicpp-use-emplace
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePoint.cpp:103:17: warning: use emplace_back instead of push_back [hicpp-use-emplace]
    code_points.push_back( std::string( iter, iter + length ) );
                ^~~~~~~~~~~~~~~~~~~~~~~                     ~~~
                emplace_back(
  • hicpp-use-equals-default
/home/bstaletic/Temp/ycmd/cpp/ycm/IdentifierCompleter.cpp:29:22: warning: use '= default' to define a trivial default constructor [hicpp-use-equals-default]
IdentifierCompleter::IdentifierCompleter() {}
                     ^                     ~~
                                           = default;
  • hiccp-move-const-arg
/home/bstaletic/Temp/ycmd/cpp/ycm/PythonSupport.cpp:89:39: warning: std::move of the variable 'result_and_object' of the trivially-copyable type 'ResultAnd<size_t>' (aka 'ResultAnd<unsigned l
ong>') has no effect; remove std::move() [hicpp-move-const-arg]
        result_and_objects.push_back( std::move( result_and_object ) );
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • hicpp-member-init
/home/bstaletic/Temp/ycmd/cpp/ycm/Result.cpp:66:1: warning: constructor does not initialize these fields: num_wb_matches_ [hicpp-member-init]
Result::Result( const Candidate *candidate,
^
  • hicpp-explicit-conversions
/home/bstaletic/Temp/ycmd/cpp/ycm/ycm_core.cpp:63:41: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [hicpp-explicit-conversions]
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS( CandidatesForQueryAndTypeOverloads,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                        explicit
../BoostParts/boost/python/detail/defaults_gen.hpp:377:9: note: expanded from macro 'BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS'
        generator_name,                                                                     \
        ^
../BoostParts/boost/python/detail/defaults_gen.hpp:276:44: note: expanded from macro 'BOOST_PYTHON_GEN_MEM_FUNCTION_STUB'
        BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args + 1, n_dflts)            \
                                           ^
../BoostParts/boost/python/detail/defaults_gen.hpp:207:5: note: expanded from macro 'BOOST_PYTHON_OVERLOAD_CONSTRUCTORS'
    fstubs_name(char const* doc = 0)                                                        \
    ^
  • hicpp-no-array-decay
/home/bstaletic/Temp/ycmd/cpp/ycm/ycm_core.cpp:68:1: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [hicpp-no-array-decay
]
BOOST_PYTHON_MODULE(ycm_core)
^
../BoostParts/boost/python/module.hpp:11:30: note: expanded from macro 'BOOST_PYTHON_MODULE'
# define BOOST_PYTHON_MODULE BOOST_PYTHON_MODULE_INIT
                             ^
../BoostParts/boost/python/module_init.hpp:71:32: note: expanded from macro 'BOOST_PYTHON_MODULE_INIT'
extern "C" BOOST_SYMBOL_EXPORT _BOOST_PYTHON_MODULE_INIT(name)
                               ^
../BoostParts/boost/python/module_init.hpp:45:9: note: expanded from macro '_BOOST_PYTHON_MODULE_INIT'
        initial_methods, \
        ^

LLVM

  • llvm-include-order
/home/bstaletic/Temp/ycmd/cpp/ycm/IdentifierCompleter.cpp:22:1: warning: #includes are not sorted properly [llvm-include-order]
#include "Result.h"
^        ~~~~~~~~~~
         "ReleaseGil.h"
/home/bstaletic/Temp/ycmd/cpp/ycm/IdentifierUtils.cpp:21:1: warning: #includes are not sorted properly [llvm-include-order]
#include <unordered_map>
^        ~~~~~~~~~~~~~~~
         <boost/algorithm/string/regex.hpp>
  • llvm-namespace-comment
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/Documentation.cpp:31:2: warning: anonymous namespace not terminated with a closing comment [llvm-namespace-comment]
}
 ^
  // namespace
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/Documentation.cpp:25:11: note: anonymous namespace starts here
namespace {
          ^

Misc

  • Empty on my laptop.

Modernize

  • modernize-make-unique
/home/bstaletic/Temp/ycmd/cpp/ycm/CandidateRepository.cpp:80:19: warning: use std::make_unique instead [modernize-make-unique]
        candidate.reset( new Candidate( validated_candidate_text ) );
                 ~^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  = std::make_unique<Candidate>
/home/bstaletic/Temp/ycmd/cpp/ycm/CharacterRepository.cpp:64:26: warning: use std::make_unique instead [modernize-make-unique]
        character_object.reset( new Character( character ) );
                        ~^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         = std::make_unique<Character>
  • modernize-make-shared
/home/bstaletic/Temp/ycmd/cpp/ycm/IdentifierDatabase.cpp:125:24: warning: use std::make_shared instead [modernize-make-shared]
    path_to_candidates.reset( new FilepathToCandidates() );
                      ~^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                       = std::make_shared<FilepathToCandidates>
/home/bstaletic/Temp/ycmd/cpp/ycm/IdentifierDatabase.cpp:132:16: warning: use std::make_shared instead [modernize-make-shared]
    candidates.reset( new std::set< const Candidate * >() );
              ~^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
               = std::make_shared<std::set< const Candidate * >>
  • modernize-pass-by-value
/home/bstaletic/Temp/ycmd/cpp/ycm/Word.cpp:294:13: warning: pass by value and use std::move [modernize-pass-by-value]
Word::Word( const std::string &text )
            ^~~~~~~~~~~~~~~~~~~~~~~
            std::string
  • modernize-use-emplace
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/ClangHelpers.cpp:153:12: warning: use emplace_back instead of push_back [modernize-use-emplace]
    ranges.push_back(
           ^~~~~~~~~~
           emplace_back(
  • modernize-use-equals-default
/home/bstaletic/Temp/ycmd/cpp/ycm/IdentifierCompleter.cpp:29:22: warning: use '= default' to define a trivial default constructor [modernize-use-equals-default]
IdentifierCompleter::IdentifierCompleter() {}
                     ^                     ~~
                                           = default;

MPI

  • Empty on my laptop.

Objc

  • Empty on my laptop.

Performance

  • performance-move-const-arg
/home/bstaletic/Temp/ycmd/cpp/ycm/PythonSupport.cpp:89:39: warning: std::move of the variable 'result_and_object' of the trivially-copyable type 'ResultAnd<size_t>' (aka 'ResultAnd<unsigned long>') has no effect; remove std::move() [performance-move-const-arg]
        result_and_objects.push_back( std::move( result_and_object ) );
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • performance-for-range-copy
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/TranslationUnitStore.cpp:46:14: warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]
  for ( auto flag : flags ) {
        ~~~~ ^
        const &
  • performance-unnecessary-value-param
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/ClangHelpers.cpp:255:44: warning: the parameter 'diagnostic_wrap' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
Diagnostic BuildDiagnostic( DiagnosticWrap diagnostic_wrap,
                            ~~~~~~~~~~~~~~ ^
                            const &

Readability

  • readability-inconsistent-declaration-parameter-name
/home/bstaletic/Temp/ycmd/cpp/ycm/./CandidateRepository.h:62:22: warning: function 'YouCompleteMe::CandidateRepository::ValidatedCandidateText' has a definition with different parameter names
 [readability-inconsistent-declaration-parameter-name]
  const std::string &ValidatedCandidateText( const std::string &text );
                     ^                                          ~~~~
                                                                candidate_text
  • readability-implicit-bool-conversion
/home/bstaletic/Temp/ycmd/cpp/ycm/CharacterRepository.cpp:34:9: warning: implicit conversion 'YouCompleteMe::CharacterRepository *' -> bool [readability-implicit-bool-conversion]
  if ( !instance_ ) {
       ~^~~~~~~~~
        == nullptr
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/ClangCompleter.cpp:42:30: warning: implicit conversion bool -> 'unsigned int' [readability-implicit-bool-conversion]
  clang_toggleCrashRecovery( true );
                             ^~~~
                             1u
/home/bstaletic/Temp/ycmd/cpp/ycm/ClangCompleter/ClangHelpers.cpp:56:9: warning: implicit conversion 'size_t' (aka 'unsigned long') -> bool [readability-implicit-bool-conversion]
  if ( !num_chunks ) {
       ~^~~~~~~~~~
        == 0u
  • readability-else-after-return
/home/bstaletic/Temp/ycmd/cpp/ycm/IdentifierDatabase.cpp:94:11: warning: do not use 'else' after 'continue' [readability-else-after-return]
        } else {
          ^~~~~~
  • readability-braces-around-statements
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePoint.cpp:62:20: warning: statement should be inside braces [readability-braces-around-statements]
    if ( cmp == 0 )
                   ^
                    {
/home/bstaletic/Temp/ycmd/cpp/ycm/CodePoint.cpp:67:11: warning: statement should be inside braces [readability-braces-around-statements]
    } else
          ^
           {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment