Skip to content

Commit

Permalink
Merge #177: cmake, lint: Adjust lint_includes_build_config
Browse files Browse the repository at this point in the history
61735ef Remove unused `#include <config/bitcoin-config.h>` (Hennadii Stepanov)
b8936d3 cmake, lint: Adjust `lint_includes_build_config` (Hennadii Stepanov)
db240cf fixup! cmake: Add `config/bitcoin-config.h` support (Hennadii Stepanov)

Pull request description:

  The linter has been adjusted to consider CMake-specific `bitcoin-config.h.in` file.

  Linter warnings have been fixed.

  Can be tested by running linters [locally](https://github.com/bitcoin/bitcoin/tree/master/test/lint#running-locally).

Top commit has no ACKs.

Tree-SHA512: b1ae7b828b64a1678bfb6fc8c9f84baece031bd5aa324a2dab2f204939c2fa946561c4241d96185b5a16a68737311190cf2e9d431c86aed4c4128a0418688ea4
  • Loading branch information
hebasto committed May 21, 2024
2 parents e8e0e69 + 61735ef commit f091e5d
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 22 deletions.
5 changes: 2 additions & 3 deletions cmake/bitcoin-config.h.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Copyright (c) 2023 The Bitcoin Core developers
// Copyright (c) 2023-present The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// file COPYING or https://opensource.org/license/mit/.

#ifndef BITCOIN_CONFIG_H

#define BITCOIN_CONFIG_H

/* Version Build */
Expand Down
2 changes: 0 additions & 2 deletions src/crypto/sha256.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <config/bitcoin-config.h> // IWYU pragma: keep

#include <crypto/sha256.h>
#include <crypto/common.h>

Expand Down
2 changes: 0 additions & 2 deletions src/httpserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <config/bitcoin-config.h> // IWYU pragma: keep

#include <httpserver.h>

#include <chainparamsbase.h>
Expand Down
2 changes: 0 additions & 2 deletions src/qt/qrimagewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <QMouseEvent>
#include <QPainter>

#include <config/bitcoin-config.h> // IWYU pragma: keep

#ifdef USE_QRCODE
#include <qrencode.h>
#endif
Expand Down
2 changes: 0 additions & 2 deletions src/qt/receiverequestdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include <QDialog>
#include <QString>

#include <config/bitcoin-config.h> // IWYU pragma: keep

ReceiveRequestDialog::ReceiveRequestDialog(QWidget* parent)
: QDialog(parent, GUIUtil::dialog_flags),
ui(new Ui::ReceiveRequestDialog)
Expand Down
2 changes: 0 additions & 2 deletions src/test/util_threadnames_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include <thread>
#include <vector>

#include <config/bitcoin-config.h> // IWYU pragma: keep

#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_SUITE(util_threadnames_tests)
Expand Down
12 changes: 3 additions & 9 deletions test/lint/test_runner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,14 @@ Please add any false positives, such as subtrees, or externally sourced files to
}

fn lint_includes_build_config() -> LintResult {
let config_path = "./src/config/bitcoin-config.h.in";
if !Path::new(config_path).is_file() {
assert!(Command::new("./autogen.sh")
.status()
.expect("command error")
.success());
}
let config_path = "./cmake/bitcoin-config.h.in";
let defines_regex = format!(
r"^\s*(?!//).*({})",
check_output(Command::new("grep").args(["undef ", "--", config_path]))
check_output(Command::new("grep").args(["define", "--", config_path]))
.expect("grep failed")
.lines()
.map(|line| {
line.split("undef ")
line.split_whitespace()
.nth(1)
.unwrap_or_else(|| panic!("Could not extract name in line: {line}"))
})
Expand Down

0 comments on commit f091e5d

Please sign in to comment.