Linux: osi_vcache: Fix loop for the hlist case
[openafs.git] / README.DEVEL
1 Notes on Coding Standards/Requirements for OpenAFS Source
2 ---------------------------------------------------------
3
4 We have an official style.  Please use it.  If you have gnu indent 2.2.9 or
5 later you can reformat for this style with the following option:
6
7 -npro -nbad -bap -nbc -bbo -br -ce -cdw -brs -ncdb -cp1 -ncs -di2 -ndj -nfc1
8 -nfca -i4 -lp -npcs -nprs -psl -sc -nsob -ts8
9
10 Do not use $< for non-pattern rules in any cross-platform dir as it
11 requires a reasonable make that is not available on all systems.
12
13 Do not have build rules that build multiple targets. Make doesn't seem able
14 to handle this, and it interferes with -j builds. (In particular, build the
15 rxgen targets individually and not using the flags for building all the files
16 in one shot.)
17
18 Try to test builds using gmake -j # MAKE="gmake -j #", it seems like a good
19 way to find missing or order-dependent dependency rules. (Is there a better
20 way to do this?)
21
22 -- Prototyping and Style --
23 Prototypes for all source files in a given dir DDD should be placed
24 int the file DDD/DDD_prototypes.h. All externally used (either API
25 or used by other source files) routines and variables should be
26 prototyped in this file.
27
28 The prototypes should be a full prototype, with argument and return
29 types. (Should not generate a warning with gcc -Wstrict-prototypes.)
30
31 Format of the prototype files should look like:
32
33         Standard Copyright Notice
34
35         #ifndef AFS_SRC_DDD_PROTO_H
36         #define AFS_SRC_DDD_PROTO_H
37         
38         /* filename.c */
39         prototypes
40
41         /* filename.c */
42         prototypes
43
44         #endif /* AFS_SRC_DDD_PROTO_H */
45
46 In most of the existing prototypes, the define is DDD_PROTOTYPES_H, which is
47 probably ok as well.
48
49 The declaration of the routines should be done in ANSI style. If at some
50 later date, it is determined that prototypes don't work on some platform 
51 properly, we can use ansi2knr during the compile.
52
53         rettype 
54         routine(argtype arg)
55         {
56
57         }
58
59 All routines should have a return type specified, void if nothing returned,
60 and should have (void) if no arguments are taken.
61
62 Header files should not contain macros or other definitions unless they
63 are used across multiple source files.
64
65 All routines should be declared static if they are not used outside that 
66 source file.
67
68 Compiles on gcc-using machines should strive to handle using
69 -Wstrict-prototypes -Werror. (this may take a while)
70
71 Routines shall be defined in source prior to use if possible, and 
72 prototyped in block at top of file if static.
73
74 API documentation in the code should be done using Qt-style Doxygen
75 comments.
76
77 If you make a routine or variable static, be sure and remove it from
78 the AIX .exp files.
79
80 Suggested compiler flags:
81         gcc: -Wall -Wstrict-prototypes
82         Solaris Workshop CC: -fd -v
83                 (You might not want the -fd, it isn't really useful, just complains about the
84                 K&R style functions, but -v gives useful info.)