Mail Archives: cygwin/2002/06/08/04:16:45
I wrote:
> The -undef flag, "do not predefine any macros," fails in CPP (GCC)
> for Cygwin. This is version 2.95.3-5 of GCC.
> This flag is supposed to invoke the preprocessor without any built-in
> macros defined. Cygwin's special CPP defines several macros which
> rewrite Microsoft keywords (such as __cdecl and __declspec) to GCC form
> (using the __attribute__ syntax). The -undef flag fails to undefine any
> of these automatically defined CPP macros.
Heribert Dahms responded:
> did you have a look into the specs file
> /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs ?
This specs file seems to contain the same information as the
source file /usr/src/gcc-2.95.3-5/gcc/config/i386/cygwin.h
(is it generated from the .h file during the build process
for gcc, or is it sort of redundant?)
But since it's easier to make changes to the specs file,
I was able to determine the fix to the -undef bug in GCC.
Fix: wrap "%{!undef:" and "}" around the CPP_SPEC in /usr/src/
gcc-2.95.3-5/gcc/config/i386/cygwin.h and also (unless the
specs file is autogenerated) in /usr/lib/gcc-lib/i686-pc-cygwin/
2.95.3-5/specs.
Here is a unified diff patch for cygwin.h:
--- cygwin.h Sat Jun 08 02:56:05 2002
+++ cygwin.h.old Sun Jun 17 19:57:59 2001
@@ -91,26 +91,26 @@
predefined attributes later on. This can be solved by using one attribute,
say __declspec__, and passing args to it. The problem with that approach
is that args are not accumulated: each new appearance would clobber any
existing args. */
#undef CPP_SPEC
-#define CPP_SPEC "%{!undef:%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
+#define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \
-D__stdcall=__attribute__((__stdcall__)) \
-D__cdecl=__attribute__((__cdecl__)) \
%{!ansi:-D_stdcall=__attribute__((__stdcall__)) \
-D_cdecl=__attribute__((__cdecl__))} \
-D__declspec(x)=__attribute__((x)) \
%{mno-win32:%{mno-cygwin: %emno-cygwin and mno-win32 are not compatible}} \
%{mno-cygwin:-D__MSVCRT__ -D__MINGW32__ %{mthreads:-D_MT} "\
MINGW_INCLUDES "} \
%{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__ %{!ansi:-Dunix} -D__unix__ -D__unix"\
CYGWIN_INCLUDES "}\
%{mwin32|mno-cygwin:%{!ansi:-DWIN32 -DWINNT -D_WIN32} -D_WIN32 -D__WIN32 -D__WIN32__}\
%{!mno-win32:" W32API_INC "}\
-}"
+"
#undef CPLUSPLUS_CPP_SPEC
#define CPLUSPLUS_CPP_SPEC "\
%{!mno-cygwin:" CYGWIN_CPP_INCLUDES "}\
%{mno-cygwin:" MINGW_CPP_INCLUDES "}\
Make the same change to the *cpp entry in "specs".
But is this all? Are there other specs strings that should be changed
to fix this bug as well? I'd like to ask a GCC expert ... D.J. Delorie,
where are you?
- David Librik
librik AT panix DOT com
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -