]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/i386/cygwin.h
c-format.c (handle_format_attribute): Fix -Wc++-compat and/or -Wcast-qual warnings.
[thirdparty/gcc.git] / gcc / config / i386 / cygwin.h
CommitLineData
3a2c1cd8 1/* Operating system specific defines to be used when targeting GCC for
db009825 2 hosting on Windows32, using a Unix style C library and tools.
2f83c7d6
NC
3 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
4 2007 Free Software Foundation, Inc.
3a2c1cd8 5
e20285ad 6This file is part of GCC.
3a2c1cd8 7
e20285ad 8GCC is free software; you can redistribute it and/or modify
3a2c1cd8 9it under the terms of the GNU General Public License as published by
2f83c7d6 10the Free Software Foundation; either version 3, or (at your option)
3a2c1cd8
MM
11any later version.
12
e20285ad 13GCC is distributed in the hope that it will be useful,
3a2c1cd8
MM
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
2f83c7d6
NC
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
3a2c1cd8 21
9c808aad 22#define TARGET_VERSION fprintf (stderr, " (x86 Cygwin)");
672a6f42 23
70e5e841 24#define EXTRA_OS_CPP_BUILTINS() /* Nothing. */
4e190cf3
CF
25
26#undef CPP_SPEC
70e5e841 27#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
9a33d505 28 %{mno-win32:%{mno-cygwin: %emno-cygwin and mno-win32 are not compatible}} \
70e5e841
CF
29 %{mno-cygwin:-D__MSVCRT__ -D__MINGW32__ %{!ansi:%{mthreads:-D_MT}}}\
30 %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix }\
0a977123 31 %{mwin32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}}\
70e5e841 32 %{!nostdinc:%{!mno-win32|mno-cygwin:-idirafter ../include/w32api%s -idirafter ../../include/w32api%s}}\
9a33d505
CF
33"
34
35#undef STARTFILE_SPEC
2baa5453 36#define STARTFILE_SPEC "\
70e5e841
CF
37 %{shared|mdll: %{mno-cygwin:dllcrt2%O%s}}\
38 %{!shared: %{!mdll: %{!mno-cygwin:crt0%O%s} %{mno-cygwin:crt2%O%s}\
9a33d505 39 %{pg:gcrt0%O%s}}}\
76f5e200 40 crtbegin.o%s"
ffb6cec0 41
9bd196f0
ZM
42#undef ENDFILE_SPEC
43#define ENDFILE_SPEC \
76f5e200
DS
44 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\
45 crtend.o%s"
9bd196f0 46
9a33d505
CF
47/* Normally, -lgcc is not needed since everything in it is in the DLL, but we
48 want to allow things to be added to it when installing new versions of
49 GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled
70e5e841 50 by calling the init function from main. */
9a33d505
CF
51
52#undef LIBGCC_SPEC
70e5e841
CF
53#define LIBGCC_SPEC \
54 "%{mno-cygwin: %{mthreads:-lmingwthrd} -lmingw32} -lgcc \
55 %{mno-cygwin:-lmoldname -lmingwex -lmsvcrt}"
956d6950 56
f5089633
RK
57/* We have to dynamic link to get to the system DLLs. All of libc, libm and
58 the Unix stuff is in cygwin.dll. The import library is called
59 'libcygwin.a'. For Windows applications, include more libraries, but
60 always include kernel32. We'd like to specific subsystem windows to
61 ld, but that doesn't work just yet. */
3a2c1cd8
MM
62
63#undef LIB_SPEC
2baa5453
CF
64#define LIB_SPEC "\
65 %{pg:-lgmon} \
03fb4780
CF
66 %{!mno-cygwin:-lcygwin} \
67 %{mno-cygwin:%{mthreads:-lmingwthrd} -lmingw32} \
68 %{mwindows:-lgdi32 -lcomdlg32} \
69 -luser32 -lkernel32 -ladvapi32 -lshell32"
3a2c1cd8 70
70e5e841 71#define LINK_SPEC "\
2baa5453 72 %{mwindows:--subsystem windows} \
03fb4780
CF
73 %{mconsole:--subsystem console} \
74 %{shared: %{mdll: %eshared and mdll are not compatible}} \
75 %{shared: --shared} %{mdll:--dll} \
76 %{static:-Bstatic} %{!static:-Bdynamic} \
77 %{shared|mdll: -e \
78 %{mno-cygwin:_DllMainCRTStartup@12} \
9a33d505 79 %{!mno-cygwin:__cygwin_dll_entry@12}}\
70e5e841
CF
80 %{!mno-cygwin:--dll-search-prefix=cyg}"
81
82/* Allocate space for all of the machine-spec-specific stuff.
83 Allocate enough space for cygwin -> mingw32 munging plus
84 possible addition of "/mingw". */
85
86#ifndef CYGWIN_MINGW_SUBDIR
87#define CYGWIN_MINGW_SUBDIR "/mingw"
9c808aad 88#endif
70e5e841
CF
89#define CYGWIN_MINGW_SUBDIR_LEN (sizeof (CYGWIN_MINGW_SUBDIR) - 1)
90
91#ifdef GPLUSPLUS_INCLUDE_DIR
92char cygwin_gplusplus_include_dir[sizeof (GPLUSPLUS_INCLUDE_DIR) + 1
93 + (CYGWIN_MINGW_SUBDIR_LEN)]
94 = GPLUSPLUS_INCLUDE_DIR;
95#undef GPLUSPLUS_INCLUDE_DIR
96#define GPLUSPLUS_INCLUDE_DIR ((const char *) cygwin_gplusplus_include_dir)
97#ifndef GEN_CVT_ARRAY
98#define GEN_CVT_ARRAY
99#endif
8c84eeed
MK
100#endif
101
70e5e841
CF
102#ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
103char cygwin_gplusplus_tool_include_dir[sizeof (GPLUSPLUS_TOOL_INCLUDE_DIR) + 1
104 + CYGWIN_MINGW_SUBDIR_LEN]
105 = GPLUSPLUS_TOOL_INCLUDE_DIR;
106#undef GPLUSPLUS_TOOL_INCLUDE_DIR
107#define GPLUSPLUS_TOOL_INCLUDE_DIR ((const char *) cygwin_gplusplus_tool_include_dir)
108#ifndef GEN_CVT_ARRAY
109#define GEN_CVT_ARRAY
110#endif
111#endif
abffe289 112
70e5e841
CF
113#ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
114char cygwin_gplusplus_backward_include_dir[sizeof (GPLUSPLUS_BACKWARD_INCLUDE_DIR) + 1
115 + CYGWIN_MINGW_SUBDIR_LEN]
116 = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
117#undef GPLUSPLUS_BACKWARD_INCLUDE_DIR
118#define GPLUSPLUS_BACKWARD_INCLUDE_DIR ((const char *) cygwin_gplusplus_backward_include_dir)
119#ifndef GEN_CVT_ARRAY
120#define GEN_CVT_ARRAY
121#endif
122#endif
03fb4780 123
70e5e841
CF
124#ifdef LOCAL_INCLUDE_DIR
125char cygwin_local_include_dir[sizeof (LOCAL_INCLUDE_DIR) + 1
126 + CYGWIN_MINGW_SUBDIR_LEN]
127 = LOCAL_INCLUDE_DIR;
f6fc3552 128#undef LOCAL_INCLUDE_DIR
70e5e841
CF
129#define LOCAL_INCLUDE_DIR ((const char *) cygwin_local_include_dir)
130#ifndef GEN_CVT_ARRAY
131#define GEN_CVT_ARRAY
132#endif
133#endif
134
135#ifdef CROSS_INCLUDE_DIR
136char cygwin_cross_include_dir[sizeof (CROSS_INCLUDE_DIR) + 1
137 + CYGWIN_MINGW_SUBDIR_LEN]
138 = CROSS_INCLUDE_DIR;
139#undef CROSS_INCLUDE_DIR
140#define CROSS_INCLUDE_DIR ((const char *) cygwin_cross_include_dir)
141#ifndef GEN_CVT_ARRAY
142#define GEN_CVT_ARRAY
143#endif
144#endif
145
146#ifdef TOOL_INCLUDE_DIR
147char cygwin_tool_include_dir[sizeof (TOOL_INCLUDE_DIR) + 1
148 + CYGWIN_MINGW_SUBDIR_LEN]
149 = TOOL_INCLUDE_DIR;
f6fc3552 150#undef TOOL_INCLUDE_DIR
70e5e841
CF
151#define TOOL_INCLUDE_DIR ((const char *) cygwin_tool_include_dir)
152
2989d30c 153#ifndef CROSS_DIRECTORY_STRUCTURE
70e5e841
CF
154#undef STANDARD_INCLUDE_DIR
155#define STANDARD_INCLUDE_DIR "/usr/include"
156char cygwin_standard_include_dir[sizeof (STANDARD_INCLUDE_DIR) + 1
157 + CYGWIN_MINGW_SUBDIR_LEN]
158 = STANDARD_INCLUDE_DIR;
f6fc3552 159#undef STANDARD_INCLUDE_DIR
70e5e841
CF
160#define STANDARD_INCLUDE_DIR ((const char *) cygwin_standard_include_dir)
161#endif
f6fc3552 162
70e5e841
CF
163#ifndef GEN_CVT_ARRAY
164#define GEN_CVT_ARRAY
165#endif
166#endif
03fb4780 167
70e5e841
CF
168#ifndef GEN_CVT_ARRAY
169extern char *cvt_to_mingw[];
170#else
171char *cvt_to_mingw[] =
172 {
173#ifdef GPLUSPLUS_INCLUDE_DIR
174 cygwin_gplusplus_include_dir,
175#endif
176
177#ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
178 cygwin_gplusplus_tool_include_dir,
179#endif
180
181#ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
182 cygwin_gplusplus_backward_include_dir,
183#endif
184
185#ifdef LOCAL_INCLUDE_DIR
186 cygwin_local_include_dir,
187#endif
188
189#ifdef CROSS_INCLUDE_DIR
190 cygwin_cross_include_dir,
191#endif
192
193#ifdef TOOL_INCLUDE_DIR
194 cygwin_tool_include_dir,
195#endif
196
197#ifdef STANDARD_INCLUDE_DIR
198 cygwin_standard_include_dir,
199#endif
200
201 NULL
202 };
203#undef GEN_CVT_ARRAY
204#endif /*GEN_CVT_ARRAY*/
205
5ead67f6 206void mingw_scan (int, const char * const *, const char **);
70e5e841
CF
207#if 1
208#define GCC_DRIVER_HOST_INITIALIZATION \
209do \
210{ \
5ead67f6 211 mingw_scan(argc, (const char * const *) argv, &spec_machine); \
70e5e841
CF
212 } \
213while (0)
214#else
215#define GCC_DRIVER_HOST_INITIALIZATION \
216do \
217{ \
218 char *cprefix = concat (tooldir_base_prefix, spec_machine, \
219 dir_separator_str, NULL); \
3dce1408 220 if (!IS_ABSOLUTE_PATH (cprefix)) \
70e5e841
CF
221 cprefix = concat (standard_exec_prefix, spec_machine, dir_separator_str, \
222 spec_version, dir_separator_str, tooldir_prefix, NULL); \
223 add_prefix (&exec_prefixes,\
224 concat (cprefix, "../../../../", spec_machine, "/bin/", NULL), \
225 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
226 add_prefix (&exec_prefixes, cprefix, \
227 "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL); \
228 add_prefix (&startfile_prefixes,\
229 concat (standard_startfile_prefix, "w32api", NULL),\
230 "GCC", PREFIX_PRIORITY_LAST, 0, NULL);\
4536bcac 231 mingw_scan(argc, (const char * const *) argv, &spec_machine); \
70e5e841
CF
232 } \
233while (0)
03fb4780 234#endif
59b1a766
DS
235
236/* Binutils does not handle weak symbols from dlls correctly. For now,
237 do not use them unnecessarily in gthr-posix.h. */
238#define GTHREAD_USE_WEAK 0
0f047685
DB
239
240/* Every program on cygwin links against cygwin1.dll which contains
241 the pthread routines. There is no need to explicitly link them
917f1b7e 242 and the -pthread flag is not recognized. */
0f047685
DB
243#undef GOMP_SELF_SPECS
244#define GOMP_SELF_SPECS ""