| 1 |
First of all: C89 or better. If you don't have that, port gcc first. |
| 2 |
|
| 3 |
Use of C language extensions throughout the X server tree |
| 4 |
--------------------------------------------------------- |
| 5 |
|
| 6 |
Optional extensions: |
| 7 |
The server will still build if your toolchain does not support these |
| 8 |
extensions, although the results may not be optimal. |
| 9 |
|
| 10 |
* _X_SENTINEL(x): member x of the passed structure must be NULL, e.g.: |
| 11 |
void parseOptions(Option *options _X_SENTINEL(0)); |
| 12 |
parseOptions("foo", "bar", NULL); /* this is OK */ |
| 13 |
parseOptions("foo", "bar", "baz"); /* this is not */ |
| 14 |
This definition comes from Xfuncproto.h in the core |
| 15 |
protocol headers. |
| 16 |
* _X_ATTRIBUTE_PRINTF(x, y): This function has printf-like semantics; |
| 17 |
check the format string when built with |
| 18 |
-Wformat (gcc) or similar. |
| 19 |
* _X_EXPORT: this function should appear in symbol tables. |
| 20 |
* _X_HIDDEN: this function should not appear in the _dynamic_ symbol |
| 21 |
table. |
| 22 |
* _X_INTERNAL: like _X_HIDDEN, but attempt to ensure that this function |
| 23 |
is never called from another module. |
| 24 |
* _X_INLINE: inline this function if possible (generally obeyed unless |
| 25 |
disabling optimisations). |
| 26 |
* _X_DEPRECATED: warn on use of this function. |
| 27 |
|
| 28 |
Mandatory extensions: |
| 29 |
The server will not build if your toolchain does not support these extensions. |
| 30 |
|
| 31 |
* named initialisers: explicitly initialising structure members, e.g.: |
| 32 |
struct foo bar = { .baz = quux, .brian = "dog" }; |
| 33 |
* variadic macros: macros with a variable number of arguments, e.g.: |
| 34 |
#define DebugF(x, ...) /**/ |
| 35 |
* interleaved code and declarations: { foo = TRUE; int bar; do_stuff(); } |
| 36 |
|
| 37 |
|
| 38 |
Use of library facilities throughout the X server tree |
| 39 |
------------------------------------------------------------- |
| 40 |
|
| 41 |
Non-OS-dependent code can assume facilities at least as good as |
| 42 |
the non-OS-facility parts of POSIX-1.2001. Ideally this would |
| 43 |
be C99, but even gcc+glibc doesn't implement that yet. |
| 44 |
|
| 45 |
Unix-like systems are assumed to be at least as good as UNIX03. |
| 46 |
|
| 47 |
Note that there are two Windows ports, Cygwin and MinGW: |
| 48 |
- Cygwin is more or less like Linux. |
| 49 |
- MinGW is more restrictive. Windows does not provide the required |
| 50 |
POSIX facilities, so some non-OS-dependent code is stubbed out or |
| 51 |
has an alternate implementation if WIN32 is defined. Code that |
| 52 |
needs to be portable to Windows should be careful to, well, be portable. |
| 53 |
|
| 54 |
|
| 55 |
Required OS facilities |
| 56 |
------------------------------------------------------------- |
| 57 |
|
| 58 |
Linux systems must be at least 2.4 or later. As a practical matter |
| 59 |
though, 2.4 kernels never receive any testing. Use 2.6 already. |
| 60 |
|
| 61 |
TODO: Solaris. |
| 62 |
|
| 63 |
TODO: *BSD. |
| 64 |
|
| 65 |
Windows-dependent code assumes at least NT 6.0. |
| 66 |
|
| 67 |
OSX support is generally limited to the most recent version. Currently |
| 68 |
that means 10.5. |