/*
* Copyright (c) 2004 - 2007, Nils R. Weller
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DECL_H
#define DECL_H
/* Forward declarations */
struct type;
struct expr;
struct token;
struct vreg;
struct init_with_name;
#define DECL_NOINIT (1)
#define DECL_CONSTINIT (1 << 1)
#define DECL_VARINIT (1 << 2)
#define DECL_CAST (1 << 3)
#define DECL_FUNCARG (1 << 4)
#define DECL_FUNCARG_KR (1 << 5)
#define DECL_STRUCT (1 << 6)
#define DECL_UNUSED(d) (d->dtype->storage == TOK_KEY_STATIC \
&& d->references == 0)
#include <stddef.h>
struct decl {
/*
* XXX I forgot why ``name'' is in type rather than decl, but
* I believe there is a good reason :-/
*
* (MrNutty: ``I KEEP ALL MY RECORDS IN THIS LOAF OF BREAD,
* FOR REASONS I NO LONGER REMEMBER!!'' -
* http://www.yellow5.com/pokey/archive/index376.html)
*/
/*char *name;*/
struct type *dtype;
struct initializer *init;
struct init_with_name *init_name;
struct token *tok;
char *asmname;
int has_def;
int has_symbol;
/* int is_alias;*/ /* e.g. __PRETTY_FUNCTION/__func__ */
struct decl *is_alias;
unsigned references;
size_t offset;
size_t size;
struct vreg *vreg;
struct stack_block *stack_addr;
/* Next is only used to form the lists of static variables */
struct decl *next;
};
struct decl **parse_decl(struct token **toklist, int mode);
void append_decl(struct decl **, struct decl **, struct decl *);
struct decl *alloc_decl(void);
#endif
syntax highlighted by Code2HTML, v. 0.9.1