Commit Graph

187 Commits

Author SHA1 Message Date
Riahiamirreza
f24f4fa3f1
Update developer-notes.md 2023-04-14 20:11:51 +03:30
fanquake
3d53a85ddf
Merge bitcoin/bitcoin#27220: doc: update broken str util reference links on developer-notes
da347de530 doc: update broken links (pablomartin4btc)

Pull request description:

  References to `utilstrencodings` and `lint-locale-dependence.sh` where incorrect, updating them accordingly.

  Also, adding another reference to util function [`LocaleIndependentAtoi`](https://github.com/bitcoin/bitcoin/blob/master/src/util/strencodings.h#L108-L118), which is related with the updated section of the guide:

  ```
  // LocaleIndependentAtoi is provided for backwards compatibility reasons.
  //
  // New code should use ToIntegral or the ParseInt* functions
  // which provide parse error feedback.
  //
  // The goal of LocaleIndependentAtoi is to replicate the defined behaviour of
  // std::atoi as it behaves under the "C" locale, and remove some undefined
  // behavior. If the parsed value is bigger than the integer type's maximum
  // value, or smaller than the integer type's minimum value, std::atoi has
  // undefined behavior, while this function returns the maximum or minimum
  // values, respectively.
  ```

ACKs for top commit:
  MarcoFalke:
    lgtm ACK da347de530

Tree-SHA512: c8f4cd9cff1fb3ea367ac9dbe5aa45dc187fc60114f2e2106e02e0e17fea4ee34d6e0c408fe920c2d8765e06b4dc30c231f0454fa35469c4399e0cadbcd341ba
2023-03-11 11:02:03 +01:00
TheCharlatan
54c4d03578
doc: Show how less noisy clang-tidy output can be achieved 2023-03-10 16:47:41 +01:00
pablomartin4btc
da347de530 doc: update broken links 2023-03-08 18:26:41 -03:00
fanquake
84ca5b349e
doc: mention sanitizer suppressions in developer docs
Should be enough to close #17834.
2023-02-24 12:16:37 +00:00
fanquake
8d69b614cc
Merge bitcoin/bitcoin#23810: docs: avoid C-style casts; use modern C++ casts
75347236f2 docs: document c-style cast prohibition (Pasta)

Pull request description:

  In the words of practicalswift:
  ```
  A C-style cast is equivalent to try casting in the following order:

      const_cast(...)
      static_cast(...)
      const_cast(static_cast(...))
      reinterpret_cast(...)
      const_cast(reinterpret_cast(...))

  By using static_cast<T>(...) explicitly we avoid the possibility of an unintentional and
  dangerous reinterpret_cast. Furthermore static_cast<T>(...) allows for easier grepping of casts.

  For a more thorough discussion, see "ES.49: If you must use a cast, use a named cast"
  in the C++ Core Guidelines (Stroustrup & Sutter).
  ```

  Modern tooling, specifically `-Wold-style-cast` can enable us to enforce never using C-style casts. I believe this is especially important due to the number of C-style casts the codebase is currently being used as a reinterpret_cast. reinterpret_casts are especially dangerous, and should never be done via C-style casts.

  Update the docs to suggest the use of named cast or functional casts.

Top commit has no ACKs.

Tree-SHA512: 29a98de396f0c78e32d8a1831319162203c4405a670da5add5da956fcc7df200a1cec162ef1cfac4ddfb02714b66406081d40ed435c7f0f28581cfa24d94fac1
2023-02-08 10:36:43 +00:00
James O'Beirne
00eeb31c76 scripted-diff: rename CChainState -> Chainstate
-BEGIN VERIFY SCRIPT-
sed -i 's/CChainState/Chainstate/g' $(git grep -l CChainState ':(exclude)doc/release-notes*')
-END VERIFY SCRIPT-

Co-authored-by: MacroFake <falke.marco@gmail.com>
2022-09-09 11:47:27 -04:00
Jon Atack
9580480570 Update debug logging section in the developer notes 2022-08-20 13:40:03 +02:00
Vasil Dimov
dc02edcba1
doc: update the URLs to thread functions in developer-notes
ThreadMapPort() does not appear on doxygen.bitcoincore.org
because it is inside `#ifdef`.
2022-07-11 09:56:24 +02:00
Vasil Dimov
c5cc3f140c
doc: list the I2P accept thread in developer-notes 2022-07-07 15:07:07 +02:00
fanquake
d873ff96e5
refactor: cleanups post unsubtree'ing univalue
Mostly changes to remove src/univalue exceptions from the various linters,
and the required code changes to make them happy. As well as minor doc
changes.
2022-06-15 12:56:44 +01:00
MacroFake
8f3ab9a1b1
Merge bitcoin/bitcoin#24931: Strengthen thread safety assertions
ce893c0497 doc: Update developer notes (Anthony Towns)
d2852917ee sync.h: Imply negative assertions when calling LOCK (Anthony Towns)
bba87c0553 scripted-diff: Convert global Mutexes to GlobalMutexes (Anthony Towns)
a559509a0b sync.h: Add GlobalMutex type (Anthony Towns)
be6aa72f9f qt/clientmodel: thread safety annotation for m_cached_tip_mutex (Anthony Towns)
f24bd45b37 net_processing: thread safety annotation for m_tx_relay_mutex (Anthony Towns)

Pull request description:

  This changes `LOCK(mutex)` for non-global, non-recursive mutexes to be annotated with the negative capability for the mutex it refers to, to prevent . clang applies negative capabilities recursively, so this helps avoid forgetting to annotate functions.

  This can't reasonably be used for globals, because clang would require every function to be annotated with `EXCLUSIVE_LOCKS_REQUIRED(!g_mutex)` for each global mutex; so this introduces a trivial `GlobalMutex` subclass of `Mutex`, and reduces the annotations for both `GlobalMutex`  to `LOCKS_EXCLUDED` which only catches trivial errors (eg (`LOCK(x); LOCK(x);`).

ACKs for top commit:
  MarcoFalke:
    review ACK ce893c0497 🐦
  hebasto:
    ACK ce893c0497

Tree-SHA512: 5c35e8c7677ce3d994a7e3774f4344adad496223a51b3a1d1d3b5f20684b2e1d5cff688eb3fbc8d33e1b9940dfa76e515f9434e21de6f3ce3c935e29a319f529
2022-06-10 16:42:53 +02:00
Jon Atack
433b525694 Add LogPrintLevel to lint-format-strings, drop LogPrint-vs-LogPrintf section in dev notes
that was added in 2015 by commit b8c06ef40 in PR 7003, as that potential issue
would now be caught by the test/lint/lint-format-strings.py script run by the CI
2022-06-07 15:56:26 +02:00
laanwj
dd52f79a73
Merge bitcoin/bitcoin#24416: doc: Avoid ADL for function calls
52a797bfe5 doc: Avoid ADL for function calls (Hennadii Stepanov)

Pull request description:

  It happened two times recently, when [ADL](https://en.cppreference.com/w/cpp/language/adl) popped up unexpectedly and brought some confusion:
  - https://github.com/bitcoin/bitcoin/pull/24338/files#r805989994
  > Any idea why this even compiles?
  - https://www.erisian.com.au/bitcoin-core-dev/log-2022-02-18.html#l-51:
  > 2022-02-18T03:24:14  \<dongcarl\> Does anyone know why this compiles? 6d3d2caa37
  > 2022-02-18T03:24:14  \<dongcarl\> GetUTXOStatsWithHasher and MakeUTXOHasher are both in the `kernel::` namespace and I never added a `using` declaration on top...
  > 2022-02-18T03:25:53  \<sipa\> https://en.cppreference.com/w/cpp/language/adl ?

  Let's document our intention to avoid similar cases in the future.

ACKs for top commit:
  laanwj:
    Anyhow, ACK 52a797bfe5, there is no need to hold merge up on this, documenting it is a step forward.

Tree-SHA512: f52688b5d8f6130302185206ec6ea4731b099a75294ea2d477901a52d6d58473e3427e658aea408c140c2824c37a0399ec7376aded2a91197895ea52d51f0018
2022-06-01 13:32:48 +02:00
Anthony Towns
ce893c0497 doc: Update developer notes 2022-05-21 01:23:23 +10:00
Jon Atack
bd5dbc30db doc: update developer notes wrt --enable-debug and DEBUG_LOCKCONTENTION 2022-05-20 12:48:17 +02:00
Jon Atack
654284209f Add clang lifetimebound section to developer notes 2022-05-10 16:29:26 +02:00
Jon Atack
e66b321fd1 Add C++ functions and methods section to developer notes
Credit for some parts to the Google C++ Style Guide "Inputs and Outputs"
section at https://google.github.io/styleguide/cppguide.html#Inputs_and_Outputs

Co-authored-by: laanwj <126646+laanwj@users.noreply.github.com>
2022-05-10 14:57:50 +02:00
Jon Atack
5fca70f5b1 Link in developer notes style to internal interface exception 2022-05-09 16:14:04 +02:00
Jon Atack
fc4cb857cc Prefer Python for scripts in developer notes
along with a few miscellaneous touch-ups.
2022-05-09 16:13:38 +02:00
Jon Atack
370120ec2f Remove obsolete BDB ENABLE_WALLET section in developer notes 2022-05-06 18:29:59 +02:00
Jon Atack
8b3f1e30f0
Update RPC argument and field naming guideline in developer notes
Co-authored-by: laanwj <126646+laanwj@users.noreply.github.com>
2022-04-08 15:46:05 +02:00
Jon Atack
4394733331
Add DEBUG_LOCKCONTENTION documentation to the developer notes 2022-04-05 12:49:50 +02:00
MarcoFalke
67f654ef61
doc: Document clang-tidy in dev notes 2022-03-25 08:18:51 +00:00
Hennadii Stepanov
52a797bfe5
doc: Avoid ADL for function calls 2022-02-22 15:25:51 +02:00
Jon Atack
48742693ac
Replace "can not" with "cannot" in docs, user messages, and tests 2022-02-21 19:07:29 +01:00
Pasta
75347236f2 docs: document c-style cast prohibition 2022-02-02 00:31:47 +07:00
Russell Yanofsky
9b575f1c73 Improve fs::PathToString documentation 2021-11-15 12:08:49 -05:00
Gleb Naumenko
0659f12b13
Add minisketch dependency 2021-10-21 09:38:55 +08:00
fanquake
5b7210c874
Merge bitcoin/bitcoin#22409: configure: keep relative paths in debug info
0bc666b053 doc: add info for debugging with relative paths (S3RK)
a8b515c317 configure: keep relative paths in debug info (S3RK)

Pull request description:

  This is a follow-up for #20353 that fixes #21885

  It also adds a small section to assist debugging without absolute paths in debug info.

ACKs for top commit:
  kallewoof:
    Tested ACK 0bc666b053
  Zero-1729:
    Light crACK 0bc666b053

Tree-SHA512: d4b75183c3d3a0f59fe786841fb230581de87f6fe04cf7224e4b89c520d45513ba729d4ad8c0e62dd1dbaaa7a25741f04d036bc047f92842e76c9cc31ea47fb2
2021-10-11 10:34:29 +08:00
fanquake
2b90eae33c
doc: update developer docs for subtree renaming 2021-09-29 15:12:12 +08:00
Jeremy Rand
9bdda50151
Enable TLS in links in documentation 2021-09-16 22:00:20 +00:00
S3RK
0bc666b053 doc: add info for debugging with relative paths 2021-08-21 20:42:42 +02:00
Jon Atack
77f37f58ad
doc: update enum naming in developer notes
- Update the enumerator examples to snake_case per CPP Core Guidelines
  https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Renum-caps

- Clarify that in this project enumerators may be snake_case, PascalCase, or
  ALL_CAPS, and to use what is seems appropriate.
2021-07-13 21:22:24 +02:00
fanquake
bfd910cae4
Merge bitcoin/bitcoin#18568: doc: Clarify developer notes about constant naming
05f9770c1f doc: Clarify developer notes about constant naming (Russell Yanofsky)

Pull request description:

  I'm pretty sure developer notes were intended to say constants should be upper case and variables should be lower case, but right now they are ambiguous about whether to write:

  ```c++
  extern const int SYMBOL;
  ```

  or:

  ```c++
  extern const int g_symbol;
  ```

  First convention above is better than the second convention because it tells you without having to look anything up that the value of `SYMBOL` won't change at runtime. Also I haven't seen other c++ projects using the second convention.

ACKs for top commit:
  MarcoFalke:
    cr ACK 05f9770c1f
  practicalswift:
    ACK 05f9770c1f
  jarolrod:
    ACK 05f9770c1f 🥃

Tree-SHA512: 766d0e25d9db818d45df4ad6386987014f2053584cbced4b755ceef8bda6b7e2cfeb34eb8516423bd03b140faaf577614d5e3be2799f7eed0eb439187ab85323
2021-06-30 09:23:15 +08:00
Sebastian Falbesoner
6780a095d8 doc: remove obsolete okSafeMode RPC guideline from developer notes
Since the flag has been removed from the RPC command table in commit
ec6902d0ea (PR #11179), this guideline
is not relevant anymore and can be removed.
2021-06-10 02:02:29 +02:00
MarcoFalke
fa5eabe721
refactor: Remove negative lock annotations from globals 2021-04-05 08:42:15 +02:00
fanquake
1a6323bdbe
doc: update developer notes for removal of MakeUnique 2021-03-11 13:45:50 +08:00
Amiti Uttarwar
25c57d6409 [doc] Add a note about where lock annotations should go. 2021-02-17 15:58:23 -08:00
John Newbery
aa929abf8d [docs] Update developer notes to discourage very long lines 2021-01-22 09:55:13 +00:00
Sawyer Billings
e8640849c7
doc: Use https URLs where possible 2021-01-04 12:23:16 +08:00
Jon Atack
ee701a9204
doc: update developer notes for signet 2021-01-02 17:31:30 +01:00
Hennadii Stepanov
95487b0553
doc: Drop mentions of Travis CI as it is no longer used 2020-12-18 01:15:53 +02:00
MarcoFalke
fac5efe730
util: Add Assume() identity function 2020-11-24 09:47:29 +01:00
Hennadii Stepanov
0bd1184adf
Remove unused LockAssertion struct 2020-09-19 18:02:42 +03:00
Hennadii Stepanov
ea74e10acf
doc: Add best practice for annotating/asserting locks 2020-08-29 20:46:47 +03:00
Wladimir J. van der Laan
fd9db45c3e
Merge #19258: doc: improve subtree check instructions
a4a3fc4cd2 doc: improve subtree check instructions (Sjors Provoost)

Pull request description:

  Running `git-subtree-check.sh` requires adding the subtree repository as a remote. I learned that several years ago and then forgot again.

  This PR also improves the error message if the subtree commit can't be found.

ACKs for top commit:
  laanwj:
    ACK a4a3fc4cd2
  fanquake:
    ACK a4a3fc4cd2 - this looks ok.

Tree-SHA512: 959bd923726c172d17f9f97f8a56988bf2df5a94d3131e5152a66150b941394cee9e82fdc6b86e09c0ba91d123a496599f07ca454212168d8d301738394c12c8
2020-07-09 17:52:54 +02:00
Pieter Wuille
fab57e2b9b doc: Mention Span in developer-notes.md 2020-06-26 13:53:49 -07:00
Sjors Provoost
a4a3fc4cd2
doc: improve subtree check instructions 2020-06-12 13:31:42 +02:00
John Newbery
808ef36b89 [doc] Update thread information in developer docs 2020-04-15 12:02:39 -04:00