OSDN Git Service

* c-lex.c (GET_ENVIRONMENT): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / defaults.h
1 /* Definitions of various defaults for tm.h macros.
2    Copyright (C) 1992, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3    Free Software Foundation, Inc.
4    Contributed by Ron Guilmette (rfg@monkeys.com)
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING.  If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 02111-1307, USA.  */
22
23 #ifndef GCC_DEFAULTS_H
24 #define GCC_DEFAULTS_H
25
26 #ifndef GET_ENVIRONMENT
27 #define GET_ENVIRONMENT(VALUE, NAME) do { (VALUE) = getenv (NAME); } while (0)
28 #endif
29
30 /* Define default standard character escape sequences.  */
31 #ifndef TARGET_BELL
32 #  define TARGET_BELL 007
33 #  define TARGET_BS 010
34 #  define TARGET_TAB 011
35 #  define TARGET_NEWLINE 012
36 #  define TARGET_VT 013
37 #  define TARGET_FF 014
38 #  define TARGET_CR 015
39 #  define TARGET_ESC 033
40 #endif
41
42 /* When removal of CPP_PREDEFINES is complete, TARGET_CPU_CPP_BULITINS
43    can also be removed from here.  */
44 #ifndef TARGET_OS_CPP_BUILTINS
45 # define TARGET_OS_CPP_BUILTINS()
46 #endif
47 #ifndef TARGET_CPU_CPP_BUILTINS
48 # define TARGET_CPU_CPP_BUILTINS()
49 #endif
50 #ifndef CPP_PREDEFINES
51 # define CPP_PREDEFINES ""
52 #endif
53
54 /* Store in OUTPUT a string (made with alloca) containing
55    an assembler-name for a local static variable or function named NAME.
56    LABELNO is an integer which is different for each call.  */
57
58 #ifndef ASM_FORMAT_PRIVATE_NAME
59 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)                  \
60   do {                                                                  \
61     int len = strlen (NAME);                                            \
62     char *temp = (char *) alloca (len + 3);                             \
63     temp[0] = 'L';                                                      \
64     strcpy (&temp[1], (NAME));                                          \
65     temp[len + 1] = '.';                                                \
66     temp[len + 2] = 0;                                                  \
67     (OUTPUT) = (char *) alloca (strlen (NAME) + 11);                    \
68     ASM_GENERATE_INTERNAL_LABEL (OUTPUT, temp, LABELNO);                \
69   } while (0)
70 #endif
71
72 #ifndef ASM_STABD_OP
73 #define ASM_STABD_OP "\t.stabd\t"
74 #endif
75
76 /* This is how to output an element of a case-vector that is absolute.
77    Some targets don't use this, but we have to define it anyway.  */
78
79 #ifndef ASM_OUTPUT_ADDR_VEC_ELT
80 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
81 do { fputs (integer_asm_op (POINTER_SIZE / UNITS_PER_WORD, TRUE), FILE); \
82      ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", (VALUE));                    \
83      fputc ('\n', FILE);                                                \
84    } while (0)
85 #endif
86
87 /* choose a reasonable default for ASM_OUTPUT_ASCII.  */
88
89 #ifndef ASM_OUTPUT_ASCII
90 #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
91   do {                                                                        \
92     FILE *_hide_asm_out_file = (MYFILE);                                      \
93     const unsigned char *_hide_p = (const unsigned char *) (MYSTRING);        \
94     int _hide_thissize = (MYLENGTH);                                          \
95     {                                                                         \
96       FILE *asm_out_file = _hide_asm_out_file;                                \
97       const unsigned char *p = _hide_p;                                       \
98       int thissize = _hide_thissize;                                          \
99       int i;                                                                  \
100       fprintf (asm_out_file, "\t.ascii \"");                                  \
101                                                                               \
102       for (i = 0; i < thissize; i++)                                          \
103         {                                                                     \
104           int c = p[i];                                                       \
105           if (c == '\"' || c == '\\')                                         \
106             putc ('\\', asm_out_file);                                        \
107           if (ISPRINT(c))                                                     \
108             putc (c, asm_out_file);                                           \
109           else                                                                \
110             {                                                                 \
111               fprintf (asm_out_file, "\\%o", c);                              \
112               /* After an octal-escape, if a digit follows,                   \
113                  terminate one string constant and start another.             \
114                  The VAX assembler fails to stop reading the escape           \
115                  after three digits, so this is the only way we               \
116                  can get it to parse the data properly.  */                   \
117               if (i < thissize - 1 && ISDIGIT(p[i + 1]))                      \
118                 fprintf (asm_out_file, "\"\n\t.ascii \"");                    \
119           }                                                                   \
120         }                                                                     \
121       fprintf (asm_out_file, "\"\n");                                         \
122     }                                                                         \
123   }                                                                           \
124   while (0)
125 #endif
126
127 /* This is how we tell the assembler to equate two values.  */
128 #ifdef SET_ASM_OP
129 #ifndef ASM_OUTPUT_DEF
130 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
131  do {   fprintf ((FILE), "%s", SET_ASM_OP);                             \
132         assemble_name (FILE, LABEL1);                                   \
133         fprintf (FILE, ",");                                            \
134         assemble_name (FILE, LABEL2);                                   \
135         fprintf (FILE, "\n");                                           \
136   } while (0)
137 #endif
138 #endif
139
140 /* This is how to output a reference to a user-level label named NAME.  */
141
142 #ifndef ASM_OUTPUT_LABELREF
143 #define ASM_OUTPUT_LABELREF(FILE,NAME)  asm_fprintf ((FILE), "%U%s", (NAME))
144 #endif
145
146 /* Allow target to print debug info labels specially.  This is useful for
147    VLIW targets, since debug info labels should go into the middle of
148    instruction bundles instead of breaking them.  */
149
150 #ifndef ASM_OUTPUT_DEBUG_LABEL
151 #define ASM_OUTPUT_DEBUG_LABEL(FILE, PREFIX, NUM) \
152   ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM)
153 #endif
154
155 /* This is how we tell the assembler that a symbol is weak.  */
156 #ifndef ASM_OUTPUT_WEAK_ALIAS
157 #if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_DEF)
158 #define ASM_OUTPUT_WEAK_ALIAS(STREAM, NAME, VALUE)      \
159   do                                                    \
160     {                                                   \
161       ASM_WEAKEN_LABEL (STREAM, NAME);                  \
162       if (VALUE)                                        \
163         ASM_OUTPUT_DEF (STREAM, NAME, VALUE);           \
164     }                                                   \
165   while (0)
166 #endif
167 #endif
168
169 /* This determines whether or not we support weak symbols.  */
170 #ifndef SUPPORTS_WEAK
171 #if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
172 #define SUPPORTS_WEAK 1
173 #else
174 #define SUPPORTS_WEAK 0
175 #endif
176 #endif
177
178 /* This determines whether or not we support link-once semantics.  */
179 #ifndef SUPPORTS_ONE_ONLY
180 #ifdef MAKE_DECL_ONE_ONLY
181 #define SUPPORTS_ONE_ONLY 1
182 #else
183 #define SUPPORTS_ONE_ONLY 0
184 #endif
185 #endif
186
187 /* If the target supports weak symbols, define TARGET_ATTRIBUTE_WEAK to
188    provide a weak attribute.  Else define it to nothing. 
189
190    This would normally belong in ansidecl.h, but SUPPORTS_WEAK is
191    not available at that time.
192
193    Note, this is only for use by target files which we know are to be
194    compiled by GCC.  */
195 #ifndef TARGET_ATTRIBUTE_WEAK
196 # if SUPPORTS_WEAK
197 #  define TARGET_ATTRIBUTE_WEAK __attribute__ ((weak))
198 # else
199 #  define TARGET_ATTRIBUTE_WEAK
200 # endif
201 #endif
202
203 /* If the target supports init_priority C++ attribute, give
204    SUPPORTS_INIT_PRIORITY a nonzero value.  */
205 #ifndef SUPPORTS_INIT_PRIORITY
206 #define SUPPORTS_INIT_PRIORITY 1
207 #endif /* SUPPORTS_INIT_PRIORITY */
208
209 /* If duplicate library search directories can be removed from a
210    linker command without changing the linker's semantics, give this
211    symbol a nonzero.  */
212 #ifndef LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
213 #define LINK_ELIMINATE_DUPLICATE_LDIRECTORIES 0
214 #endif /* LINK_ELIMINATE_DUPLICATE_LDIRECTORIES */
215
216 /* If we have a definition of INCOMING_RETURN_ADDR_RTX, assume that
217    the rest of the DWARF 2 frame unwind support is also provided.  */
218 #if !defined (DWARF2_UNWIND_INFO) && defined (INCOMING_RETURN_ADDR_RTX)
219 #define DWARF2_UNWIND_INFO 1
220 #endif
221
222 /* If we have named sections, and we're using crtstuff to run ctors,
223    use them for registering eh frame information.  */
224 #if defined (TARGET_ASM_NAMED_SECTION) && DWARF2_UNWIND_INFO \
225     && !defined(EH_FRAME_IN_DATA_SECTION)
226 #ifndef EH_FRAME_SECTION_NAME
227 #define EH_FRAME_SECTION_NAME ".eh_frame"
228 #endif
229 #endif
230
231 /* If we have named section and we support weak symbols, then use the
232    .jcr section for recording java classes which need to be registered
233    at program start-up time.  */
234 #if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
235 #ifndef JCR_SECTION_NAME
236 #define JCR_SECTION_NAME ".jcr"
237 #endif
238 #endif
239
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
249
250 /* Supply a default definition for PROMOTE_PROTOTYPES.  */
251 #ifndef PROMOTE_PROTOTYPES
252 #define PROMOTE_PROTOTYPES      0
253 #endif
254
255 /* Number of hardware registers that go into the DWARF-2 unwind info.
256    If not defined, equals FIRST_PSEUDO_REGISTER  */
257
258 #ifndef DWARF_FRAME_REGISTERS
259 #define DWARF_FRAME_REGISTERS FIRST_PSEUDO_REGISTER
260 #endif
261
262 /* How to renumber registers for dbx and gdb.  If not defined, assume
263    no renumbering is necessary.  */
264
265 #ifndef DBX_REGISTER_NUMBER
266 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
267 #endif
268
269 /* Default sizes for base C types.  If the sizes are different for
270    your target, you should override these values by defining the
271    appropriate symbols in your tm.h file.  */
272
273 #ifndef BITS_PER_UNIT
274 #define BITS_PER_UNIT 8
275 #endif
276
277 #ifndef BITS_PER_WORD
278 #define BITS_PER_WORD (BITS_PER_UNIT * UNITS_PER_WORD)
279 #endif
280
281 #ifndef CHAR_TYPE_SIZE
282 #define CHAR_TYPE_SIZE BITS_PER_UNIT
283 #endif
284
285 #ifndef BOOL_TYPE_SIZE
286 /* `bool' has size and alignment `1', on almost all platforms.  */
287 #define BOOL_TYPE_SIZE CHAR_TYPE_SIZE
288 #endif
289
290 #ifndef SHORT_TYPE_SIZE
291 #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
292 #endif
293
294 #ifndef INT_TYPE_SIZE
295 #define INT_TYPE_SIZE BITS_PER_WORD
296 #endif
297
298 #ifndef LONG_TYPE_SIZE
299 #define LONG_TYPE_SIZE BITS_PER_WORD
300 #endif
301
302 #ifndef LONG_LONG_TYPE_SIZE
303 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
304 #endif
305
306 #ifndef WCHAR_TYPE_SIZE
307 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
308 #endif
309
310 #ifndef FLOAT_TYPE_SIZE
311 #define FLOAT_TYPE_SIZE BITS_PER_WORD
312 #endif
313
314 #ifndef DOUBLE_TYPE_SIZE
315 #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
316 #endif
317
318 #ifndef LONG_DOUBLE_TYPE_SIZE
319 #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
320 #endif
321
322 /* Width in bits of a pointer.  Mind the value of the macro `Pmode'.  */
323 #ifndef POINTER_SIZE
324 #define POINTER_SIZE BITS_PER_WORD
325 #endif
326
327 #ifndef BUILD_VA_LIST_TYPE
328 #define BUILD_VA_LIST_TYPE(X) ((X) = ptr_type_node)
329 #endif
330
331 #ifndef PIC_OFFSET_TABLE_REGNUM
332 #define PIC_OFFSET_TABLE_REGNUM INVALID_REGNUM
333 #endif
334
335 /* Type used by GCOV counters.  Use 64bit data type if target supports
336    it.  */
337 #if LONG_TYPE_SIZE >= 64
338 #define GCOV_TYPE_SIZE LONG_TYPE_SIZE
339 #else
340 #define GCOV_TYPE_SIZE LONG_LONG_TYPE_SIZE
341 #endif
342
343
344 /* By default, the preprocessor should be invoked the same way in C++
345    as in C.  */
346 #ifndef CPLUSPLUS_CPP_SPEC
347 #ifdef CPP_SPEC
348 #define CPLUSPLUS_CPP_SPEC CPP_SPEC
349 #endif
350 #endif
351
352 #ifndef ACCUMULATE_OUTGOING_ARGS
353 #define ACCUMULATE_OUTGOING_ARGS 0
354 #endif
355
356 /* Supply a default definition for PUSH_ARGS.  */
357 #ifndef PUSH_ARGS
358 #ifdef PUSH_ROUNDING
359 #define PUSH_ARGS       !ACCUMULATE_OUTGOING_ARGS
360 #else
361 #define PUSH_ARGS       0
362 #endif
363 #endif
364
365 /* If PREFERRED_STACK_BOUNDARY is not defined, set it to STACK_BOUNDARY.
366    STACK_BOUNDARY is required.  */
367 #ifndef PREFERRED_STACK_BOUNDARY
368 #define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
369 #endif
370
371 /* By default, the C++ compiler will use function addresses in the
372    vtable entries.  Setting this non-zero tells the compiler to use
373    function descriptors instead.  The value of this macro says how
374    many words wide the descriptor is (normally 2).  It is assumed 
375    that the address of a function descriptor may be treated as a
376    pointer to a function.  */
377 #ifndef TARGET_VTABLE_USES_DESCRIPTORS
378 #define TARGET_VTABLE_USES_DESCRIPTORS 0
379 #endif
380
381 /* By default, the vtable entries are void pointers, the so the alignment
382    is the same as pointer alignment.  The value of this macro specifies
383    the alignment of the vtable entry in bits.  It should be defined only
384    when special alignment is necessary. */
385 #ifndef TARGET_VTABLE_ENTRY_ALIGN
386 #define TARGET_VTABLE_ENTRY_ALIGN POINTER_SIZE
387 #endif
388
389 /* There are a few non-descriptor entries in the vtable at offsets below
390    zero.  If these entries must be padded (say, to preserve the alignment
391    specified by TARGET_VTABLE_ENTRY_ALIGN), set this to the number of
392    words in each data entry.  */
393 #ifndef TARGET_VTABLE_DATA_ENTRY_DISTANCE
394 #define TARGET_VTABLE_DATA_ENTRY_DISTANCE 1
395 #endif
396
397 /* Select a format to encode pointers in exception handling data.  We
398    prefer those that result in fewer dynamic relocations.  Assume no
399    special support here and encode direct references.  */
400 #ifndef ASM_PREFERRED_EH_DATA_FORMAT
401 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)  DW_EH_PE_absptr
402 #endif
403
404 /* By default, the C++ compiler will use the lowest bit of the pointer
405    to function to indicate a pointer-to-member-function points to a
406    virtual member function.  However, if FUNCTION_BOUNDARY indicates
407    function addresses aren't always even, the lowest bit of the delta
408    field will be used.  */
409 #ifndef TARGET_PTRMEMFUNC_VBIT_LOCATION
410 #define TARGET_PTRMEMFUNC_VBIT_LOCATION \
411   (FUNCTION_BOUNDARY >= 2 * BITS_PER_UNIT \
412    ? ptrmemfunc_vbit_in_pfn : ptrmemfunc_vbit_in_delta)
413 #endif
414
415 #ifndef DEFAULT_GDB_EXTENSIONS
416 #define DEFAULT_GDB_EXTENSIONS 1
417 #endif
418
419 /* If more than one debugging type is supported, you must define
420    PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
421
422    This is one long line cause VAXC can't handle a \-newline.  */
423 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO) + defined (VMS_DEBUGGING_INFO))
424 #ifndef PREFERRED_DEBUGGING_TYPE
425 You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
426 #endif /* no PREFERRED_DEBUGGING_TYPE */
427 #else /* Only one debugging format supported.  Define PREFERRED_DEBUGGING_TYPE
428          so other code needn't care.  */
429 #ifdef DBX_DEBUGGING_INFO
430 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
431 #endif
432 #ifdef SDB_DEBUGGING_INFO
433 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
434 #endif
435 #ifdef DWARF_DEBUGGING_INFO
436 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
437 #endif
438 #ifdef DWARF2_DEBUGGING_INFO
439 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
440 #endif
441 #ifdef VMS_DEBUGGING_INFO
442 #define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
443 #endif
444 #ifdef XCOFF_DEBUGGING_INFO
445 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
446 #endif
447 #endif /* More than one debugger format enabled.  */
448
449 /* If still not defined, must have been because no debugging formats
450    are supported.  */
451 #ifndef PREFERRED_DEBUGGING_TYPE
452 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
453 #endif
454
455 /* This is set to 1 if BYTES_BIG_ENDIAN is defined but the target uses a
456    little-endian method of passing and returning structures in registers.
457    On the HP-UX IA64 and PA64 platforms structures are aligned differently
458    then integral values and setting this value to 1 will allow for the
459    special handling of structure arguments and return values in regs.  */
460
461 #ifndef FUNCTION_ARG_REG_LITTLE_ENDIAN
462 #define FUNCTION_ARG_REG_LITTLE_ENDIAN 0
463 #endif
464
465 /* Determine the register class for registers suitable to be the base
466    address register in a MEM.  Allow the choice to be dependent upon
467    the mode of the memory access.  */
468 #ifndef MODE_BASE_REG_CLASS
469 #define MODE_BASE_REG_CLASS(MODE) BASE_REG_CLASS
470 #endif
471
472 #ifndef LARGEST_EXPONENT_IS_NORMAL
473 #define LARGEST_EXPONENT_IS_NORMAL(SIZE) 0
474 #endif
475
476 #ifndef ROUND_TOWARDS_ZERO
477 #define ROUND_TOWARDS_ZERO 0
478 #endif
479
480 #ifndef MODE_HAS_NANS
481 #define MODE_HAS_NANS(MODE)                                     \
482   (FLOAT_MODE_P (MODE)                                          \
483    && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT                  \
484    && !LARGEST_EXPONENT_IS_NORMAL (GET_MODE_BITSIZE (MODE)))
485 #endif
486
487 #ifndef MODE_HAS_INFINITIES
488 #define MODE_HAS_INFINITIES(MODE)                               \
489   (FLOAT_MODE_P (MODE)                                          \
490    && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT                  \
491    && !LARGEST_EXPONENT_IS_NORMAL (GET_MODE_BITSIZE (MODE)))
492 #endif
493
494 #ifndef MODE_HAS_SIGNED_ZEROS
495 #define MODE_HAS_SIGNED_ZEROS(MODE) \
496   (FLOAT_MODE_P (MODE) && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
497 #endif
498
499 #ifndef MODE_HAS_SIGN_DEPENDENT_ROUNDING
500 #define MODE_HAS_SIGN_DEPENDENT_ROUNDING(MODE)                  \
501   (FLOAT_MODE_P (MODE)                                          \
502    && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT                  \
503    && !ROUND_TOWARDS_ZERO)
504 #endif
505
506 #ifndef HOT_TEXT_SECTION_NAME
507 #define HOT_TEXT_SECTION_NAME "text.hot"
508 #endif
509
510 #ifndef UNLIKELY_EXECUTED_TEXT_SECTION_NAME
511 #define UNLIKELY_EXECUTED_TEXT_SECTION_NAME "text.unlikely"
512 #endif
513
514 #ifndef VECTOR_MODE_SUPPORTED_P
515 #define VECTOR_MODE_SUPPORTED_P(MODE) 0
516 #endif
517
518 /* Determine whether __cxa_atexit, rather than atexit, is used to
519    register C++ destructors for local statics and global objects. */
520 #ifndef DEFAULT_USE_CXA_ATEXIT
521 #define DEFAULT_USE_CXA_ATEXIT 0
522 #endif
523
524 #endif  /* ! GCC_DEFAULTS_H */