HACKING revision 245803
1$FreeBSD: head/usr.bin/dtc/HACKING 245803 2013-01-22 17:49:51Z theraven $ 2 3Notes for people hacking on dtc 4=============================== 5 6This file contains some notes for people wishing to hack on dtc. 7 8Upstreaming 9----------- 10 11This code is developed in the FreeBSD svn repository: 12 13https://svn.freebsd.org/base/head/usr.bin/dtc 14 15If you got the source from anywhere else and wish to make changes, please 16ensure that you are working against the latest version, or you may end up 17fixing bugs that are already fixed upstream. Although the license makes no 18requirement that you share any improvements that you make, patches are very 19welcome. 20 21C++11 22----- 23 24This project currently aims to compile with g++ 4.2.1 and so doesn't make any 25use of C++11 features. It would be a good idea to relax this restriction once 26clang is the default compiler for ARM, MIPS and PowerPC. 27 28This code makes use of a lot of iterator loops, which would be cleaner using 29the new syntax in C++11. It also explicitly deletes a lot of objects held in 30collections in destructors that have these collections as their members. This 31could be simplified by using `shared_ptr`. 32 33The code does make use of `static_assert()`, but uses a macro in utility.hh to 34remove these if they are not supported. The FreeBSD standard headers also 35define a compatibility macro the implements static asserts in terms of an array 36with 1 element on success and -1 elements on failure. 37 38Adding New Checks 39----------------- 40 41Currently, the biggest weakness of this version of the tool is that it lacks 42most of the semantic checkers that can be implemented by simply reading the 43ePAPR spec. The `checker` class provides a simple superclass for implementing 44these quite easily. There are also helper methods on `device_tree` for finding 45specific nodes, for checks that require some understanding of the structure of 46the tree. 47 48We should probably add a parent pointer to the `node` class for easily walking 49up the tree. 50 51Adding Direct C Output 52---------------------- 53 54The FreeBSD build system currently uses dtc to generate a blob and then 55converts this to C source code. A new `output_writer` subclass could easily 56generate the C directly. 57 58Parser Improvements 59------------------- 60 61There are a few FIXME lines in the parser for some corner cases that are not 62currently used by FreeBSD. These are mainly related to labels in the middle of 63values. These can be fixed by creating a new `property_value` with the 64specified label, starting at the location of the label. Don't forget to remove 65the associated comments from the BUGS section of the man page if you fix this. 66