diff --git a/.clang-format b/.clang-format index f65e0a5f17..69ecc07795 100644 --- a/.clang-format +++ b/.clang-format @@ -21,7 +21,7 @@ IndentCaseLabels: false NamespaceIndentation: None PointerAlignment: Middle SortIncludes: true -Standard: c++17 +Standard: c++20 IncludeBlocks: Regroup IncludeCategories: # Tests -------------------------------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9869e7362a..72bcb8c35e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.18) project(omim C CXX) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_C_STANDARD 11) # Our code does not rely on gnu extensions. set(CMAKE_CXX_EXTENSIONS OFF) @@ -26,7 +26,7 @@ if (APPLE AND NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android)) set(CMAKE_OBJC_VISIBILITY_PRESET hidden) enable_language(OBJCXX) set(CMAKE_OBJCXX_EXTENSIONS OFF) - set(CMAKE_OBJCXX_STANDARD 17) + set(CMAKE_OBJCXX_STANDARD 20) set(CMAKE_OBJCXX_FLAGS -fobjc-arc) set(CMAKE_OBJCXX_VISIBILITY_PRESET hidden) endif() @@ -166,9 +166,9 @@ if (NJOBS) set(CMAKE_JOB_POOL_PRECOMPILE_HEADER custom) endif() -# GCC 8.1 is required to support <charconv> header inclusion in base/string_utils.hpp, otherwise 7.0 is sufficient -if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.1) - message(FATAL_ERROR "Minimum supported g++ version is 8.1 yours is ${CMAKE_CXX_COMPILER_VERSION}") +# GCC 10.0 is required to support <charconv> header inclusion in base/string_utils.hpp +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0) + message(FATAL_ERROR "Minimum supported g++ version is 10.0, yours is ${CMAKE_CXX_COMPILER_VERSION}") endif() if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/cmake/OmimHelpers.cmake b/cmake/OmimHelpers.cmake index 2964abe911..4dad95eed6 100644 --- a/cmake/OmimHelpers.cmake +++ b/cmake/OmimHelpers.cmake @@ -173,8 +173,8 @@ function(add_precompiled_headers header pch_target_name) export_directory_flags("${pch_flags_file}") set(compiler_flags "@${pch_flags_file}") - # CMAKE_CXX_STANDARD 17 flags: - set(c_standard_flags "-std=c++17") + # CMAKE_CXX_STANDARD 20 flags: + set(c_standard_flags "-std=c++20") get_filename_component(pch_file_name ${header} NAME) add_pic_pch_target(${header} ${pch_target_name} ${pch_file_name} lib "-fPIC") diff --git a/data/categories.txt b/data/categories.txt index a02a4d9fa8..a40f7997f6 100644 --- a/data/categories.txt +++ b/data/categories.txt @@ -1075,14 +1075,14 @@ zh-Hans:商店 zh-Hant:1購物|店鋪|商店|雜貨店|便利商店 shop-bakery|shop-pastry|@category_eat|@category_food|@shop -en:3Bakery|3Pastry|Cake|3Cakes|U+1F35E -ru:3Булочная|3пекарня|Торт|3Торты|Пирожные -be:3Булачная|3Пякарня|Торт|3Тарты +en:3Bakery|U+1F35E +ru:3Булочная|3пекарня +be:3Булачная|3Пякарня bg:3Пекарна ar:مخبز|متجر cs:3Pekárna|Pekařství da:3Bager|bageri -nl:3Bakkerij|Bakker|Gebak|Taart|3Taarten +nl:3Bakkerij fi:3Leipomo fr:3Boulangerie|3Pâtisserie|pain de:3Bäckerei|Bäckerladen|Bäcker|4Konditorei @@ -1104,7 +1104,7 @@ eu:3Okindegia sv:3Bageri th:3เบเกอรี่ tr:3Fırın -uk:3Пекарня|Торт|3Торти +uk:3Пекарня vi:Hiệu bánh zh-Hans:1面包店|商店 zh-Hant:1麵包店|2蛋糕店|烘焙|麵包|蛋糕|購物 @@ -2151,15 +2151,14 @@ sk:Obchod s výpočtovou technikou fa:فروشگاه کامپیوتر shop-confectionery|craft-confectionery|@category_food|@shop -en:4Sweets|4confectionery|candies|candy|U+1F36C|U+1F36D|sweetshop|tuck +en:4Sweets|4confectionery|candies|candy|U+1F36C|U+1F36D|cake|sweetshop|tuck|pastry en-AU:Lollies|Candy -ru:4Кондитерская|кондитерские изделия|сладости -bg:Сладки|сладкарница|бонбони|сладкиши -be:4Кандытарская +ru:4Кондитерская|кондитерские изделия|сладости|торты|десерты|пирожные +bg:Сладки|сладкарница|бонбони|торти|сладкиши ar:متجر حلويات|حلويات|حلوى|متجر cs:Cukrárna da:Slikbutik|slikforretning|konfektureforretning|slik|konfekt -nl:Banketbakker|snoepwinkel|snoep|snoepjes|zoetigheden +nl:Banketbakker|snoepwinkel fi:Makeiskauppa fr:Pâtisserie|confiserie de:3Süßwarenladen|Süßwarengeschäft|Süßwaren|4Süßigkeiten|4Konfiserie diff --git a/docs/CPP_STYLE.md b/docs/CPP_STYLE.md index e816472a4b..1180188fa9 100644 --- a/docs/CPP_STYLE.md +++ b/docs/CPP_STYLE.md @@ -4,15 +4,15 @@ In general, [Google's coding standard](https://google.github.io/styleguide/cppgu Below are our specific (but not all!) exceptions to the Google's coding standard: -- All C++ code should conform to the C++17 standard. +- All C++ code should conform to the C++20 standard. - We use `.cpp` and `.hpp` files, not `.cc` and `.h` (`.c` and `.h` are used for C code), in UTF-8 encoding. - File names are lowercase with underscores, like `file_reader.cpp`. - We use `#pragma once` instead of the `#define` Guard in header files. - Includes are sorted and grouped by directory, there should be newlines between different directories. - Order of directories in includes: "current_dir/current_file.hpp", includes from other dirs sorted by dependencies (e.g. indexer, then coding, then base), "defines.hpp", C++ standard library headers, boost headers, 3party. - We ARE using C++ exceptions. -- We are using all features of C++17 except the filesystem which is not fully supported on all platforms. -- We try to limit the usage of boost libraries which require linking (and prefer C++17 types over their boost counterparts). +- We are using all features of C++17 and C++20 except std::filesystem, std::to_chars & std::from_chars which are not fully supported on all platforms. +- We try to limit the usage of boost libraries which require linking (and prefer C++20 types over their boost counterparts). Naming and formatting @@ -195,7 +195,7 @@ v = w * (x + z); - If you see outdated code which can be improved, DO IT NOW (but in a separate pull request or commit)! - Your code should work at least on [mac|linux|android][x86|x86_64], [ios|android][x86|armv7|arm64] architectures -- Your code should compile with C++17 compiler +- Your code should compile with C++20 compiler - Avoid using any new 3party library if it is not fully tested and supported on all our platforms - Cover your code with unit tests. See examples for existing libraries - Check Base and Coding libraries for most of the basic functions