vincentlaucsb / csv-parser

A high-performance, fully-featured CSV parser and serializer for modern C++.
MIT License
901 stars 150 forks source link

fix some warnings produced by clang #161

Closed artpaul closed 3 years ago

artpaul commented 3 years ago

The warnings were:

csv-parser/include/internal/basic_csv_parser.hpp:308:17: error: field '_source' will be initialized after base 'csv::internals::IBasicCSVParser' [-Werror,-Wreorder-ctor]
            ) : _source(std::move(source)), IBasicCSVParser(format, col_names) {};

csv-parser/tests/test_csv_stat.cpp:58:22: error: implicit conversion loses floating-point precision: '__gnu_cxx::__alloc_traits<std::allocator<long double>, long double>::value_type' (aka 'long double') to 'double' [-Werror,-Wimplicit-float-conversion]
        REQUIRE(ceil(reader.get_variance()[0]) == 842);

csv-parser/tests/test_raw_csv_data.cpp:9:7: error: declaration shadows a type alias in namespace 'csv' [-Werror,-Wshadow]
using RowCollection = ThreadSafeDeque<CSVRow>;

csv-parser/single_include_test/csv.hpp:7027:39: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
        CSVReader::iterator ret(this, std::move(this->records->pop_front()));

csv-parser/single_include_test/csv.hpp:7733:36: error: implicit conversion from 'size_t' (aka 'unsigned long') to 'double' may lose precision [-Werror,-Wimplicit-int-float-conversion]
                if (result.score > max_score) {

csv-parser/single_include_test/csv.hpp:7926:23: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
                row = std::move(this->records->pop_front());
                      ^                   

145

vincentlaucsb commented 3 years ago

Thanks for your help!