1/* Pragma related interfaces.
2   Copyright (C) 1995, 1998, 1999 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING.  If not, write to
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA.  */
20
21#ifndef _C_PRAGMA_H
22#define _C_PRAGMA_H
23
24#ifdef HANDLE_SYSV_PRAGMA
25/* Support #pragma weak iff ASM_WEAKEN_LABEL and ASM_OUTPUT_DEF are
26   defined.  */
27#if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_DEF)
28#define HANDLE_PRAGMA_WEAK SUPPORTS_WEAK
29#endif
30
31/* We always support #pragma pack for SYSV pragmas.  */
32#ifndef HANDLE_PRAGMA_PACK
33#define HANDLE_PRAGMA_PACK 1
34#endif
35#endif /* HANDLE_SYSV_PRAGMA */
36
37
38#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
39/* If we are supporting #pragma pack(push... then we automatically
40   support #pragma pack(<n>)  */
41#define HANDLE_PRAGMA_PACK 1
42#define PRAGMA_INSERT_ATTRIBUTES(node, pattr, prefix_attr) \
43  insert_pack_attributes (node, pattr, prefix_attr)
44extern void insert_pack_attributes PROTO((tree, tree *, tree *));
45#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
46
47
48#ifdef HANDLE_PRAGMA_WEAK
49/* This structure contains any weak symbol declarations waiting to be emitted.  */
50struct weak_syms
51{
52  struct weak_syms * next;
53  char * name;
54  char * value;
55};
56
57/* Declared in varasm.c */
58extern struct weak_syms * weak_decls;
59
60extern int add_weak PROTO((char *, char *));
61#endif /* HANDLE_PRAGMA_WEAK */
62
63
64#if defined HANDLE_PRAGMA_PACK || defined HANDLE_PRAGMA_WEAK
65/* Define HANDLE_GENERIC_PRAGMAS if any kind of front-end pragma
66   parsing is to be done.  The code in GCC's generic C source files
67   will only look for the definition of this constant.  They will
68   ignore definitions of HANDLE_PRAGMA_PACK and so on.  */
69#define HANDLE_GENERIC_PRAGMAS 1
70#endif
71
72
73#ifdef HANDLE_GENERIC_PRAGMAS
74enum pragma_state
75{
76  ps_start,
77  ps_done,
78#ifdef HANDLE_PRAGMA_WEAK
79  ps_weak,
80  ps_name,
81  ps_equals,
82  ps_value,
83#endif
84#ifdef HANDLE_PRAGMA_PACK
85  ps_pack,
86  ps_left,
87  ps_align,
88  ps_right,
89#endif
90#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
91  ps_push, ps_pushcomma, ps_pushid, ps_pushcomma2,
92  ps_pop, ps_popcomma,
93#endif
94  ps_bad
95};
96
97/* Handle a C style pragma */
98extern int handle_pragma_token PROTO((const char *, tree));
99
100#endif /* HANDLE_GENERIC_PRAGMAS */
101#endif /* _C_PRAGMA_H */
102