Update version
[official-gcc.git] / gcc / defaults.h
blob7f6790b42cfd5b071df97c65aa316c8e7e05bfcb
1 /* Definitions of various defaults for tm.h macros.
2 Copyright (C) 1992, 1996, 1997, 1998, 1999, 2000, 2001
3 Free Software Foundation, Inc.
4 Contributed by Ron Guilmette (rfg@monkeys.com)
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
23 #ifndef GCC_DEFAULTS_H
24 #define GCC_DEFAULTS_H
26 /* Store in OUTPUT a string (made with alloca) containing
27 an assembler-name for a local static variable or function named NAME.
28 LABELNO is an integer which is different for each call. */
30 #ifndef ASM_FORMAT_PRIVATE_NAME
31 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
32 do { \
33 int len = strlen (NAME); \
34 char *temp = (char *) alloca (len + 3); \
35 temp[0] = 'L'; \
36 strcpy (&temp[1], (NAME)); \
37 temp[len + 1] = '.'; \
38 temp[len + 2] = 0; \
39 (OUTPUT) = (char *) alloca (strlen (NAME) + 11); \
40 ASM_GENERATE_INTERNAL_LABEL (OUTPUT, temp, LABELNO); \
41 } while (0)
42 #endif
44 #ifndef ASM_STABD_OP
45 #define ASM_STABD_OP "\t.stabd\t"
46 #endif
48 /* This is how to output an element of a case-vector that is absolute.
49 Some targets don't use this, but we have to define it anyway. */
51 #ifndef ASM_OUTPUT_ADDR_VEC_ELT
52 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
53 do { fprintf (FILE, "\t%s\t", ASM_LONG); \
54 ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", (VALUE)); \
55 fputc ('\n', FILE); \
56 } while (0)
57 #endif
59 /* Provide default for ASM_OUTPUT_ALTERNATE_LABEL_NAME. */
60 #ifndef ASM_OUTPUT_ALTERNATE_LABEL_NAME
61 #define ASM_OUTPUT_ALTERNATE_LABEL_NAME(FILE,INSN) \
62 do { ASM_OUTPUT_LABEL(FILE,LABEL_ALTERNATE_NAME (INSN)); } while (0)
63 #endif
65 /* choose a reasonable default for ASM_OUTPUT_ASCII. */
67 #ifndef ASM_OUTPUT_ASCII
68 #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
69 do { \
70 FILE *_hide_asm_out_file = (MYFILE); \
71 const unsigned char *_hide_p = (const unsigned char *) (MYSTRING); \
72 int _hide_thissize = (MYLENGTH); \
73 { \
74 FILE *asm_out_file = _hide_asm_out_file; \
75 const unsigned char *p = _hide_p; \
76 int thissize = _hide_thissize; \
77 int i; \
78 fprintf (asm_out_file, "\t.ascii \""); \
80 for (i = 0; i < thissize; i++) \
81 { \
82 register int c = p[i]; \
83 if (c == '\"' || c == '\\') \
84 putc ('\\', asm_out_file); \
85 if (ISPRINT(c)) \
86 putc (c, asm_out_file); \
87 else \
88 { \
89 fprintf (asm_out_file, "\\%o", c); \
90 /* After an octal-escape, if a digit follows, \
91 terminate one string constant and start another. \
92 The Vax assembler fails to stop reading the escape \
93 after three digits, so this is the only way we \
94 can get it to parse the data properly. */ \
95 if (i < thissize - 1 && ISDIGIT(p[i + 1])) \
96 fprintf (asm_out_file, "\"\n\t.ascii \""); \
97 } \
98 } \
99 fprintf (asm_out_file, "\"\n"); \
102 while (0)
103 #endif
105 /* This is how we tell the assembler to equate two values. */
106 #ifdef SET_ASM_OP
107 #ifndef ASM_OUTPUT_DEF
108 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
109 do { fprintf ((FILE), "%s", SET_ASM_OP); \
110 assemble_name (FILE, LABEL1); \
111 fprintf (FILE, ","); \
112 assemble_name (FILE, LABEL2); \
113 fprintf (FILE, "\n"); \
114 } while (0)
115 #endif
116 #endif
118 /* This is how to output a reference to a user-level label named NAME. */
120 #ifndef ASM_OUTPUT_LABELREF
121 #define ASM_OUTPUT_LABELREF(FILE,NAME) asm_fprintf ((FILE), "%U%s", (NAME))
122 #endif
124 /* Allow target to print debug info labels specially. This is useful for
125 VLIW targets, since debug info labels should go into the middle of
126 instruction bundles instead of breaking them. */
128 #ifndef ASM_OUTPUT_DEBUG_LABEL
129 #define ASM_OUTPUT_DEBUG_LABEL(FILE, PREFIX, NUM) \
130 ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM)
131 #endif
133 /* This is how we tell the assembler that a symbol is weak. */
134 #ifndef ASM_OUTPUT_WEAK_ALIAS
135 #if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_DEF)
136 #define ASM_OUTPUT_WEAK_ALIAS(STREAM, NAME, VALUE) \
137 do \
139 ASM_WEAKEN_LABEL (STREAM, NAME); \
140 if (VALUE) \
141 ASM_OUTPUT_DEF (STREAM, NAME, VALUE); \
143 while (0)
144 #endif
145 #endif
147 /* This determines whether or not we support weak symbols. */
148 #ifndef SUPPORTS_WEAK
149 #ifdef ASM_WEAKEN_LABEL
150 #define SUPPORTS_WEAK 1
151 #else
152 #define SUPPORTS_WEAK 0
153 #endif
154 #endif
156 /* This determines whether or not we support link-once semantics. */
157 #ifndef SUPPORTS_ONE_ONLY
158 #ifdef MAKE_DECL_ONE_ONLY
159 #define SUPPORTS_ONE_ONLY 1
160 #else
161 #define SUPPORTS_ONE_ONLY 0
162 #endif
163 #endif
165 /* If the target supports weak symbols, define TARGET_ATTRIBUTE_WEAK to
166 provide a weak attribute. Else define it to nothing.
168 This would normally belong in gansidecl.h, but SUPPORTS_WEAK is
169 not available at that time.
171 Note, this is only for use by target files which we know are to be
172 compiled by GCC. */
173 #ifndef TARGET_ATTRIBUTE_WEAK
174 # if SUPPORTS_WEAK
175 # define TARGET_ATTRIBUTE_WEAK __attribute__ ((weak))
176 # else
177 # define TARGET_ATTRIBUTE_WEAK
178 # endif
179 #endif
181 /* If the target supports init_priority C++ attribute, give
182 SUPPORTS_INIT_PRIORITY a nonzero value. */
183 #ifndef SUPPORTS_INIT_PRIORITY
184 #define SUPPORTS_INIT_PRIORITY 1
185 #endif /* SUPPORTS_INIT_PRIORITY */
187 /* If duplicate library search directories can be removed from a
188 linker command without changing the linker's semantics, give this
189 symbol a nonzero. */
190 #ifndef LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
191 #define LINK_ELIMINATE_DUPLICATE_LDIRECTORIES 0
192 #endif /* LINK_ELIMINATE_DUPLICATE_LDIRECTORIES */
194 /* If we have a definition of INCOMING_RETURN_ADDR_RTX, assume that
195 the rest of the DWARF 2 frame unwind support is also provided. */
196 #if !defined (DWARF2_UNWIND_INFO) && defined (INCOMING_RETURN_ADDR_RTX)
197 #define DWARF2_UNWIND_INFO 1
198 #endif
200 #if defined (DWARF2_UNWIND_INFO) && !defined (EH_FRAME_SECTION)
201 # if defined (EH_FRAME_SECTION_ASM_OP)
202 # define EH_FRAME_SECTION() eh_frame_section ()
203 # else
204 /* If we aren't using crtstuff to run ctors, don't use it for EH. */
205 # if defined (ASM_OUTPUT_SECTION_NAME) && defined (ASM_OUTPUT_CONSTRUCTOR)
206 # define EH_FRAME_SECTION_ASM_OP "\t.section\t.eh_frame,\"aw\""
207 # define EH_FRAME_SECTION() \
208 do { named_section (NULL_TREE, ".eh_frame", 0); } while (0)
209 # endif
210 # endif
211 #endif
213 /* If we have no definition for UNIQUE_SECTION, but do have the
214 ability to generate arbitrary sections, construct something
215 reasonable. */
216 #ifdef ASM_OUTPUT_SECTION_NAME
217 #ifndef UNIQUE_SECTION
218 #define UNIQUE_SECTION(DECL,RELOC) \
219 do { \
220 int len; \
221 const char *name; \
222 char *string; \
224 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
225 /* Strip off any encoding in name. */ \
226 STRIP_NAME_ENCODING (name, name); \
228 len = strlen (name) + 1; \
229 string = alloca (len + 1); \
230 sprintf (string, ".%s", name); \
232 DECL_SECTION_NAME (DECL) = build_string (len, string); \
233 } while (0)
234 #endif
235 #ifndef UNIQUE_SECTION_P
236 #define UNIQUE_SECTION_P(DECL) 0
237 #endif
238 #endif
240 /* By default, we generate a label at the beginning and end of the
241 text section, and compute the size of the text section by
242 subtracting the two. However, on some platforms that doesn't
243 work, and we use the section itself, rather than a label at the
244 beginning of it, to indicate the start of the section. On such
245 platforms, define this to zero. */
246 #ifndef DWARF2_GENERATE_TEXT_SECTION_LABEL
247 #define DWARF2_GENERATE_TEXT_SECTION_LABEL 1
248 #endif
250 /* Supply a default definition for PROMOTE_PROTOTYPES. */
251 #ifndef PROMOTE_PROTOTYPES
252 #define PROMOTE_PROTOTYPES 0
253 #endif
255 /* Number of hardware registers that go into the DWARF-2 unwind info.
256 If not defined, equals FIRST_PSEUDO_REGISTER */
258 #ifndef DWARF_FRAME_REGISTERS
259 #define DWARF_FRAME_REGISTERS FIRST_PSEUDO_REGISTER
260 #endif
262 /* Default sizes for base C types. If the sizes are different for
263 your target, you should override these values by defining the
264 appropriate symbols in your tm.h file. */
266 #ifndef CHAR_TYPE_SIZE
267 #define CHAR_TYPE_SIZE BITS_PER_UNIT
268 #endif
270 #ifndef SHORT_TYPE_SIZE
271 #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
272 #endif
274 #ifndef INT_TYPE_SIZE
275 #define INT_TYPE_SIZE BITS_PER_WORD
276 #endif
278 #ifndef LONG_TYPE_SIZE
279 #define LONG_TYPE_SIZE BITS_PER_WORD
280 #endif
282 #ifndef LONG_LONG_TYPE_SIZE
283 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
284 #endif
286 #ifndef WCHAR_TYPE_SIZE
287 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
288 #endif
290 #ifndef WCHAR_UNSIGNED
291 #define WCHAR_UNSIGNED 0
292 #endif
294 #ifndef FLOAT_TYPE_SIZE
295 #define FLOAT_TYPE_SIZE BITS_PER_WORD
296 #endif
298 #ifndef DOUBLE_TYPE_SIZE
299 #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
300 #endif
302 #ifndef LONG_DOUBLE_TYPE_SIZE
303 #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
304 #endif
306 #ifndef BUILD_VA_LIST_TYPE
307 #define BUILD_VA_LIST_TYPE(X) ((X) = ptr_type_node)
308 #endif
310 /* By default, the preprocessor should be invoked the same way in C++
311 as in C. */
312 #ifndef CPLUSPLUS_CPP_SPEC
313 #ifdef CPP_SPEC
314 #define CPLUSPLUS_CPP_SPEC CPP_SPEC
315 #endif
316 #endif
318 /* By default, the C++ compiler will use the lowest bit of the pointer
319 to function to indicate a pointer-to-member-function points to a
320 virtual member function. However, if FUNCTION_BOUNDARY indicates
321 function addresses aren't always even, the lowest bit of the delta
322 field will be used. */
323 #ifndef TARGET_PTRMEMFUNC_VBIT_LOCATION
324 #define TARGET_PTRMEMFUNC_VBIT_LOCATION \
325 (FUNCTION_BOUNDARY >= 2 * BITS_PER_UNIT \
326 ? ptrmemfunc_vbit_in_pfn : ptrmemfunc_vbit_in_delta)
327 #endif
329 /* By default, the C++ compiler will use function addresses in the
330 vtable entries. Setting this non-zero tells the compiler to use
331 function descriptors instead. The value of this macro says how
332 many words wide the descriptor is (normally 2). It is assumed
333 that the address of a function descriptor may be treated as a
334 pointer to a function. */
335 #ifndef TARGET_VTABLE_USES_DESCRIPTORS
336 #define TARGET_VTABLE_USES_DESCRIPTORS 0
337 #endif
339 /* Select a format to encode pointers in exception handling data. We
340 prefer those that result in fewer dynamic relocations. Assume no
341 special support here and encode direct references. */
342 #ifndef ASM_PREFERRED_EH_DATA_FORMAT
343 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) DW_EH_PE_absptr
344 #endif
346 /* True if it is possible to profile code that does not have a frame
347 pointer. */
349 #ifndef TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
350 #define TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER true
351 #endif
353 #ifndef ACCUMULATE_OUTGOING_ARGS
354 #define ACCUMULATE_OUTGOING_ARGS 0
355 #endif
357 /* Supply a default definition for PUSH_ARGS. */
358 #ifndef PUSH_ARGS
359 #ifdef PUSH_ROUNDING
360 #define PUSH_ARGS !ACCUMULATE_OUTGOING_ARGS
361 #else
362 #define PUSH_ARGS 0
363 #endif
364 #endif
366 #endif /* GCC_DEFAULTS_H */