Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c++20 #73

Merged
merged 2 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 13 additions & 19 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ Checks: '
modernize-*
mpi-*,
bugprone-*,
cppcoreguidelines-pro-type-member-init,
cppcoreguidelines-slicing,
cppcoreguidelines-interfaces-global-init,
cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-narrowing-conversions,
cppcoreguidelines-*,
google-default-arguments,
google-runtime-operator,
google-explicit-constructor,
Expand All @@ -21,7 +17,6 @@ Checks: '
misc-throw-by-value-catch-by-reference,
misc-uniqueptr-reset-release,
modernize-*,
cppcoreguidelines-*,
openmp-use-default-none,
portability-simd-intrinsics,
readability-identifier-naming,
Expand All @@ -37,33 +32,32 @@ Checks: '
-readability-isolate-declaration,
-readability-uppercase-literal-suffix,
-readability-container-data-pointer,
-modernize-use-trailing-return-type,
-modernize-use-trailing-return-type,
-readability-magic-numbers,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-avoid-const-or-ref-data-members,
-modernize-pass-by-value,
-modernize-raw-string-literal,
-misc-no-recursion,
-bugprone-easily-swappable-parameters,
-cppcoreguidelines-owning-memory,
-readability-magic-numbers,
-hicpp-exception-baseclass,
-cppcoreguidelines-avoid-magic-numbers,
-bugprone-narrowing-conversions,
-cppcoreguidelines-narrowing-conversions,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-avoid-c-arrays,
-modernize-avoid-c-arrays,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-explicit-virtual-functions,
-modernize-use-override,
-modernize-use-emplace,
-cppcoreguidelines-special-member-functions,
-cppcoreguidelines-prefer-member-initializer,
-cppcoreguidelines-virtual-class-destructor,
-modernize-use-trailing-return-type,
-modernize-pass-by-value,
-modernize-raw-string-literal,
-modernize-avoid-c-arrays,
-modernize-use-override,
-modernize-use-emplace,
-misc-no-recursion,
-bugprone-narrowing-conversions,
-bugprone-easily-swappable-parameters,
-modernize-use-equals-default,
-google-explicit-constructor,
-cppcoreguidelines-virtual-class-destructor
-hicpp-exception-baseclass
'

CheckOptions:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project(timeit)
find_program(CLANG_TIDY_EXE NAMES "clang-tidy")
set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}" "--config-file=${PROJECT_SOURCE_DIR}/.clang-tidy")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


Expand Down
2 changes: 1 addition & 1 deletion src/lib/inc/libtimeit/misc/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class file
file( file && ) = delete;
~file();

explicit operator FILE*() const;
operator FILE*() const;

file & operator=( const file & ) = delete;
file & operator=( file && ) = delete;
Expand Down
10 changes: 5 additions & 5 deletions src/lib/src/Misc/exporters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ bool export_to_csv( database& db , const string &filename, time_point<system_clo
file output( filename, "w" );
for (auto item: items)
{
fmt::print( static_cast<FILE*>(output), ",{}", item.name);
fmt::print( output, ",{}", item.name);
}
fmt::print( static_cast<FILE*>(output) , "\n");
fmt::print( output , "\n");
auto day_pointer = report_start;
while ( day_pointer < report_end)
{
Expand All @@ -29,14 +29,14 @@ bool export_to_csv( database& db , const string &filename, time_point<system_clo

auto date = date_string(day_pointer);

fmt::print( static_cast<FILE*>(output) , date );
fmt::print( output , fmt::runtime(date) );
for (auto item: items)
{
auto duration = times.duration_time( item.id, start, stop );
auto duration_str = hh_mm( seconds(duration) );
fmt::print( static_cast<FILE*>(output), ",{}", duration_str);
fmt::print( output, ",{}", duration_str);
}
fmt::print( static_cast<FILE*>(output), "\n");
fmt::print( output, "\n");
day_pointer += 24h;
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/src/Sync/http_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ http_response http_request::put(
string password
)
{
curl_easy_setopt(curl, CURLOPT_PUT, 1L); // NOLINT
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); // NOLINT
receive_buffer.clear();
send_buffer = data;
cur_send_position = 0;
Expand Down Expand Up @@ -103,4 +103,4 @@ http_response http_request::put(
curl_slist_free_all(headers);
return result;
}
}
}
2 changes: 1 addition & 1 deletion src/lib/src/Sync/sync_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void sync_manager::manage_network_problems()
{
std::stringstream text;
// {} is replaced with the URI on which the connection failed
text << fmt::format(_("Failed connection to {}:\n"), result.url.c_str());
text << fmt::format(fmt::runtime(_("Failed connection to {}:\n")), result.url.c_str());

text << _("HTTP error ") << result.http_code << " ";
if (result.http_code == http_unauthorized)
Expand Down
4 changes: 2 additions & 2 deletions src/timeit_gtkmm/gui/details.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void details::on_menu_file_popup_remove()
if (minutes_to_lose > idle_gt || minutes_to_lose > idle_gz || minutes_to_lose < 0min)
{
secondary_text = fmt::format(
_("Removing will lose {} minutes.\n\nRemoving will be permanent."),
fmt::runtime(_("Removing will lose {} minutes.\n\nRemoving will be permanent.")),
minutes_string.c_str());
}
else
Expand Down Expand Up @@ -206,7 +206,7 @@ void details::on_menu_file_popup_merge()
minutes_to_gain < 0min)
{
secondary_text = fmt::format(
_("Merging will add {} minutes.\n\nMerging with the next row will be permanent."),
fmt::runtime(_("Merging will add {} minutes.\n\nMerging with the next row will be permanent.")),
minutes_string.c_str());
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/timeit_gtkmm/gui/idle_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void idle_dialog::set_text()
std::string format_str = ngettext("No activity has been detected for {} minute. What should we do?",
"No activity has been detected for {} minutes. What should we do?",
minutes_idle.count());
str << fmt::format(format_str, minutes_idle.count());
str << fmt::format(fmt::runtime(format_str), minutes_idle.count());

if ( !task_string.empty() )
{
Expand Down
Loading