]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - usr.bin/dtc/HACKING
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.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 FreeBSD svn repository:
12
13 https://svn.freebsd.org/base/head/usr.bin/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 currently aims to compile with g++ 4.2.1 and so doesn't make any
25 use of C++11 features.  It would be a good idea to relax this restriction once
26 clang is the default compiler for ARM, MIPS and PowerPC.
27
28 This code makes use of a lot of iterator loops, which would be cleaner using
29 the new syntax in C++11.  It also explicitly deletes a lot of objects held in
30 collections in destructors that have these collections as their members.  This
31 could be simplified by using `shared_ptr`.
32
33 The code does make use of `static_assert()`, but uses a macro in utility.hh to
34 remove these if they are not supported.  The FreeBSD standard headers also
35 define a compatibility macro the implements static asserts in terms of an array
36 with 1 element on success and -1 elements on failure.
37
38 Adding New Checks
39 -----------------
40
41 Currently, the biggest weakness of this version of the tool is that it lacks
42 most of the semantic checkers that can be implemented by simply reading the
43 ePAPR spec.  The `checker` class provides a simple superclass for implementing
44 these quite easily.  There are also helper methods on `device_tree` for finding
45 specific nodes, for checks that require some understanding of the structure of
46 the tree.
47
48 We should probably add a parent pointer to the `node` class for easily walking
49 up the tree.
50
51 Adding Direct C Output
52 ----------------------
53
54 The FreeBSD build system currently uses dtc to generate a blob and then
55 converts this to C source code.  A new `output_writer` subclass could easily
56 generate the C directly.
57
58 Parser Improvements
59 -------------------
60
61 There are a few FIXME lines in the parser for some corner cases that are not
62 currently used by FreeBSD.  These are mainly related to labels in the middle of
63 values.  These can be fixed by creating a new `property_value` with the
64 specified label, starting at the location of the label.  Don't forget to remove
65 the associated comments from the BUGS section of the man page if you fix this.