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