diff --git a/.ropeproject/config.py b/.ropeproject/config.py deleted file mode 100644 index 45e1fb46..00000000 --- a/.ropeproject/config.py +++ /dev/null @@ -1,103 +0,0 @@ -# The default ``config.py`` -# flake8: noqa - - -def set_prefs(prefs): - """This function is called before opening the project""" - - # Specify which files and folders to ignore in the project. - # Changes to ignored resources are not added to the history and - # VCSs. Also they are not returned in `Project.get_files()`. - # Note that ``?`` and ``*`` match all characters but slashes. - # '*.pyc': matches 'test.pyc' and 'pkg/test.pyc' - # 'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc' - # '.svn': matches 'pkg/.svn' and all of its children - # 'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o' - # 'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o' - prefs['ignored_resources'] = [ - '*.pyc', '*~', '.ropeproject', '.hg', '.svn', '_svn', - '.git', '.tox', '.env', 'env', 'venv', 'node_modules', - 'bower_components' - ] - - # Specifies which files should be considered python files. It is - # useful when you have scripts inside your project. Only files - # ending with ``.py`` are considered to be python files by - # default. - #prefs['python_files'] = ['*.py'] - - # Custom source folders: By default rope searches the project - # for finding source folders (folders that should be searched - # for finding modules). You can add paths to that list. Note - # that rope guesses project source folders correctly most of the - # time; use this if you have any problems. - # The folders should be relative to project root and use '/' for - # separating folders regardless of the platform rope is running on. - # 'src/my_source_folder' for instance. - #prefs.add('source_folders', 'src') - - # You can extend python path for looking up modules - #prefs.add('python_path', '~/python/') - - # Should rope save object information or not. - prefs['save_objectdb'] = True - prefs['compress_objectdb'] = False - - # If `True`, rope analyzes each module when it is being saved. - prefs['automatic_soa'] = True - # The depth of calls to follow in static object analysis - prefs['soa_followed_calls'] = 0 - - # If `False` when running modules or unit tests "dynamic object - # analysis" is turned off. This makes them much faster. - prefs['perform_doa'] = True - - # Rope can check the validity of its object DB when running. - prefs['validate_objectdb'] = True - - # How many undos to hold? - prefs['max_history_items'] = 32 - - # Shows whether to save history across sessions. - prefs['save_history'] = True - prefs['compress_history'] = False - - # Set the number spaces used for indenting. According to - # :PEP:`8`, it is best to use 4 spaces. Since most of rope's - # unit-tests use 4 spaces it is more reliable, too. - prefs['indent_size'] = 4 - - # Builtin and c-extension modules that are allowed to be imported - # and inspected by rope. - prefs['extension_modules'] = [] - - # Add all standard c-extensions to extension_modules list. - prefs['import_dynload_stdmods'] = True - - # If `True` modules with syntax errors are considered to be empty. - # The default value is `False`; When `False` syntax errors raise - # `rope.base.exceptions.ModuleSyntaxError` exception. - prefs['ignore_syntax_errors'] = False - - # If `True`, rope ignores unresolvable imports. Otherwise, they - # appear in the importing namespace. - prefs['ignore_bad_imports'] = False - - # If `True`, rope will insert new module imports as - # `from import ` by default. - prefs['prefer_module_from_imports'] = False - - # If `True`, rope will transform a comma list of imports into - # multiple separate import statements when organizing - # imports. - prefs['split_imports'] = False - - # If `True`, rope will sort imports alphabetically by module name - # instead of alphabetically by import statement, with from imports - # after normal imports. - prefs['sort_imports_alphabetically'] = False - - -def project_opened(project): - """This function is called after opening the project""" - # Do whatever you like here! diff --git a/.ropeproject/globalnames b/.ropeproject/globalnames deleted file mode 100644 index e4e1c7fb..00000000 Binary files a/.ropeproject/globalnames and /dev/null differ diff --git a/.ropeproject/history b/.ropeproject/history deleted file mode 100644 index 4490a5d9..00000000 Binary files a/.ropeproject/history and /dev/null differ diff --git a/.ropeproject/objectdb b/.ropeproject/objectdb deleted file mode 100644 index 486edc7c..00000000 Binary files a/.ropeproject/objectdb and /dev/null differ diff --git a/.travis.yml b/.travis.yml index ff042e9a..f306cd62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ matrix: - env: BUILD=Doc sudo: required # g++ 6 on Linux with C++14 - - env: CXX=g++-6 BUILD=Debug STANDARD=14 + - env: COMPILER=g++-6 BUILD=Debug STANDARD=14 compiler: gcc addons: apt: @@ -30,7 +30,7 @@ matrix: - ubuntu-toolchain-r-test packages: - g++-6 - - env: CXX=g++-6 BUILD=Release STANDARD=14 + - env: COMPILER=g++-6 BUILD=Release STANDARD=14 compiler: gcc addons: apt: @@ -47,7 +47,7 @@ matrix: compiler: clang os: osx # clang 6.0 on Linux with C++14 - - env: CXX=clang++-6.0 BUILD=Debug STANDARD=14 + - env: COMPILER=clang++-6.0 BUILD=Debug STANDARD=14 compiler: clang addons: apt: @@ -59,7 +59,7 @@ matrix: - llvm-toolchain-trusty - llvm-toolchain-trusty-6.0 # clang 4.0 on Linux with C++14 - - env: CXX=clang++-4.0 BUILD=Debug STANDARD=11 + - env: COMPILER=clang++-4.0 BUILD=Debug STANDARD=11 compiler: clang addons: apt: @@ -71,10 +71,10 @@ matrix: - llvm-toolchain-trusty - llvm-toolchain-trusty-4.0 # g++ 4.8 on Linux with C++11 - - env: CXX=g++-4.8 BUILD=Debug STANDARD=11 + - env: COMPILER=g++-4.8 BUILD=Debug STANDARD=11 compiler: gcc # g++ 4.4 on Linux with C++11 - - env: CXX=g++-4.4 BUILD=Debug STANDARD=11 + - env: COMPILER=g++-4.4 BUILD=Debug STANDARD=11 compiler: gcc addons: apt: @@ -118,10 +118,11 @@ matrix: - tree ./libs allow_failures: # Errors - - env: CXX=g++-4.4 BUILD=Debug STANDARD=11 + - env: COMPILER=g++-4.4 BUILD=Debug STANDARD=11 compiler: gcc before_script: + - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then export CXX=${COMPILER}; fi - if [[ "${BUILD}" != "Doc" ]]; then ${CXX} --version; fi script: diff --git a/include/fmt/format.h b/include/fmt/format.h index 8c56b18b..8cb0c6a9 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2919,7 +2919,7 @@ void basic_writer::write_double(T value, const format_specs &spec) { typedef back_insert_range> range; basic_writer w{range(buffer)}; w.write(hi); - unsigned digits = buffer.size(); + size_t digits = buffer.size(); w.write('.'); const unsigned max_digits = 18; while (digits++ < max_digits) { diff --git a/include/fmt/printf.h b/include/fmt/printf.h index fb69d5b1..ea383783 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -52,6 +52,7 @@ class printf_precision_handler: public function { typename std::enable_if::value, int>::type operator()(T) { FMT_THROW(format_error("precision is not integer")); + return 0; // Silence visual studio } }; @@ -193,6 +194,7 @@ class printf_width_handler: public function { typename std::enable_if::value, unsigned>::type operator()(T) { FMT_THROW(format_error("width is not integer")); + return 0; // Silence Visual Studio } }; } // namespace internal diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index cdb01ad6..a235ecac 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -126,10 +126,9 @@ struct is_tuple_like { static FMT_CONSTEXPR_DECL const bool value = is_tuple_like_::value && !is_range_::value; }; -} // namespace internal // Check for integer_sequence -#if defined(__cpp_lib_integer_sequence) || FMT_MSC_VER >= 1910 +#if defined(__cpp_lib_integer_sequence) || FMT_MSC_VER >= 1900 template using integer_sequence = std::integer_sequence; template @@ -179,21 +178,13 @@ void for_each(Tuple &&tup, F &&f) { template struct formatter::value>::type> { - - fmt::formatting_tuple formatting; - - template - FMT_CONSTEXPR auto parse(ParseContext &ctx) -> decltype(ctx.begin()) { - return formatting.parse(ctx); - } - - template - auto format(const TupleT &values, FormatContext &ctx) -> decltype(ctx.out()) { - auto out = ctx.out(); - std::size_t i = 0; - internal::copy(formatting.prefix, out); - internal::for_each(values, [&](const auto &v) { + typename std::enable_if::value>::type> { +private: + // C++11 generic lambda for format() + template + struct format_each { + template + void operator()(const T& v) { if (i > 0) { if (formatting.add_prepostfix_space) { *out++ = ' '; @@ -206,7 +197,28 @@ struct formatter& formatting; + std::size_t& i; + typename std::add_lvalue_reference().out())>::type out; + }; + +public: + formatting_tuple formatting; + + template + FMT_CONSTEXPR auto parse(ParseContext &ctx) -> decltype(ctx.begin()) { + return formatting.parse(ctx); + } + + template + auto format(const TupleT &values, FormatContext &ctx) -> decltype(ctx.out()) { + auto out = ctx.out(); + std::size_t i = 0; + internal::copy(formatting.prefix, out); + + internal::for_each(values, format_each{formatting, i, out}); if (formatting.add_prepostfix_space) { *out++ = ' '; } @@ -215,13 +227,12 @@ struct formatter -struct formatter< RangeT, Char, - typename std::enable_if::value>::type> { +struct formatter::value>::type> { - fmt::formatting_range formatting; + formatting_range formatting; template FMT_CONSTEXPR auto parse(ParseContext &ctx) -> decltype(ctx.begin()) { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5378c188..1a8c900a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -93,7 +93,7 @@ add_fmt_test(printf-test) add_fmt_test(time-test) add_fmt_test(util-test mock-allocator.h) add_fmt_test(custom-formatter-test) -#add_fmt_test(ranges-test) +add_fmt_test(ranges-test) if (HAVE_OPEN) add_fmt_executable(posix-mock-test diff --git a/test/ranges-test.cc b/test/ranges-test.cc index efe4f492..1fab6ab4 100644 --- a/test/ranges-test.cc +++ b/test/ranges-test.cc @@ -30,7 +30,6 @@ TEST(RangesTest, FormatVector2) { EXPECT_EQ("{{1, 2}, {3, 5}, {7, 11}}", ivf); } -#if FMT_USE_INTEGER_SEQUENCE TEST(RangesTest, FormatMap) { std::map simap{{"one", 1}, {"two", 2}}; EXPECT_EQ("{(one, 1), (two, 2)}", fmt::format("{}", simap)); @@ -87,4 +86,3 @@ TEST(RangesTest, FormatStruct) { #endif // (__cplusplus > 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG > // 201402L && _MSC_VER >= 1910) -#endif // FMT_USE_INTEGER_SEQUENCE