]> git.sur5r.net Git - openldap/blob - doc/devel/guidelines
Update INSTALL/README files with references to new documents.
[openldap] / doc / devel / guidelines
1 Coding guide lines and and hints for OpenLDAP developers.
2 =========================================================
3
4
5 Please add to this file when new points come up.
6
7
8 C source
9 --------
10
11 OpenLDAP requires many Standard C features to *build*.  This
12 includes functional prototypes and offsetof macro.  It is
13 possible to *build* OpenLDAP with a number of C translators
14 which are not fully compliant with Standard C.
15
16 OpenLDAP supports compiling and linking *with* applications
17 with most C compilers and libraries.   The installed headers
18 are designed to provide K&R C compatiable function declarations
19 on non-standard compilers.  In cases where the compiler does
20 not define __STDC__ but requires prototypes (ie: MSVC), the
21 application should define LDAP_NEEDS_PROTOTYPES.  In cases
22 where the compiler does define __STDC__ but does not support
23 prototypes, the application should define LDAP_NO_PROTOTYPES.
24
25 .c files in the OpenLDAP source tree MUST #include "portable.h" before
26 any other include file, even system includes.  portable.h may control
27 aspects of system includes, such as whether or not thread-safe library
28 functions are used.  (Separate applications can't use portable.h, since
29 it is not installed.  They can use ldap_features.h, though.)
30
31 .h files that are NOT INSTALLED may depend on features from portable.h.
32 .h files that *are* installed (from include/) should not depend on it.
33
34 Avoid unnecessary changes, like reindenting code, even if that leaves
35 the code a little ugly.  Often switching your editors tab stops to
36 4 or 8 may make code easier to read.  Unnecessary changes make it
37 harder to maintain and merge different CVS branches of the source.
38
39 Please follow the style of surrounding code.
40
41 Use feature-specific #if tests (like #ifdef HAVE_LWP) which configure
42 can figure out, not system-specific test (like #ifdef __SunOS_5_6).
43
44 When available, use include files from ldap/include/ac/ to get system
45 features or functions.  The <ac/xxx.h> files try to fix crippled system
46 includes, and to hide #ifdef messes that portable programs need in order
47 to find a feature.  Note that a file <ac/xxx.h> is not necessarily
48 designed to be equivalent to standard C's <xxx.h> file.
49
50 Nonstatic function and variable definitions in .c files should be
51 preceded by their declarations in .h files.  Avoid implicit function
52 declarations.  External declarations with should be avoided.  In
53 .c files, include the appropriate .h file to obtain the declaration.
54 If the declaration is not available in any system header, add it
55 to the most appropriate ac/xxx.h header.  Do NOT add extern
56 declarations to .c files.
57
58 When a function returns non-void, it should return a meaningful value.
59 Avoid implicit int.
60
61 It is recommended that ldap_cdef.h macros LDAP_F and LDAP_P be used
62 even for non-installed headers.  See lber.h and ldap.h for examples.
63
64
65 CVS updating
66 ------------
67
68 <URL:http://www.openldap.org/repo.html> describes how to check out
69 -stable.  To get the -devel (HEAD) branch, omit `-r OPENLDAP_STABLE'.
70 You can use 'cvs status -v README' to get a list available CVS tags.
71
72 Core members should subscribe to the private -core mailing list and
73 coordinate activities there.
74
75 Please test patches before committing.  This should include compiling
76 and linking the system AND running the test suite.
77
78 In general, a patch/bugfix should be applied to -devel and tested.
79 When the patch is considered stable, then it can be merged into -stable.
80 Same goes for other release engineering branches (like
81 OPENLDAP_REL_ENG_1_1).  (-stable is rel eng 1.0).
82 Specific procjects may get their own branches, to be merged later.
83
84 Log messages: Just describe the change and reason.  CVS adds your name,
85 date, etc.
86
87
88 Various tips and hints
89 ----------------------
90
91 How to correct a CVS log message:
92 Commit the unchanged files again with the `-f' flag and with a log
93 message stating how the previous log was in error:
94         cvs commit -f cldap.c os-ip.c
95 Preferably, prepend a line something like this to the message:
96 "Forced commit to correct previous log, files were not changed."
97
98 Modify ldapconfig.h instead of ldapconfig.h.edit.  Then `cvs commit'
99 from the include directory won't accidentally commit your private
100 ldapconfig.h.edit.