OSDN Git Service

* c-pragma.h (HANDLE_PRAGMA_WEAK): Define iff ASM_WEAKEN_LABEL and
[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
3    Free Software Foundation, Inc.
4    Contributed by Ron Guilmette (rfg@monkeys.com)
5
6 This file is part of GNU CC.
7
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.
12
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.
17
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.  */
22
23 #ifndef GCC_DEFAULTS_H
24 #define GCC_DEFAULTS_H
25
26 /* Define default standard character escape sequences.  */
27 #ifndef TARGET_BELL
28 #  define TARGET_BELL 007
29 #  define TARGET_BS 010
30 #  define TARGET_TAB 011
31 #  define TARGET_NEWLINE 012
32 #  define TARGET_VT 013
33 #  define TARGET_FF 014
34 #  define TARGET_CR 015
35 #  define TARGET_ESC 033
36 #endif
37
38 /* Store in OUTPUT a string (made with alloca) containing
39    an assembler-name for a local static variable or function named NAME.
40    LABELNO is an integer which is different for each call.  */
41
42 #ifndef ASM_FORMAT_PRIVATE_NAME
43 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)                  \
44   do {                                                                  \
45     int len = strlen (NAME);                                            \
46     char *temp = (char *) alloca (len + 3);                             \
47     temp[0] = 'L';                                                      \
48     strcpy (&temp[1], (NAME));                                          \
49     temp[len + 1] = '.';                                                \
50     temp[len + 2] = 0;                                                  \
51     (OUTPUT) = (char *) alloca (strlen (NAME) + 11);                    \
52     ASM_GENERATE_INTERNAL_LABEL (OUTPUT, temp, LABELNO);                \
53   } while (0)
54 #endif
55
56 #ifndef ASM_STABD_OP
57 #define ASM_STABD_OP "\t.stabd\t"
58 #endif
59
60 /* This is how to output an element of a case-vector that is absolute.
61    Some targets don't use this, but we have to define it anyway.  */
62
63 #ifndef ASM_OUTPUT_ADDR_VEC_ELT
64 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
65 do { fprintf (FILE, "\t%s\t", ASM_LONG);                                \
66      ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", (VALUE));                    \
67      fputc ('\n', FILE);                                                \
68    } while (0)
69 #endif
70
71 /* Provide default for ASM_OUTPUT_ALTERNATE_LABEL_NAME.  */
72 #ifndef ASM_OUTPUT_ALTERNATE_LABEL_NAME
73 #define ASM_OUTPUT_ALTERNATE_LABEL_NAME(FILE,INSN) \
74 do { ASM_OUTPUT_LABEL(FILE,LABEL_ALTERNATE_NAME (INSN)); } while (0)
75 #endif
76
77 /* choose a reasonable default for ASM_OUTPUT_ASCII.  */
78
79 #ifndef ASM_OUTPUT_ASCII
80 #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
81   do {                                                                        \
82     FILE *_hide_asm_out_file = (MYFILE);                                      \
83     const unsigned char *_hide_p = (const unsigned char *) (MYSTRING);        \
84     int _hide_thissize = (MYLENGTH);                                          \
85     {                                                                         \
86       FILE *asm_out_file = _hide_asm_out_file;                                \
87       const unsigned char *p = _hide_p;                                       \
88       int thissize = _hide_thissize;                                          \
89       int i;                                                                  \
90       fprintf (asm_out_file, "\t.ascii \"");                                  \
91                                                                               \
92       for (i = 0; i < thissize; i++)                                          \
93         {                                                                     \
94           register int c = p[i];                                              \
95           if (c == '\"' || c == '\\')                                         \
96             putc ('\\', asm_out_file);                                        \
97           if (ISPRINT(c))                                                     \
98             putc (c, asm_out_file);                                           \
99           else                                                                \
100             {                                                                 \
101               fprintf (asm_out_file, "\\%o", c);                              \
102               /* After an octal-escape, if a digit follows,                   \
103                  terminate one string constant and start another.             \
104                  The Vax assembler fails to stop reading the escape           \
105                  after three digits, so this is the only way we               \
106                  can get it to parse the data properly.  */                   \
107               if (i < thissize - 1 && ISDIGIT(p[i + 1]))                      \
108                 fprintf (asm_out_file, "\"\n\t.ascii \"");                    \
109           }                                                                   \
110         }                                                                     \
111       fprintf (asm_out_file, "\"\n");                                         \
112     }                                                                         \
113   }                                                                           \
114   while (0)
115 #endif
116
117 /* This is how we tell the assembler to equate two values.  */
118 #ifdef SET_ASM_OP
119 #ifndef ASM_OUTPUT_DEF
120 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
121  do {   fprintf ((FILE), "%s", SET_ASM_OP);                             \
122         assemble_name (FILE, LABEL1);                                   \
123         fprintf (FILE, ",");                                            \
124         assemble_name (FILE, LABEL2);                                   \
125         fprintf (FILE, "\n");                                           \
126   } while (0)
127 #endif
128 #endif
129
130 /* This is how to output a reference to a user-level label named NAME.  */
131
132 #ifndef ASM_OUTPUT_LABELREF
133 #define ASM_OUTPUT_LABELREF(FILE,NAME)  asm_fprintf ((FILE), "%U%s", (NAME))
134 #endif
135
136 /* Allow target to print debug info labels specially.  This is useful for
137    VLIW targets, since debug info labels should go into the middle of
138    instruction bundles instead of breaking them.  */
139
140 #ifndef ASM_OUTPUT_DEBUG_LABEL
141 #define ASM_OUTPUT_DEBUG_LABEL(FILE, PREFIX, NUM) \
142   ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM)
143 #endif
144
145 /* This is how we tell the assembler that a symbol is weak.  */
146 #if !defined (ASM_OUTPUT_WEAK_ALIAS) && defined (ASM_OUTPUT_DEF)
147 #define ASM_OUTPUT_WEAK_ALIAS(STREAM, NAME, VALUE)      \
148   do                                                    \
149     {                                                   \
150       ASM_WEAKEN_LABEL (STREAM, NAME);                  \
151       if (VALUE)                                        \
152         ASM_OUTPUT_DEF (STREAM, NAME, VALUE);           \
153     }                                                   \
154   while (0)
155 #endif
156
157 /* This determines whether or not we support weak symbols.  */
158 #ifndef SUPPORTS_WEAK
159 #ifdef ASM_WEAKEN_LABEL
160 #define SUPPORTS_WEAK 1
161 #else
162 #define SUPPORTS_WEAK 0
163 #endif
164 #endif
165
166 /* This determines whether or not we support link-once semantics.  */
167 #ifndef SUPPORTS_ONE_ONLY
168 #ifdef MAKE_DECL_ONE_ONLY
169 #define SUPPORTS_ONE_ONLY 1
170 #else
171 #define SUPPORTS_ONE_ONLY 0
172 #endif
173 #endif
174
175 /* If the target supports weak symbols, define TARGET_ATTRIBUTE_WEAK to
176    provide a weak attribute.  Else define it to nothing. 
177
178    This would normally belong in ansidecl.h, but SUPPORTS_WEAK is
179    not available at that time.
180
181    Note, this is only for use by target files which we know are to be
182    compiled by GCC.  */
183 #ifndef TARGET_ATTRIBUTE_WEAK
184 # if SUPPORTS_WEAK
185 #  define TARGET_ATTRIBUTE_WEAK __attribute__ ((weak))
186 # else
187 #  define TARGET_ATTRIBUTE_WEAK
188 # endif
189 #endif
190
191 /* If the target supports init_priority C++ attribute, give
192    SUPPORTS_INIT_PRIORITY a nonzero value.  */
193 #ifndef SUPPORTS_INIT_PRIORITY
194 #define SUPPORTS_INIT_PRIORITY 1
195 #endif /* SUPPORTS_INIT_PRIORITY */
196
197 /* If duplicate library search directories can be removed from a
198    linker command without changing the linker's semantics, give this
199    symbol a nonzero.  */
200 #ifndef LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
201 #define LINK_ELIMINATE_DUPLICATE_LDIRECTORIES 0
202 #endif /* LINK_ELIMINATE_DUPLICATE_LDIRECTORIES */
203
204 /* If we have a definition of INCOMING_RETURN_ADDR_RTX, assume that
205    the rest of the DWARF 2 frame unwind support is also provided.  */
206 #if !defined (DWARF2_UNWIND_INFO) && defined (INCOMING_RETURN_ADDR_RTX)
207 #define DWARF2_UNWIND_INFO 1
208 #endif
209
210 #if defined (DWARF2_UNWIND_INFO) && !defined (EH_FRAME_SECTION)
211 # if defined (EH_FRAME_SECTION_ASM_OP)
212 #  define EH_FRAME_SECTION() eh_frame_section ()
213 # else
214    /* If we aren't using crtstuff to run ctors, don't use it for EH.  */
215 #  if defined (ASM_OUTPUT_SECTION_NAME) && defined (ASM_OUTPUT_CONSTRUCTOR)
216 #   define EH_FRAME_SECTION_ASM_OP      "\t.section\t.eh_frame,\"aw\""
217 #   define EH_FRAME_SECTION() \
218      do { named_section (NULL_TREE, ".eh_frame", 0); } while (0)
219 #  endif
220 # endif
221 #endif
222
223 /* If we have no definition for UNIQUE_SECTION, but do have the 
224    ability to generate arbitrary sections, construct something
225    reasonable.  */
226 #ifdef ASM_OUTPUT_SECTION_NAME
227 #ifndef UNIQUE_SECTION
228 #define UNIQUE_SECTION(DECL,RELOC)                              \
229 do {                                                            \
230   int len;                                                      \
231   const char *name;                                             \
232   char *string;                                                 \
233                                                                 \
234   name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL));       \
235   /* Strip off any encoding in name.  */                        \
236   STRIP_NAME_ENCODING (name, name);                             \
237                                                                 \
238   len = strlen (name) + 1;                                      \
239   string = alloca (len + 1);                                    \
240   sprintf (string, ".%s", name);                                \
241                                                                 \
242   DECL_SECTION_NAME (DECL) = build_string (len, string);        \
243 } while (0)
244 #endif
245 #ifndef UNIQUE_SECTION_P
246 #define UNIQUE_SECTION_P(DECL) 0
247 #endif
248 #endif
249
250 /* By default, we generate a label at the beginning and end of the
251    text section, and compute the size of the text section by
252    subtracting the two.  However, on some platforms that doesn't 
253    work, and we use the section itself, rather than a label at the
254    beginning of it, to indicate the start of the section.  On such
255    platforms, define this to zero.  */
256 #ifndef DWARF2_GENERATE_TEXT_SECTION_LABEL
257 #define DWARF2_GENERATE_TEXT_SECTION_LABEL 1
258 #endif
259
260 /* Supply a default definition for PROMOTE_PROTOTYPES.  */
261 #ifndef PROMOTE_PROTOTYPES
262 #define PROMOTE_PROTOTYPES      0
263 #endif
264
265 /* Number of hardware registers that go into the DWARF-2 unwind info.
266    If not defined, equals FIRST_PSEUDO_REGISTER  */
267
268 #ifndef DWARF_FRAME_REGISTERS
269 #define DWARF_FRAME_REGISTERS FIRST_PSEUDO_REGISTER
270 #endif
271
272 /* Default sizes for base C types.  If the sizes are different for
273    your target, you should override these values by defining the
274    appropriate symbols in your tm.h file.  */
275
276 #ifndef CHAR_TYPE_SIZE
277 #define CHAR_TYPE_SIZE BITS_PER_UNIT
278 #endif
279
280 #ifndef SHORT_TYPE_SIZE
281 #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
282 #endif
283
284 #ifndef INT_TYPE_SIZE
285 #define INT_TYPE_SIZE BITS_PER_WORD
286 #endif
287
288 #ifndef LONG_TYPE_SIZE
289 #define LONG_TYPE_SIZE BITS_PER_WORD
290 #endif
291
292 #ifndef LONG_LONG_TYPE_SIZE
293 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
294 #endif
295
296 #ifndef WCHAR_TYPE_SIZE
297 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
298 #endif
299
300 #ifndef WCHAR_UNSIGNED
301 #define WCHAR_UNSIGNED 0
302 #endif
303
304 #ifndef FLOAT_TYPE_SIZE
305 #define FLOAT_TYPE_SIZE BITS_PER_WORD
306 #endif
307
308 #ifndef DOUBLE_TYPE_SIZE
309 #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
310 #endif
311
312 #ifndef LONG_DOUBLE_TYPE_SIZE
313 #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
314 #endif
315
316 #ifndef BUILD_VA_LIST_TYPE
317 #define BUILD_VA_LIST_TYPE(X) ((X) = ptr_type_node)
318 #endif
319
320 #ifndef PIC_OFFSET_TABLE_REGNUM
321 #define PIC_OFFSET_TABLE_REGNUM INVALID_REGNUM
322 #endif
323
324 /* Type used by GCOV counters.  Use 64bit data type if target supports
325    it.  */
326 #if LONG_TYPE_SIZE >= 64
327 #define GCOV_TYPE_SIZE LONG_TYPE_SIZE
328 #else
329 #define GCOV_TYPE_SIZE LONG_LONG_TYPE_SIZE
330 #endif
331
332
333 /* By default, the preprocessor should be invoked the same way in C++
334    as in C.  */
335 #ifndef CPLUSPLUS_CPP_SPEC
336 #ifdef CPP_SPEC
337 #define CPLUSPLUS_CPP_SPEC CPP_SPEC
338 #endif
339 #endif
340
341 #ifndef ACCUMULATE_OUTGOING_ARGS
342 #define ACCUMULATE_OUTGOING_ARGS 0
343 #endif
344
345 /* Supply a default definition for PUSH_ARGS.  */
346 #ifndef PUSH_ARGS
347 #ifdef PUSH_ROUNDING
348 #define PUSH_ARGS       !ACCUMULATE_OUTGOING_ARGS
349 #else
350 #define PUSH_ARGS       0
351 #endif
352 #endif
353
354 /* Select a format to encode pointers in exception handling data.  We
355    prefer those that result in fewer dynamic relocations.  Assume no
356    special support here and encode direct references.  */
357 #ifndef ASM_PREFERRED_EH_DATA_FORMAT
358 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)  DW_EH_PE_absptr
359 #endif
360
361 /* By default, the C++ compiler will use the lowest bit of the pointer
362    to function to indicate a pointer-to-member-function points to a
363    virtual member function.  However, if FUNCTION_BOUNDARY indicates
364    function addresses aren't always even, the lowest bit of the delta
365    field will be used.  */
366 #ifndef TARGET_PTRMEMFUNC_VBIT_LOCATION
367 #define TARGET_PTRMEMFUNC_VBIT_LOCATION \
368   (FUNCTION_BOUNDARY >= 2 * BITS_PER_UNIT \
369    ? ptrmemfunc_vbit_in_pfn : ptrmemfunc_vbit_in_delta)
370 #endif
371
372 /* True if it is possible to profile code that does not have a frame
373    pointer.  */
374
375 #ifndef TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
376 #define TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER true
377 #endif
378
379 #endif  /* ! GCC_DEFAULTS_H */