The Linux Foundation is a non-profit consortium dedicated to fostering the growth of Linux.
Contents |
From compiler point of view, the same derived type can be represented in many ways by varying spaces in its Tname, e.g. one can write 'void **', 'void * *' or 'void**', and these strings are treated by compiler in the same way. Unfortunately, it's not simple to explain this fact to the DBMS. Thus we use a naming convention for such cases, just to avoid separate entries in the Type table which actually designate the same type.
The naming rules are like the following:
void *Incorrect:
void*
void **; void ***Incorrect:
void * *; void ** *
const int *; const const void *Incorrect:
const int; const const void *
sockaddr_in * const *Incorrect:
int *const.
base_type_name[array_size]Note that there is no spaces between base type and the first bracket, as well as inside brackets. This rule should be followed for arrays of any levels.
int[10]; void *[5]; char[12][25]Incorrect:
int [10]; void *[ 5]; char[12] [25]
Note: In some cases, there is a need to create entry for an array that has different sizes on different architectures. For such cases we suggest to place dots ('...') as an array size.
[fptr-]<ret_type> (*)(<param1>, <param2>, ...)Please pay attention to space separators.
int (*)(void *); fptr-void (*)(double, double)Incorrect:
fptr-header_name-1.
'Incorrect' in all examples above doesn'n mean that you break anything by adding type with such name; but you can add an extra record for type that is already present in the database and can confuse other people who will use this type in future.
All entries in the Type table should be assigned to some header group, except the following:
It is useful to set Theadgroup not only for 'usual' types (e.g. typedefs or structures), but for all types derived from them. I.e. if we have typedef named 'A' and pointer to it, 'A *', the pointer should be assigned to the same header group as the typedef itself. The thing is that there can be a type with the same name in another header, and we should have separate records for pointers on these different types, pointers to these pointers, etc.
A tricky case is function pointer. Our experience shows that it is better not to assign function pointers to header groups, but set correct Tlibrary field for them. I.e. we don't distinguish function pointers that are pointers to the same function inside one library, but we do distinguish such types if they belong to different libraries. The reason is the same as for types - different libraries may declare types with the same names, and we should distinguish pointers to functions that use types with the same names but from different libraries. One can notice that some headers inside one library may also contain types with the same names; well, the cases such types are used in function pointers are VERY rare; in case if you met such situation, you can resolve it manually (i.e. manually create several different records in the Type table for function pointers), but in general we recommend not to assign FuncPtrs to header groups.
Entries with the following Ttype SHOULD NOT be ever marked as included:
If one of such entries is marked as included and assigned to header, then this can break the generated header.