updates to install cmd
This adds support for creating the install destination, giving a user-defined install directory with --root option, and changes the default install directory to ~/.cppship/bin.
Still, there are conflicts. Please resolve it first.
It seems that cppship-examples will check after install, the binary is in /usr/local/bin. You can update cppship-examples to handle both cases.
In addition, you'd better run cppship lint and fmt in advance in your env using llvm@19.
In addition, you'd better run cppship lint and fmt in advance in your env using llvm@19.
Yes, I have run both, but there were no warnings/changes
on feat-install-cmd ❯ git status
On branch feat-install-cmd
Your branch is up to date with 'origin/feat-install-cmd'.
nothing to commit, working tree clean
on feat-install-cmd ❯ cppship lint
lint run clang-tidy
on feat-install-cmd ❯ cppship fmt
format run clang-format
format all files are formated
on feat-install-cmd ❯ git status
On branch feat-install-cmd
Your branch is up to date with 'origin/feat-install-cmd'.
nothing to commit, working tree clean
on feat-install-cmd ❯
Perhaps cppship is not running them for some reason?, but there is no indication of any errors.
Yes, I have run both, but there were no warnings/changes
cppship fmt -c HEAD~6
cppship lint -c HEAD~6
# run this for more options
cppship fmt -h
By default, fmt and lint only runs against uncommitted files.
Perhaps cppship is not running them for some reason?, but there is no indication of any errors
In CI, the following commands are executed:
mergebase=$(git merge-base --fork-point origin/${{github.event.pull_request.base.ref}})
cppship build -d
cppship fmt -c ${mergebase}
cppship lint -c ${mergebase}
Yes, I have run both, but there were no warnings/changes
cppship fmt -c HEAD~6 cppship lint -c HEAD~6 # run this for more options cppship fmt -hBy default, fmt and lint only runs against uncommitted files.
Ah, OK.
running cppship fmt -c main gives
$ cppship lint -c main
lint run clang-tidy
lint /home/cclark/Code/sync/projects/cppship/lib/cmd/build.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/util/cmd.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/cmake/bin.cpp
lint /home/cclark/Code/sync/projects/cppship/src/main.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/cmake/package_configurer.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/cmake/generator.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/cmd/lint.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/cmd/run.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/core/compiler.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/core/dependency.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/cmd/bench.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/util/fs.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/cmd/cmake.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/core/resolver.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/cmd/fmt.cpp
lint /home/cclark/Code/sync/projects/cppship/tests/cmake/package_configurer.cpp
lint /home/cclark/Code/sync/projects/cppship/tests/util/cmd.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/cmd/install.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/cmake/msvc.cpp
lint /home/cclark/Code/sync/projects/cppship/lib/cmd/test.cpp
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/lib/util/fs.cpp:14:55: error: function is not thread safe [concurrency-mt-unsafe,-warnings-as-errors]
14 | fs::path cppship::get_cppship_dir() { return fs::path(std::getenv("HOME")) / kCppShipDirName; }
| ^
lint /home/cclark/Code/sync/projects/cppship/tests/util/fs.cpp
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/core/dependency.h:10:10: error: 'fmt/core.h' file not found [clang-diagnostic-error]
10 | #include <fmt/core.h>
| ^~~~~~~~~~~~
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/core/dependency.h:10:10: error: 'fmt/core.h' file not found [clang-diagnostic-error]
10 | #include <fmt/core.h>
| ^~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/lib/cmake/package_configurer.cpp:41:34: error: unchecked access to optional value [bugprone-unchecked-optional-access,-warnings-as-errors]
41 | const auto lib_target = *layout.lib();
| ^
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/core/profile.h:8:10: error: 'boost/algorithm/string/case_conv.hpp' file not found [clang-diagnostic-error]
8 | #include <boost/algorithm/string/case_conv.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/lib/cmd/install.cpp:15:10: error: function 'run_install' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
15 | int cmd::run_install([[maybe_unused]] const InstallOptions& options)
| ^
| static
/home/cclark/Code/sync/projects/cppship/lib/cmd/install.cpp:17:5: error: missing username/bug in TODO [google-readability-todo,-warnings-as-errors]
17 | // TODO: fix me
| ^~~~~~~~~~~~~~~
| // TODO(cclark): fix me
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/core/dependency.h:10:10: error: 'fmt/core.h' file not found [clang-diagnostic-error]
10 | #include <fmt/core.h>
| ^~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/lib/core/dependency.cpp:27:27: error: function 'parse_conan_cmake_target_file' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
27 | Dependency dep_internals::parse_conan_cmake_target_file(std::string_view cmake_package, const fs::path& target_file)
| ^
| static
/home/cclark/Code/sync/projects/cppship/lib/core/dependency.cpp:78:31: error: function 'collect_conan_deps' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
78 | ResolvedDependencies cppship::collect_conan_deps(const fs::path& conan_dep_dir, std::string_view profile)
| ^
| static
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/util/cmd.h:7:10: error: 'boost/system/error_code.hpp' file not found [clang-diagnostic-error]
7 | #include <boost/system/error_code.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/tests/util/cmd.cpp:10:1: error: variable 'TEST' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
10 | TEST(cmd, has_cmd)
| ^
/home/cclark/Code/sync/projects/cppship/tests/util/cmd.cpp:21:1: error: variable 'TEST' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
21 | TEST(cmd, check_output)
| ^
/home/cclark/Code/sync/projects/cppship/tests/util/cmd.cpp:32:1: error: function 'TEST' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
32 | TEST(cmd, remove_env)
| ^
| static
/home/cclark/Code/sync/projects/cppship/tests/util/cmd.cpp:32:1: error: invalid case style for function 'TEST' [readability-identifier-naming,-warnings-as-errors]
32 | TEST(cmd, remove_env)
| ^~~~
| test
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/lib/core/compiler.cpp:8:10: error: 'boost/algorithm/string.hpp' file not found [clang-diagnostic-error]
8 | #include <boost/algorithm/string.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/lib/core/compiler.cpp:115:5: error: 'mId' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer,-warnings-as-errors]
111 | , mVersion(get_compiler_version(mCommand))
| mId(get_compiler_id(out)),
112 | {
113 | const auto out = check_output(fmt::format("{} --version | head -n1", mCommand));
114 |
115 | mId = get_compiler_id(out);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/core/resolver.h:8:10: error: 'gsl/pointers' file not found [clang-diagnostic-error]
8 | #include <gsl/pointers>
| ^~~~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/lib/core/resolver.cpp:15:1: error: constructor does not initialize these fields: mDepsDir, mManifest, mFetcher, mUnresolved, mPackageSeen [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
15 | Resolver::Resolver(const fs::path& deps_dir, gsl::not_null<const Manifest*> manifest, GitFetcher fetcher)
| ^
/home/cclark/Code/sync/projects/cppship/lib/core/resolver.cpp:52:24: error: variable 'existed' is not initialized [cppcoreguidelines-init-variables,-warnings-as-errors]
52 | if (const bool existed = !mPackageSeen.insert(dep.package).second; existed) {
| ^
| = false
/home/cclark/Code/sync/projects/cppship/lib/core/resolver.cpp:112:16: error: invalid case style for method 'resolve_package_' [readability-identifier-naming,-warnings-as-errors]
112 | void Resolver::resolve_package_(std::string_view package, const fs::path& package_dir)
| ^~~~~~~~~~~~~~~~
| resolve_package
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/cmake/generator.h:8:10: error: 'gsl/pointers' file not found [clang-diagnostic-error]
8 | #include <gsl/pointers>
| ^~~~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/lib/cmake/generator.cpp:31:32: error: function 'resolve_deps' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
31 | std::vector<cmake::Dep> cmake::resolve_deps(
| ^
| static
/home/cclark/Code/sync/projects/cppship/lib/cmake/generator.cpp:74:1: error: constructor does not initialize these fields: mLayout, mDeps, mDevDeps, mInjector, mBinaryTargets, mExampleTargets, mBenchTargets, mTestTargets [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
74 | CmakeGenerator::CmakeGenerator(gsl::not_null<const Layout*> layout, const Manifest& manifest, GeneratorOptions options)
| ^
/home/cclark/Code/sync/projects/cppship/lib/cmake/generator.cpp:358:19: error: member 'mOut' of type 'std::ostream &' (aka 'basic_ostream<char> &') is a reference [cppcoreguidelines-avoid-const-or-ref-data-members,-warnings-as-errors]
358 | std::ostream& mOut;
| ^
/home/cclark/Code/sync/projects/cppship/lib/cmake/generator.cpp:361:5: error: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor,-warnings-as-errors]
361 | ProfileOptionGen(std::ostream& out)
| ^
| explicit
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/tests/util/fs.cpp:3:10: error: 'gtest/gtest.h' file not found [clang-diagnostic-error]
3 | #include <gtest/gtest.h>
| ^~~~~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/tests/util/fs.cpp:7:1: error: variable 'TEST' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
7 | TEST(fs, ScopedCurrentDir)
| ^
/home/cclark/Code/sync/projects/cppship/tests/util/fs.cpp:21:1: error: variable 'TEST' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
21 | TEST(fs, CreateIfNotExist)
| ^
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/cmd/build.h:7:10: error: 'boost/algorithm/string/case_conv.hpp' file not found [clang-diagnostic-error]
7 | #include <boost/algorithm/string/case_conv.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/core/dependency.h:10:10: error: 'fmt/core.h' file not found [clang-diagnostic-error]
10 | #include <fmt/core.h>
| ^~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/tests/cmake/package_configurer.cpp:17:1: error: function 'TEST' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
17 | TEST(package_configurer, HeaderOnly)
| ^
| static
/home/cclark/Code/sync/projects/cppship/tests/cmake/package_configurer.cpp:17:1: error: invalid case style for function 'TEST' [readability-identifier-naming,-warnings-as-errors]
17 | TEST(package_configurer, HeaderOnly)
| ^~~~
| test
/home/cclark/Code/sync/projects/cppship/tests/cmake/package_configurer.cpp:53:1: error: function 'TEST' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
53 | TEST(package_configurer, CppshipHeaderOnly)
| ^
| static
/home/cclark/Code/sync/projects/cppship/tests/cmake/package_configurer.cpp:53:1: error: invalid case style for function 'TEST' [readability-identifier-naming,-warnings-as-errors]
53 | TEST(package_configurer, CppshipHeaderOnly)
| ^~~~
| test
/home/cclark/Code/sync/projects/cppship/tests/cmake/package_configurer.cpp:109:1: error: function 'TEST' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
109 | TEST(package_configurer, CppshipLib)
| ^
| static
/home/cclark/Code/sync/projects/cppship/tests/cmake/package_configurer.cpp:109:1: error: invalid case style for function 'TEST' [readability-identifier-naming,-warnings-as-errors]
109 | TEST(package_configurer, CppshipLib)
| ^~~~
| test
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/src/main.cpp:7:10: error: 'argparse/argparse.hpp' file not found [clang-diagnostic-error]
7 | #include <argparse/argparse.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/src/main.cpp:33:5: error: constructor does not initialize these fields: parser [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
30 | ArgumentParser parser;
|
| {}
31 | CommandRunner cmd_runner;
32 |
33 | SubCommand(std::string_view cmd, const ArgumentParser& common, CommandRunner runner)
| ^
/home/cclark/Code/sync/projects/cppship/src/main.cpp:44:9: error: function 'get_profile' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
44 | Profile get_profile(const ArgumentParser& cmd)
| ^
| static
/home/cclark/Code/sync/projects/cppship/src/main.cpp:53:5: error: function 'get_concurrency' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
53 | int get_concurrency(const ArgumentParser& cmd)
| ^
| static
/home/cclark/Code/sync/projects/cppship/src/main.cpp:63:8: error: function 'parse_cxx_std' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
63 | CxxStd parse_cxx_std(const int value)
| ^
| static
/home/cclark/Code/sync/projects/cppship/src/main.cpp:73:23: error: function 'build_commands' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
73 | std::list<SubCommand> build_commands(const ArgumentParser& common)
| ^
| static
/home/cclark/Code/sync/projects/cppship/src/main.cpp:321:7: error: empty catch statements hide issues; to handle exceptions appropriately, consider re-throwing, handling, or avoiding catch altogether [bugprone-empty-catch,-warnings-as-errors]
321 | } catch (const CmdNotFound& e) {
| ^
/home/cclark/Code/sync/projects/cppship/src/main.cpp:323:7: error: empty catch statements hide issues; to handle exceptions appropriately, consider re-throwing, handling, or avoiding catch altogether [bugprone-empty-catch,-warnings-as-errors]
323 | } catch (const Error& e) {
| ^
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/lib/cmd/fmt.cpp:5:10: error: 'boost/process/system.hpp' file not found [clang-diagnostic-error]
5 | #include <boost/process/system.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/util/cmd.h:7:10: error: 'boost/system/error_code.hpp' file not found [clang-diagnostic-error]
7 | #include <boost/system/error_code.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/lib/util/cmd.cpp:12:15: error: function 'has_cmd' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
12 | bool cppship::has_cmd(std::string_view cmd)
| ^
| static
/home/cclark/Code/sync/projects/cppship/lib/util/cmd.cpp:18:14: error: function 'run_cmd' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
18 | int cppship::run_cmd(const std::string_view cmd)
| ^
| static
/home/cclark/Code/sync/projects/cppship/lib/util/cmd.cpp:37:22: error: function 'check_output' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
37 | std::string cppship::check_output(std::string_view cmd)
| ^
| static
/home/cclark/Code/sync/projects/cppship/lib/util/cmd.cpp:40:15: error: variable 'res' is not initialized [cppcoreguidelines-init-variables,-warnings-as-errors]
40 | const int res = system(std::string(cmd), std_out > pipe, shell);
| ^
| = 0
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/lib/cmd/lint.cpp:7:10: error: 'BS_thread_pool_light.hpp' file not found [clang-diagnostic-error]
7 | #include <BS_thread_pool_light.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/lib/cmd/cmake.cpp:5:10: error: 'boost/algorithm/string/replace.hpp' file not found [clang-diagnostic-error]
5 | #include <boost/algorithm/string/replace.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/lib/cmd/cmake.cpp:19:10: error: function 'run_cmake' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
19 | int cmd::run_cmake(const CmakeOptions&)
| ^
| static
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/core/profile.h:8:10: error: 'boost/algorithm/string/case_conv.hpp' file not found [clang-diagnostic-error]
8 | #include <boost/algorithm/string/case_conv.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/lib/cmd/test.cpp:16:10: error: function 'run_test' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
16 | int cmd::run_test(const TestOptions& options)
| ^
| static
/home/cclark/Code/sync/projects/cppship/lib/cmd/test.cpp:41:35: error: repeated branch body in conditional chain [bugprone-branch-clone,-warnings-as-errors]
41 | } else if (build_opts.target) {
| ^
/home/cclark/Code/sync/projects/cppship/lib/cmd/test.cpp:43:6: note: end of the original
43 | } else if (options.name_regex) {
| ^
/home/cclark/Code/sync/projects/cppship/lib/cmd/test.cpp:43:36: note: clone 1 starts here
43 | } else if (options.name_regex) {
| ^
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/core/profile.h:8:10: error: 'boost/algorithm/string/case_conv.hpp' file not found [clang-diagnostic-error]
8 | #include <boost/algorithm/string/case_conv.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/lib/cmd/run.cpp:56:10: error: function 'run_run' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
56 | int cmd::run_run(const RunOptions& options)
| ^
| static
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/core/profile.h:8:10: error: 'boost/algorithm/string/case_conv.hpp' file not found [clang-diagnostic-error]
8 | #include <boost/algorithm/string/case_conv.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/lib/cmd/bench.cpp:34:10: error: function 'run_bench' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
34 | int cmd::run_bench(const BenchOptions& options)
| ^
| static
error: unknown warning option '-Wno-dangling-reference' [clang-diagnostic-unknown-warning-option]
error: unknown warning option '-Wno-restrict' [clang-diagnostic-unknown-warning-option]
/home/cclark/Code/sync/projects/cppship/include/cppship/cmd/build.h:7:10: error: 'boost/algorithm/string/case_conv.hpp' file not found [clang-diagnostic-error]
7 | #include <boost/algorithm/string/case_conv.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cclark/Code/sync/projects/cppship/lib/cmd/build.cpp:91:45: error: repeated branch body in conditional chain [bugprone-branch-clone,-warnings-as-errors]
91 | if (line.starts_with("build_type")) {
| ^
/home/cclark/Code/sync/projects/cppship/lib/cmd/build.cpp:93:10: note: end of the original
93 | } else if (line.starts_with("compiler.cppstd")) {
| ^
/home/cclark/Code/sync/projects/cppship/lib/cmd/build.cpp:93:57: note: clone 1 starts here
93 | } else if (line.starts_with("compiler.cppstd")) {
| ^
/home/cclark/Code/sync/projects/cppship/lib/cmd/build.cpp:305:25: error: repeated branch body in conditional chain [bugprone-branch-clone,-warnings-as-errors]
305 | if (options.target) {
| ^
/home/cclark/Code/sync/projects/cppship/lib/cmd/build.cpp:307:6: note: end of the original
307 | } else if (options.groups.empty()) {
| ^
/home/cclark/Code/sync/projects/cppship/lib/cmd/build.cpp:307:40: note: clone 1 starts here
307 | } else if (options.groups.empty()) {
| ^
/home/cclark/Code/sync/projects/cppship/lib/cmd/build.cpp:309:12: note: clone 2 starts here
309 | } else {
| ^
The call to std::getenv is from me, but cppref says it has been thread-safe since C++11.
most (maybe all?) of the other warnings are in files I haven't modified. Does it lint clean on your machine?
I compiled llvm 19.1.7 from source and used Lmod to configure load it into my environment because clang-15 is the newest version on Ubuntu 22.04.
What should I do here?
- std::getenv is mt-safe only if no other concurrent calls to post setenv, maybe you can use boost::process
- you're using gcc to generate compile_commands.json, will gives some gcc-specific flags in compile_commands.json, I'll address this later. Now you can just fix the conflicts and commit again, let the github actions to run the lint.