diff --git a/examples/.clang-tidy b/examples/.clang-tidy index fe6fafe..ef3c154 100644 --- a/examples/.clang-tidy +++ b/examples/.clang-tidy @@ -2,4 +2,5 @@ InheritParentConfig: true # exceptions for testing Checks: > -readability-magic-numbers, - -cppcoreguidelines-pro-bounds-pointer-arithmetic + -cppcoreguidelines-pro-bounds-pointer-arithmetic, + -cppcoreguidelines-avoid-non-const-global-variables diff --git a/examples/configurable_plugin/configurable_plugin.h b/examples/configurable_plugin/configurable_plugin.h index da888fa..ecfe589 100644 --- a/examples/configurable_plugin/configurable_plugin.h +++ b/examples/configurable_plugin/configurable_plugin.h @@ -1,5 +1,5 @@ -#ifndef PPPLUGIN__EXAMPLES__SIMPLE_PLUGIN_H -#define PPPLUGIN__EXAMPLES__SIMPLE_PLUGIN_H +#ifndef PPPLUGIN_EXAMPLES_CONFIGURABLE_PLUGIN_H +#define PPPLUGIN_EXAMPLES_CONFIGURABLE_PLUGIN_H #include #include @@ -28,7 +28,7 @@ class ConfigurablePluginInterface { template void print(T&& arg) { - std::cout << arg << std::flush; + std::cout << std::forward(arg) << std::flush; } static void sleep(std::chrono::milliseconds duration) { @@ -53,4 +53,4 @@ class ConfigurablePluginA : public ConfigurablePluginInterface { void loop(const std::atomic& stop) override; }; -#endif // PPPLUGIN__EXAMPLES__SIMPLE_PLUGIN_H +#endif // PPPLUGIN_EXAMPLES_CONFIGURABLE_PLUGIN_H diff --git a/examples/configurable_plugin/configurable_plugin_manager.cpp b/examples/configurable_plugin/configurable_plugin_manager.cpp index d05c23c..33f858f 100644 --- a/examples/configurable_plugin/configurable_plugin_manager.cpp +++ b/examples/configurable_plugin/configurable_plugin_manager.cpp @@ -36,7 +36,7 @@ int main(int argc, char* argv[]) std::cerr << "A fatal error occurred: '" << exception.what() << "'\n"; return 1; } catch (...) { - std::cerr << "An unknown fatal error occurred!"; + std::cerr << "An unknown fatal error occurred!\n"; return 1; } return 0; diff --git a/examples/simple_plugin/simple_plugin.h b/examples/simple_plugin/simple_plugin.h index 665d6a7..8a4b66c 100644 --- a/examples/simple_plugin/simple_plugin.h +++ b/examples/simple_plugin/simple_plugin.h @@ -1,5 +1,5 @@ -#ifndef PPPLUGIN__EXAMPLES__SIMPLE_PLUGIN_H -#define PPPLUGIN__EXAMPLES__SIMPLE_PLUGIN_H +#ifndef PPPLUGIN_EXAMPLES_SIMPLE_PLUGIN_H +#define PPPLUGIN_EXAMPLES_SIMPLE_PLUGIN_H #include #include @@ -21,7 +21,7 @@ class SimplePluginInterface { template void print(T&& arg) { - std::cout << arg << std::flush; + std::cout << std::forward(arg) << std::flush; } static void sleep(std::chrono::milliseconds duration) { @@ -44,4 +44,4 @@ class SimplePluginA : public SimplePluginInterface { int i_ { 0 }; }; -#endif // PPPLUGIN__EXAMPLES__SIMPLE_PLUGIN_H +#endif // PPPLUGIN_EXAMPLES_SIMPLE_PLUGIN_H diff --git a/examples/simple_plugin/simple_plugin_manager.cpp b/examples/simple_plugin/simple_plugin_manager.cpp index 41365dc..41b044f 100644 --- a/examples/simple_plugin/simple_plugin_manager.cpp +++ b/examples/simple_plugin/simple_plugin_manager.cpp @@ -11,7 +11,7 @@ void printError(std::string_view function_name, const ppplugin::CallError& error : error == ppplugin::CallError::Code::unknown ? "unknown error" : "other error"; std::cerr << "Unable to call '" << function_name << "' ('" << error_string - << "')!" << std::endl; + << "')!\n"; } void printError(std::string_view plugin_name, ppplugin::LoadError error) @@ -22,7 +22,7 @@ void printError(std::string_view plugin_name, ppplugin::LoadError error) : error == LoadError::unknown ? "unknown error" : "other error"; std::cerr << "Unable to load '" << plugin_name << "' ('" << error_string - << "')!" << std::endl; + << "')!\n"; } template @@ -66,7 +66,7 @@ int main(int argc, char* argv[]) std::cerr << "A fatal error occurred: '" << exception.what() << "'\n"; return 1; } catch (...) { - std::cerr << "An unknown fatal error occurred!"; + std::cerr << "An unknown fatal error occurred!\n"; return 1; } return 0;