]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/dtc/HACKING
ident(1): Normalizing date format
[FreeBSD/FreeBSD.git] / usr.bin / dtc / HACKING
1 $FreeBSD$
2
3 Notes for people hacking on dtc
4 ===============================
5
6 This file contains some notes for people wishing to hack on dtc.
7
8 Upstreaming
9 -----------
10
11 This code is developed in the git repository:
12
13 https://github.com/davidchisnall/dtc
14
15 If you got the source from anywhere else and wish to make changes, please
16 ensure that you are working against the latest version, or you may end up
17 fixing bugs that are already fixed upstream.  Although the license makes no
18 requirement that you share any improvements that you make, patches are very
19 welcome.
20
21 C++11
22 -----
23
24 This project uses C++11, as the goal for FreeBSD 11 is to require C/C++11 as a
25 minimum, either from clang or an external toolchain.  In particular, it uses
26 `std::unique_ptr` extensively for memory management within the tree.  Unique
27 pointers are also used in several other places to track ownership.
28
29 Most iterator loops use the new loop syntax and the `auto` type for type
30 deduction.  Range-based `for` loops generally improve the readability of the
31 code, though `auto` should only be used in places where the type can be deduced
32 as easily by the reader as by the compiler.
33
34 The code also makes use of `static_assert()` to track compile-time invariants.
35
36 Adding New Checks
37 -----------------
38
39 Currently, the biggest weakness of this version of the tool is that it lacks
40 most of the semantic checkers that can be implemented by simply reading the
41 ePAPR spec.  The `checker` class provides a simple superclass for implementing
42 these quite easily.  There are also helper methods on `device_tree` for finding
43 specific nodes, for checks that require some understanding of the structure of
44 the tree.
45
46 We should probably add a parent pointer to the `node` class for easily walking
47 up the tree.
48
49 Adding Direct C Output
50 ----------------------
51
52 The FreeBSD build system currently uses dtc to generate a blob and then
53 converts this to C source code.  A new `output_writer` subclass could easily
54 generate the C directly.
55
56 Parser Improvements
57 -------------------
58
59 There are a few FIXME lines in the parser for some corner cases that are not
60 currently used by FreeBSD.  These are mainly related to labels in the middle of
61 values.  These can be fixed by creating a new `property_value` with the
62 specified label, starting at the location of the label.  Don't forget to remove
63 the associated comments from the BUGS section of the man page if you fix this.