Merge from vendor branch AWK:
[dragonfly.git] / contrib / gcc / defaults.h
1 /* Definitions of various defaults for how to do assembler output
2    (most of which are designed to be appropriate for GAS or for
3    some BSD assembler).
4    Copyright (C) 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
5    Contributed by Ron Guilmette (rfg@monkeys.com)
6
7 This file is part of GNU CC.
8
9 GNU CC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 GNU CC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GNU CC; see the file COPYING.  If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA.  */
23
24 /* Store in OUTPUT a string (made with alloca) containing
25    an assembler-name for a local static variable or function named NAME.
26    LABELNO is an integer which is different for each call.  */
27
28 #ifndef ASM_FORMAT_PRIVATE_NAME
29 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)                  \
30   do {                                                                  \
31     int len = strlen (NAME);                                            \
32     char *temp = (char *) alloca (len + 3);                             \
33     temp[0] = 'L';                                                      \
34     strcpy (&temp[1], (NAME));                                          \
35     temp[len + 1] = '.';                                                \
36     temp[len + 2] = 0;                                                  \
37     (OUTPUT) = (char *) alloca (strlen (NAME) + 11);                    \
38     ASM_GENERATE_INTERNAL_LABEL (OUTPUT, temp, LABELNO);                \
39   } while (0)
40 #endif
41
42 #ifndef ASM_STABD_OP
43 #define ASM_STABD_OP ".stabd"
44 #endif
45
46 /* This is how to output an element of a case-vector that is absolute.
47    Some targets don't use this, but we have to define it anyway.  */
48
49 #ifndef ASM_OUTPUT_ADDR_VEC_ELT
50 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
51 do { fprintf (FILE, "\t%s\t", ASM_LONG);                                \
52      ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", (VALUE));                    \
53      fputc ('\n', FILE);                                                \
54    } while (0)
55 #endif
56
57 /* choose a reasonable default for ASM_OUTPUT_ASCII.  */
58
59 #ifndef ASM_OUTPUT_ASCII
60 #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
61   do {                                                                        \
62     FILE *_hide_asm_out_file = (MYFILE);                                      \
63     unsigned char *_hide_p = (unsigned char *) (MYSTRING);                    \
64     int _hide_thissize = (MYLENGTH);                                          \
65     {                                                                         \
66       FILE *asm_out_file = _hide_asm_out_file;                                \
67       unsigned char *p = _hide_p;                                             \
68       int thissize = _hide_thissize;                                          \
69       int i;                                                                  \
70       fprintf (asm_out_file, "\t.ascii \"");                                  \
71                                                                               \
72       for (i = 0; i < thissize; i++)                                          \
73         {                                                                     \
74           register int c = p[i];                                              \
75           if (c == '\"' || c == '\\')                                         \
76             putc ('\\', asm_out_file);                                        \
77           if (c >= ' ' && c < 0177)                                           \
78             putc (c, asm_out_file);                                           \
79           else                                                                \
80             {                                                                 \
81               fprintf (asm_out_file, "\\%o", c);                              \
82               /* After an octal-escape, if a digit follows,                   \
83                  terminate one string constant and start another.             \
84                  The Vax assembler fails to stop reading the escape           \
85                  after three digits, so this is the only way we               \
86                  can get it to parse the data properly.  */                   \
87               if (i < thissize - 1                                            \
88                   && p[i + 1] >= '0' && p[i + 1] <= '9')                      \
89                 fprintf (asm_out_file, "\"\n\t.ascii \"");                    \
90           }                                                                   \
91         }                                                                     \
92       fprintf (asm_out_file, "\"\n");                                         \
93     }                                                                         \
94   }                                                                           \
95   while (0)
96 #endif
97
98 #ifndef ASM_IDENTIFY_GCC
99   /* Default the definition, only if ASM_IDENTIFY_GCC is not set,
100      because if it is set, we might not want ASM_IDENTIFY_LANGUAGE
101      outputting labels, if we do want it to, then it must be defined
102      in the tm.h file.  */
103 #ifndef ASM_IDENTIFY_LANGUAGE
104 #define ASM_IDENTIFY_LANGUAGE(FILE) output_lang_identify (FILE);
105 #endif
106 #endif
107
108 /* This is how we tell the assembler to equate two values.  */
109 #ifdef SET_ASM_OP
110 #ifndef ASM_OUTPUT_DEF
111 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
112  do {   fprintf ((FILE), "\t%s\t", SET_ASM_OP);                         \
113         assemble_name (FILE, LABEL1);                                   \
114         fprintf (FILE, ",");                                            \
115         assemble_name (FILE, LABEL2);                                   \
116         fprintf (FILE, "\n");                                           \
117   } while (0)
118 #endif
119 #endif
120
121 /* This is how to output a reference to a user-level label named NAME.  */
122
123 #ifndef ASM_OUTPUT_LABELREF
124 #define ASM_OUTPUT_LABELREF(FILE,NAME)  asm_fprintf ((FILE), "%U%s", (NAME))
125 #endif
126
127 /* This determines whether or not we support weak symbols.  */
128 #ifndef SUPPORTS_WEAK
129 #ifdef ASM_WEAKEN_LABEL
130 #define SUPPORTS_WEAK 1
131 #else
132 #define SUPPORTS_WEAK 0
133 #endif
134 #endif
135
136 /* If the target supports weak symbols, define TARGET_ATTRIBUTE_WEAK to
137    provide a weak attribute.  Else define it to nothing. 
138
139    This would normally belong in gansidecl.h, but SUPPORTS_WEAK is
140    not available at that time.
141
142    Note, this is only for use by target files which we know are to be
143    compiled by GCC.  */
144 #ifndef TARGET_ATTRIBUTE_WEAK
145 # if SUPPORTS_WEAK
146 #  define TARGET_ATTRIBUTE_WEAK __attribute__ ((weak))
147 # else
148 #  define TARGET_ATTRIBUTE_WEAK
149 # endif
150 #endif
151
152 /* If we have a definition of INCOMING_RETURN_ADDR_RTX, assume that
153    the rest of the DWARF 2 frame unwind support is also provided.  */
154 #if !defined (DWARF2_UNWIND_INFO) && defined (INCOMING_RETURN_ADDR_RTX)
155 #define DWARF2_UNWIND_INFO 1
156 #endif