This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: __cygwin__ ++ (RE: getuid() and root)


> From: Christopher Faylor

> On Wed, Sep 24, 2003 at 09:21:38PM +0200, Hannu E K Nevalainen
> (garbage mail) wrote:

> >I've been thinking that there is a need for a __NOCYGWIN__
> define too (to
> >be set when -mno-cygwin is used).
> >Any thoughts about this? Good(tm) or Bad(tm)?
>
> Bad.
>
> Rather than cast around in the dark here,

Yes I'm in the dark, thank you I *DO* know that.
 _THAT IS WHY I'M HERE_ - I've said things inline with that before. You WILL
most likely read words in style with that - from me - many times over still.

>you should be investigating gcc
> options that tell you what is available.

 I've done that, as you can see below. BUT, as I do "cast around in the
dark" I haven't got ALL the answers; i.e:

>  I just did this and came up
> with this incantation:
>
> 	gcc -dM -E -xc /dev/null
>
> There's probably an easier way to do this (and if there is, there will
> be five responses to this message pointing it out) but try the above
> command.  Then try:
>
> 	gcc -mno-cygwin -dM -E -xc /dev/null
>
> and compare/contrast the results.

+#define __MINGW32__ 1

 Thanks, that's a good one. I bet I'll be using that one shortly.


 NOW - to remove the "darkness";
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This has to be *documented* too. That obviously hasn't happened yet.

/Hannu E K Nevalainen, B.Sc. EE - 59?16.37'N, 17?12.60'E
-- UTC+01, DST -> UTC+02  --



I looked before I wrote the thing above. I've looked AGAIN, NOW, this time
knowing WHAT to look for.
 "__CYGWIN__" is mentioned as "preprocessor symbol" - but "__MINGW32__"
isn't.

IMNSHO; Undocumented features could just as well be unimplemented.

Once again it has been prooved that _documentation_ may be the hardest part
of all. Sad but try: It is many times _forgotten_ altogether.

 Now Chris, YOU were complaining about me writing messages that generate
"five more" replies...
Imagine how many unwanted messages that undocumented feature will give you?

 THIS and the PREVIOUS one was just two. They could have been surpassed by
including __MINGW32__ in at least one of the docs.


$ pwd
/usr/share/doc/cygwin-doc-1.3

$ find -type f | xargs grep __CYGWIN__
./cygwin-ug-net-nochunks.html:#ifdef __CYGWIN__
./cygwin-ug-net-nochunks.html:#ifdef __CYGWIN__
./html/cygwin-ug-net/ntsec.html:#ifdef __CYGWIN__
./html/cygwin-ug-net/ntsec.html:#ifdef __CYGWIN__
./html/faq_4.html:We use _WIN32 to signify access to the Win32 API and
__CYGWIN__ for
./html/readme.html:__CYGWIN32__ to __CYGWIN__.  We will remove the old names
in a future
./txt/faq.txt:   We use _WIN32 to signify access to the Win32 API and
__CYGWIN__ for
./txt/readme.txt:__CYGWIN32__ to __CYGWIN__.  We will remove the old names
in a future

$ find -type f | xargs grep __MINGW32__

$ gcc -dumpspecs | grep MINGW32
%(cpp_cpu) %{posix:-D_POSIX_SOURCE}   %{mno-win32:%{mno-cygwin: %emno-cygwin
and mno-win32 are not compatible}}   %{mno-cygwin:-D__MSVCRT__ -D__MINGW32__
%{!ansi:%{mthreads:-D_MT}}}  %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__
%{!ansi:-Dunix} -D__unix__ -D__unix }
 %{mwin32|mno-cygwin:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__
%{!ansi:-DWINNT}}  %{!nostdinc:%{!mno-win32|mno-cygwin:-idirafter
../include/w32api%s -idirafter ../../include/w32api%s}}

--

$ gcc -dM -E -xc /dev/null >gcc_cygwin
$ gcc -mno-cygwin -dM -E -xc /dev/null >gcc_nocygwin
$ diff -up gcc_cygwin gcc_nocygwin
--- gcc_cygwin        2003-09-24 23:28:38.000000000 +0200
+++ gcc_nocygwin      2003-09-24 23:29:06.000000000 +0200
@@ -1,12 +1,11 @@
 #define __DBL_MIN_EXP__ (-1021)
 #define __FLT_MIN__ 1.17549435e-38F
+#define _WIN32 1
 #define _X86_ 1
 #define __CHAR_BIT__ 8
 #define __WCHAR_MAX__ 65535U
 #define __DBL_DENORM_MIN__ 4.9406564584124654e-324
 #define __FLT_EVAL_METHOD__ 2
-#define __unix__ 1
-#define unix 1
 #define __i386__ 1
 #define __SIZE_TYPE__ unsigned int
 #define __DBL_MIN_10_EXP__ (-307)
@@ -17,23 +16,25 @@
 #define _stdcall __attribute__((__stdcall__))
 #define __SHRT_MAX__ 32767
 #define __LDBL_MAX__ 1.18973149535723176502e+4932L
-#define __CYGWIN__ 1
-#define __unix 1
+#define __MSVCRT__ 1
 #define __LDBL_MAX_EXP__ 16384
 #define __LONG_MAX__ 2147483647L
 #define __SCHAR_MAX__ 127
 #define __DBL_DIG__ 15
 #define __USER_LABEL_PREFIX__ _
 #define __STDC_HOSTED__ 1
+#define __WIN32 1
 #define __stdcall __attribute__((__stdcall__))
 #define __LDBL_MANT_DIG__ 64
 #define __FLT_EPSILON__ 1.19209290e-7F
 #define __tune_i686__ 1
 #define __LDBL_MIN__ 3.36210314311209350626e-4932L
 #define __WCHAR_TYPE__ short unsigned int
+#define __MINGW32__ 1
 #define __FLT_DIG__ 6
 #define __FLT_MAX_10_EXP__ 38
 #define __INT_MAX__ 2147483647
+#define WIN32 1
 #define __FLT_MAX_EXP__ 128
 #define __DECIMAL_DIG__ 21
 #define __DBL_MANT_DIG__ 53
@@ -47,9 +48,10 @@
 #define __tune_pentiumpro__ 1
 #define __fastcall __attribute__((__fastcall__))
 #define _fastcall __attribute__((__fastcall__))
-#define __CYGWIN32__ 1
 #define __USING_SJLJ_EXCEPTIONS__ 1
 #define __DBL_MAX_EXP__ 1024
+#define __WIN32__ 1
+#define WINNT 1
 #define __FLT_DENORM_MIN__ 1.40129846e-45F
 #define __LONG_LONG_MAX__ 9223372036854775807LL
 #define __FLT_MAX__ 3.40282347e+38F

--END OF MESSAGE--


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]