From 4bc6db4abc83a65c822a83588189fa9db39754f1 Mon Sep 17 00:00:00 2001 From: Tim Landscheidt Date: Mon, 19 Feb 2018 21:38:39 +0000 Subject: Fix warnings for -Wimplicit-fallthrough --- src/error.h | 2 +- src/mask.cc | 3 +-- src/query.cc | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/error.h b/src/error.h index 88e09329..a628c1e9 100644 --- a/src/error.h +++ b/src/error.h @@ -47,7 +47,7 @@ namespace ledger { extern std::ostringstream _desc_buffer; template -inline void throw_func(const string& message) { +[[ noreturn ]] inline void throw_func(const string& message) { _desc_buffer.clear(); _desc_buffer.str(""); throw T(message); diff --git a/src/mask.cc b/src/mask.cc index 434acad6..35e690de 100644 --- a/src/mask.cc +++ b/src/mask.cc @@ -75,9 +75,8 @@ mask_t& mask_t::assign_glob(const string& pat) if (i + 1 < len) { re_pat += pat[++i]; break; - } else { - // fallthrough... } + // fallthrough... default: re_pat += pat[i]; break; diff --git a/src/query.cc b/src/query.cc index fc1d4ff0..883bea40 100644 --- a/src/query.cc +++ b/src/query.cc @@ -155,6 +155,7 @@ query_t::lexer_t::next_token(query_t::lexer_t::token_t::kind_t tok_context) case ')': if (! consume_next && tok_context == token_t::TOK_EXPR) goto test_ident; + // fall through... case '(': case '&': case '|': -- cgit v1.2.3 From da9738f8ee7785724d62eb94747d7803502545a8 Mon Sep 17 00:00:00 2001 From: Tim Landscheidt Date: Sat, 12 Jan 2019 14:27:50 +0000 Subject: Remove unused macros HAVE_ACCESS and HAVE_REALPATH --- CMakeLists.txt | 2 -- src/system.hh.in | 4 +--- src/utils.h | 6 +----- 3 files changed, 2 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/CMakeLists.txt b/CMakeLists.txt index e2ed3cac..c85a5157 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,8 +96,6 @@ include(CheckCXXSourceCompiles) include(CheckCXXSourceRuns) include(CMakePushCheckState) -check_function_exists(access HAVE_ACCESS) -check_function_exists(realpath HAVE_REALPATH) check_function_exists(getpwuid HAVE_GETPWUID) check_function_exists(getpwnam HAVE_GETPWNAM) check_function_exists(ioctl HAVE_IOCTL) diff --git a/src/system.hh.in b/src/system.hh.in index 38ac1e63..799bb47c 100644 --- a/src/system.hh.in +++ b/src/system.hh.in @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2018, John Wiegley. All rights reserved. + * Copyright (c) 2003-2019, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -60,8 +60,6 @@ #define HAVE_EDIT @HAVE_EDIT@ #define HAVE_GETTEXT @HAVE_GETTEXT@ -#cmakedefine HAVE_ACCESS -#cmakedefine HAVE_REALPATH #cmakedefine HAVE_GETPWUID #cmakedefine HAVE_GETPWNAM #cmakedefine HAVE_IOCTL diff --git a/src/utils.h b/src/utils.h index 857b8289..c9146dd7 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2018, John Wiegley. All rights reserved. + * Copyright (c) 2003-2019, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -500,10 +500,6 @@ inline T& downcast(U& object) { path resolve_path(const path& pathname); -#ifdef HAVE_REALPATH -extern "C" char * realpath(const char *, char resolved_path[]); -#endif - inline const string& either_or(const string& first, const string& second) { return first.empty() ? second : first; -- cgit v1.2.3 From 15e5a6835005f0af7e26e19492764106ec3777a6 Mon Sep 17 00:00:00 2001 From: Tim Landscheidt Date: Sat, 12 Jan 2019 21:43:12 +0000 Subject: Remove unnecessary include for sys/stat.h --- src/system.hh.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/system.hh.in b/src/system.hh.in index 38ac1e63..e36d0aa3 100644 --- a/src/system.hh.in +++ b/src/system.hh.in @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2018, John Wiegley. All rights reserved. + * Copyright (c) 2003-2019, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -143,7 +143,6 @@ typedef std::ostream::pos_type ostream_pos_type; #undef isspace(c) #endif -#include #if defined(_WIN32) || defined(__CYGWIN__) #include #else -- cgit v1.2.3 From dac56df1f4f9bcdce87d4b095310af49e74d9395 Mon Sep 17 00:00:00 2001 From: Tim Landscheidt Date: Sun, 13 Jan 2019 16:59:06 +0000 Subject: Remove unnecessary include for unicodeobject.h --- src/system.hh.in | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/system.hh.in b/src/system.hh.in index 38ac1e63..3d5451cb 100644 --- a/src/system.hh.in +++ b/src/system.hh.in @@ -247,7 +247,6 @@ typedef std::ostream::pos_type ostream_pos_type; #include #include -#include #include #include -- cgit v1.2.3 From 34eab875c541c6c2f40a8b3db712b2e7ef33b4cd Mon Sep 17 00:00:00 2001 From: Tim Landscheidt Date: Sun, 13 Jan 2019 17:48:58 +0000 Subject: Remove unused function py_dump_relaxed() The only user of py_dump_relaxed() was removed in commit 0bbb4f2f0cbaa6ffb5c7a2c018a3819cca0b2405. --- src/py_value.cc | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src') diff --git a/src/py_value.cc b/src/py_value.cc index f4f63946..486228c0 100644 --- a/src/py_value.cc +++ b/src/py_value.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2018, John Wiegley. All rights reserved. + * Copyright (c) 2003-2019, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -88,12 +88,6 @@ namespace { return buf.str(); } - string py_dump_relaxed(const value_t& value) { - std::ostringstream buf; - value.dump(buf, true); - return buf.str(); - } - void py_set_string(value_t& value, const string& str) { return value.set_string(str); } -- cgit v1.2.3 From 2ef1fbd738577a2ea1eb332d4a777ec659366b7d Mon Sep 17 00:00:00 2001 From: Tim Landscheidt Date: Mon, 14 Jan 2019 18:34:20 +0000 Subject: Fix warning about uninitialized variable prepend_width --- src/output.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/output.cc b/src/output.cc index c2fa83ac..09d3ad9e 100644 --- a/src/output.cc +++ b/src/output.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2018, John Wiegley. All rights reserved. + * Copyright (c) 2003-2019, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -284,8 +284,9 @@ void report_accounts::flush() std::ostream& out(report.output_stream); format_t prepend_format; std::size_t prepend_width; + bool do_prepend_format; - if (report.HANDLED(prepend_format_)) { + if ((do_prepend_format = report.HANDLED(prepend_format_))) { prepend_format.parse_format(report.HANDLER(prepend_format_).str()); prepend_width = report.HANDLED(prepend_width_) ? lexical_cast(report.HANDLER(prepend_width_).str()) @@ -293,7 +294,7 @@ void report_accounts::flush() } foreach (accounts_pair& entry, accounts) { - if (prepend_format) { + if (do_prepend_format) { bind_scope_t bound_scope(report, *entry.first); out.width(static_cast(prepend_width)); out << prepend_format(bound_scope); -- cgit v1.2.3