mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
Document make_symbol
This commit is contained in:
parent
0624408317
commit
49b7c2d527
2 changed files with 22 additions and 0 deletions
|
@ -210,6 +210,24 @@ symbol_t *copy_symbol (symbol_t *symbol);
|
|||
*/
|
||||
symtab_t *symtab_flat_copy (symtab_t *symtab, symtab_t *parent);
|
||||
|
||||
/** Create a global symbol and allocate space for a variable.
|
||||
|
||||
If the symbol already exists, it must be of the correct type. If it
|
||||
is external, it will be converted to the given storage class and
|
||||
allocatged space from the given defspace, otherwise it will be
|
||||
returned.
|
||||
|
||||
If the symbol is new, it will be allocated space from the given
|
||||
defspace with the given storage class.
|
||||
|
||||
\param name The name of the symbol.
|
||||
\param type The type of the symbol.
|
||||
\param space The defspace from which space will be allocated for the
|
||||
symbol. Ignored for st_extern, must not be null for
|
||||
others.
|
||||
\param storage The storage class for the symbol. Only st_extern,
|
||||
st_global, and st_static are valid.
|
||||
*/
|
||||
symbol_t *make_symbol (const char *name, struct type_s *type,
|
||||
struct defspace_s *space, enum storage_class_e storage);
|
||||
|
||||
|
|
|
@ -151,6 +151,10 @@ make_symbol (const char *name, type_t *type, defspace_t *space,
|
|||
{
|
||||
symbol_t *sym;
|
||||
|
||||
if (storage != st_extern && storage != st_global && storage != st_static)
|
||||
internal_error (0, "invalid storage class for %s", __FUNCTION__);
|
||||
if (storage != st_extern && !space)
|
||||
internal_error (0, "null space for non-external storage");
|
||||
sym = symtab_lookup (pr.symtab, name);
|
||||
if (!sym) {
|
||||
sym = new_symbol_type (name, type);
|
||||
|
|
Loading…
Reference in a new issue