Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: bison/src/bison/2.4.1/bison-2.4.1-src/src/system.h

Issue 10807020: Add native Windows binary for bison. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /* System-dependent definitions for Bison.
2
3 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free
4 Software Foundation, Inc.
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19 #ifndef BISON_SYSTEM_H
20 #define BISON_SYSTEM_H
21
22 /* flex 2.5.31 gratutiously defines macros like INT8_MIN. But this
23 runs afoul of pre-C99 compilers that have <inttypes.h> or
24 <stdint.h>, which are included below if available. It also runs
25 afoul of pre-C99 compilers that define these macros in <limits.h>. */
26 #if ! defined __STDC_VERSION__ || __STDC_VERSION__ < 199901
27 # undef INT8_MIN
28 # undef INT16_MIN
29 # undef INT32_MIN
30 # undef INT8_MAX
31 # undef INT16_MAX
32 # undef UINT8_MAX
33 # undef INT32_MAX
34 # undef UINT16_MAX
35 # undef UINT32_MAX
36 #endif
37
38 #include <limits.h>
39 #include <stddef.h>
40 #include <stdlib.h>
41 #include <string.h>
42
43 #if HAVE_SYS_TYPES_H
44 # include <sys/types.h>
45 #endif
46
47 #include <unistd.h>
48 #include <inttypes.h>
49
50 #ifndef UINTPTR_MAX
51 /* This isn't perfect, but it's good enough for Bison, which needs
52 only to hash pointers. */
53 typedef size_t uintptr_t;
54 #endif
55
56
57 /*---------.
58 | Gnulib. |
59 `---------*/
60
61 #include <unlocked-io.h>
62 #include <verify.h>
63 #include <xalloc.h>
64
65
66 /*-----------------.
67 | GCC extensions. |
68 `-----------------*/
69
70 /* Use this to suppress gcc's `...may be used before initialized'
71 warnings. */
72 #ifdef lint
73 # define IF_LINT(Code) Code
74 #else
75 # define IF_LINT(Code) /* empty */
76 #endif
77
78 #ifndef __attribute__
79 /* This feature is available in gcc versions 2.5 and later. */
80 # if (! defined __GNUC__ || __GNUC__ < 2 \
81 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__)
82 # define __attribute__(Spec) /* empty */
83 # endif
84 #endif
85
86 /* The __-protected variants of `format' and `printf' attributes
87 are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
88 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
89 # define __format__ format
90 # define __printf__ printf
91 #endif
92
93 #ifndef ATTRIBUTE_NORETURN
94 # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
95 #endif
96
97 #ifndef ATTRIBUTE_UNUSED
98 # define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
99 #endif
100
101 #define FUNCTION_PRINT() fprintf (stderr, "%s: ", __func__)
102
103 /*------.
104 | NLS. |
105 `------*/
106
107 #include <locale.h>
108
109 #include <gettext.h>
110 #define _(Msgid) gettext (Msgid)
111 #define N_(Msgid) (Msgid)
112
113
114 /*-----------.
115 | Booleans. |
116 `-----------*/
117
118 #include <stdbool.h>
119
120
121
122 /*-------------.
123 | Assertions. |
124 `-------------*/
125
126 /* <assert.h>'s assertions are too heavyweight, and can be disabled
127 too easily, so use aver rather than assert. */
128 static inline void
129 aver (bool assertion)
130 {
131 if (! assertion)
132 abort ();
133 }
134
135
136 /*-----------.
137 | Obstacks. |
138 `-----------*/
139
140 #define obstack_chunk_alloc xmalloc
141 #define obstack_chunk_free free
142 #include <obstack.h>
143
144 #define obstack_sgrow(Obs, Str) \
145 obstack_grow (Obs, Str, strlen (Str))
146
147 #define obstack_fgrow1(Obs, Format, Arg1) \
148 do { \
149 char buf[4096]; \
150 sprintf (buf, Format, Arg1); \
151 obstack_grow (Obs, buf, strlen (buf)); \
152 } while (0)
153
154 #define obstack_fgrow2(Obs, Format, Arg1, Arg2) \
155 do { \
156 char buf[4096]; \
157 sprintf (buf, Format, Arg1, Arg2); \
158 obstack_grow (Obs, buf, strlen (buf)); \
159 } while (0)
160
161 #define obstack_fgrow3(Obs, Format, Arg1, Arg2, Arg3) \
162 do { \
163 char buf[4096]; \
164 sprintf (buf, Format, Arg1, Arg2, Arg3); \
165 obstack_grow (Obs, buf, strlen (buf)); \
166 } while (0)
167
168 #define obstack_fgrow4(Obs, Format, Arg1, Arg2, Arg3, Arg4) \
169 do { \
170 char buf[4096]; \
171 sprintf (buf, Format, Arg1, Arg2, Arg3, Arg4); \
172 obstack_grow (Obs, buf, strlen (buf)); \
173 } while (0)
174
175
176
177 /*-----------------------------------------.
178 | Extensions to use for the output files. |
179 `-----------------------------------------*/
180
181 #ifndef OUTPUT_EXT
182 # define OUTPUT_EXT ".output"
183 #endif
184
185 #ifndef TAB_EXT
186 # define TAB_EXT ".tab"
187 #endif
188
189 #ifndef DEFAULT_TMPDIR
190 # define DEFAULT_TMPDIR "/tmp"
191 #endif
192
193
194
195 /*---------------------.
196 | Free a linked list. |
197 `---------------------*/
198
199 #define LIST_FREE(Type, List) \
200 do { \
201 Type *_node, *_next; \
202 for (_node = List; _node; _node = _next) \
203 { \
204 _next = _node->next; \
205 free (_node); \
206 } \
207 } while (0)
208
209
210 /*---------------------------------------------.
211 | Debugging memory allocation (must be last). |
212 `---------------------------------------------*/
213
214 # if WITH_DMALLOC
215 # define DMALLOC_FUNC_CHECK
216 # include <dmalloc.h>
217 # endif /* WITH_DMALLOC */
218
219 #endif /* ! BISON_SYSTEM_H */
OLDNEW
« no previous file with comments | « bison/src/bison/2.4.1/bison-2.4.1-src/src/symtab.c ('k') | bison/src/bison/2.4.1/bison-2.4.1-src/src/tables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698