source: EcnlProtoTool/trunk/tcc-0.9.27/CodingStyle@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

File size: 2.1 KB
Line 
1
2In general, use the same coding style as the surrounding code.
3
4However, do not make any unnecessary changes as that complicates
5the VCS (git) history and makes it harder to merge patches. So
6do not modify code just to make it conform to a coding style.
7
8 Indentation
9
10Turn on a "fill tabs with spaces" option in your editor.
11
12Remove tabs and trailing spaces from any lines that are modified.
13
14Note that some files are indented with 2 spaces (when they
15have large indentation) while most are indented with 4 spaces.
16
17 Language
18
19TCC is mostly implemented in C90. Do not use any non-C90 features
20that are not already in use.
21
22Non-C90 features currently in use, as revealed by
23./configure --extra-cflags="-std=c90 -Wpedantic":
24
25- long long (including "LL" constants)
26- inline
27- very long string constants
28- assignment between function pointer and 'void *'
29- "//" comments
30- empty macro arguments (DEF_ASMTEST in i386-tok.h)
31- unnamed struct and union fields (in struct Sym), a C11 feature
32
33 Testing
34
35A simple "make test" is sufficient for some simple changes. However,
36before committing a change consider performing some of the following
37additional tests:
38
39- Build and run "make test" on several architectures.
40
41- Build with ./configure --enable-cross.
42
43- If the generation of relocations has been changed, try compiling
44 with TCC and linking with GCC/Clang. If the linker has been
45 modified, try compiling with GCC/Clang and linking with TCC.
46
47- Test with ASan/UBSan to detect memory corruption and undefined behaviour:
48
49make clean
50./configure
51make
52make test
53cp libtcc.a libtcc.a.hide
54
55make clean
56./configure --extra-cflags="-fsanitize=address,undefined -g"
57make
58cp libtcc.a.hide libtcc.a
59make test
60
61- Test with Valgrind to detect some uses of uninitialised values:
62
63make clean
64./configure
65make
66# On Intel, because Valgrind does floating-point arithmetic differently:
67( cd tests && gcc -I.. tcctest.c && valgrind -q ./a.out > test.ref )
68make test TCC="valgrind -q --leak-check=full `pwd`/tcc -B`pwd` -I`pwd`"
69
70 (Because of how VLAs are implemented, invalid reads are expected
71 with 79_vla_continue.)
Note: See TracBrowser for help on using the repository browser.