fix warning
[m6w6/ext-psi] / src / types / decl_arg.h
1 /*******************************************************************************
2 Copyright (c) 2016, Michael Wallner <mike@php.net>.
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7
8 *Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 *Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
18 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *******************************************************************************/
25
26 #ifndef PSI_TYPES_DECL_ARG_H
27 #define PSI_TYPES_DECL_ARG_H
28
29 struct psi_data;
30 struct psi_token;
31 struct psi_plist;
32 struct psi_decl_type;
33 struct psi_decl_var;
34 struct psi_layout;
35 struct psi_validate_scope;
36
37 struct psi_decl_arg {
38 struct psi_token *token;
39 struct psi_decl_type *type;
40 struct psi_decl_var *var;
41 struct psi_layout *layout;
42 };
43
44 struct psi_decl_arg *psi_decl_arg_init(struct psi_decl_type *type, struct psi_decl_var *var);
45 void psi_decl_arg_free(struct psi_decl_arg **arg_ptr);
46 void psi_decl_arg_dump(int fd, struct psi_decl_arg *arg, unsigned level);
47
48 bool psi_decl_arg_validate(struct psi_data *data, struct psi_decl_arg *arg, struct psi_validate_scope *scope);
49 bool psi_decl_arg_validate_typedef(struct psi_data *data, struct psi_decl_arg *def, struct psi_validate_scope *scope);
50
51 size_t psi_decl_arg_align(struct psi_decl_arg *darg, size_t *pos, size_t *len);
52 size_t psi_decl_arg_get_align(struct psi_decl_arg *darg);
53 size_t psi_decl_arg_get_size(struct psi_decl_arg *darg);
54
55 struct psi_decl_arg *psi_decl_arg_get_by_name(struct psi_plist *args, const char *name);
56 struct psi_decl_arg *psi_decl_arg_get_by_var(struct psi_decl_var *var, struct psi_plist *args, struct psi_decl_arg *func);
57
58
59 #endif