public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Re: gcc-3.3.3 :fpclassify
       [not found] <1104440185.41d46b7970546@imap-serv.inrialpes.fr>
@ 2004-12-30 21:42 ` Gerrit P. Haase
  2004-12-30 23:01 ` Dave Korn
  1 sibling, 0 replies; 4+ messages in thread
From: Gerrit P. Haase @ 2004-12-30 21:42 UTC (permalink / raw)
  To: Talk Amongst Yourselves, cygwin

Wrong list, please use the main cygwin list for such postings.

Jianguo.Zhang@inrialpes.fr wrote:
[...]
> $ g++ test.cpp
> 
> the following errors occurs:
> 
> test.cpp: In function `int main()':
> test.cpp:17: error: `fpclassify' undeclared in namespace `std'
> test.cpp:18: error: `fpclassify' undeclared in namespace `std'
> test.cpp:19: error: `fpclassify' undeclared in namespace `std'
> 
> there is no problem to compile the file under linux system using g++ 3.3.1
> 
> Could anyone tell me why?

No, sorry.

Try gcc-3.4.1:
$ g++ -o fpclassify fpclassify.C

$ ./fpclassify
program ends


To install gcc-3.4.1 trigger the radio button in setup.exe so
you can install test/experimental packages.


Gerrit
-- 
=^..^=

--
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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: gcc-3.3.3 :fpclassify
       [not found] <1104440185.41d46b7970546@imap-serv.inrialpes.fr>
  2004-12-30 21:42 ` gcc-3.3.3 :fpclassify Gerrit P. Haase
@ 2004-12-30 23:01 ` Dave Korn
  2004-12-31  1:36   ` Gerrit P. Haase
  1 sibling, 1 reply; 4+ messages in thread
From: Dave Korn @ 2004-12-30 23:01 UTC (permalink / raw)
  To: 'sorry for the on-topic post'; +Cc: cygwin

> -----Original Message-----
> From: cygwin-talk-owner On Behalf Of Jianguo.Zhang
> Sent: 30 December 2004 20:56

> The gcc/g++ version is 3.3.3
> 
> I am trying to compile the following program using g++ 3.3.3

>          if (FP_ZERO != std::fpclassify (a)) abort ();        
>                    
>                                                               
>    if (FP_NAN != std::fpclassify (b)) abort ();               
>                    
>                                                         
>   if (FP_NORMAL != std::fpclassify (c)) abort ();             

> When I use the following command to compile this file under cygwin:
> 
> $ g++ test.cpp
> 
> the following errors occurs:
> 
> test.cpp: In function `int main()':
> test.cpp:17: error: `fpclassify' undeclared in namespace `std'
> test.cpp:18: error: `fpclassify' undeclared in namespace `std'
> test.cpp:19: error: `fpclassify' undeclared in namespace `std'
> 
> there is no problem to compile the file under linux system 
> using g++ 3.3.1
> 
> Could anyone tell me why?


  It changed in 3.3.3; in earlier versions it was indeed in namespace std.

  It is a macro, defined in /usr/include/math.h, which is included by cmath, but
then (since 3.3.3) cmath has a section that undefines it again; this is
apparently for strict c++ standard conformance.

  In gnu libstdc++, the macro is placed into namespace __gnu_cxx before it is
undefined, used to make a template function that will accept any type, and then
imported from there to std:: later.  This is under the control of two #defines,
_GLIBCPP_USE_C99 and _GLIBCPP_USE_C99_FP_MACROS_DYNAMIC.  Unfortunately, these
can't just be set at the top of your code before the #includes, as then cstdlib
goes and breaks.  These defines live in
/usr/include/c++/3.3.3/i686-pc-cygwin/bits/c++config.h, and they are created at
the time the compiler itself is being configured and built.

  The cygwin compiler, it seems, was compiled without using the --enable-c99
option at configure time, whereas the linux version you've used was.

http://gcc.gnu.org/ml/libstdc++/2001-04/msg00345.html
and follow ups, and particularly the referenced thread
http://gcc.gnu.org/ml/libstdc++/2001-04/msg00120.html
make it clear what's going on.

  There are various answers and workarounds.  One would be to recompile gcc
(perhaps just libstdc++ would be enough) for cygwin with --enable-c99.  Another
would be to copy the definitions into your own code from math.h.

  Gerrit, does the output from "gcc -v" for 3.4.1 show "--enable-c99"?  Or has
someone fixed it in the headers somehow?

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


--
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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gcc-3.3.3 :fpclassify
  2004-12-30 23:01 ` Dave Korn
@ 2004-12-31  1:36   ` Gerrit P. Haase
  2004-12-31  2:05     ` Dave Korn
  0 siblings, 1 reply; 4+ messages in thread
From: Gerrit P. Haase @ 2004-12-31  1:36 UTC (permalink / raw)
  To: cygwin

Dave Korn wrote:

>   Gerrit, does the output from "gcc -v" for 3.4.1 show "--enable-c99"?  Or has
> someone fixed it in the headers somehow?

No, I didn't used --enable-c99.  Maybe it was considered to be a bad
change and reverted.


Gerrit
-- 
=^..^=

--
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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: gcc-3.3.3 :fpclassify
  2004-12-31  1:36   ` Gerrit P. Haase
@ 2004-12-31  2:05     ` Dave Korn
  0 siblings, 0 replies; 4+ messages in thread
From: Dave Korn @ 2004-12-31  2:05 UTC (permalink / raw)
  To: cygwin

> -----Original Message-----
> From: cygwin-owner On Behalf Of Gerrit P. Haase
> Sent: 31 December 2004 01:37

> Dave Korn wrote:
> 
> >   Gerrit, does the output from "gcc -v" for 3.4.1 show 
> "--enable-c99"?  Or has
> > someone fixed it in the headers somehow?
> 
> No, I didn't used --enable-c99.  Maybe it was considered to be a bad
> change and reverted.
> 

Ah, here we go.
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc%2b%2b-v3/include/c_std/std_cma
th.h#rev1.15

 Revision 1.15 / (download) - annotate - [select for diffs] , Mon Dec 29
19:26:11 2003 UTC (12 months ago) by mmitchel
Branch: MAIN
CVS Tags: tr[...SNIP!...]0-3_4-1, HEAD
Changes since 1.14: +2 -3 lines
Diff to previous 1.14 (colored)

	* acconfig.h: Add _GLIBCXX_USE_C99_MATH.
	* acinclude.m4 (GLIBCXX_ENABLE_C99): Define GLIBCXX_USE_C99_MATH.
	* configure.ac: Define HAVE_S_ISREG and HAVE_S_IFREG when
	targeting newlib.
	* aclocal.m4: Regenerated.
	* config.h.in: Likewise.
	* configure: Likewise.
	* Makefile.in: Likewise.
	* include/Makefile.in: Likewise.
	* libmath/Makefile.in: Likewise.
	* libsupc++/Makefile.in: Likewise.
	* testsuite/Makefile.in: Likewise.
	* src/Makefile.in: Likewise.
	* po/Makefile.in: Likewise.
	* include/c_std/std_cmath.h (_GLIBCXX_USE_C99): Replace with ...
	(_GLIBCXX_USE_C99_MATH): ... this.

	* testsuite/27_io/basic_filebuf/sgetn/char/1-in.cc: XFAIL for
	arm-none-elf.
	* testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc: Likewise.
	* testsuite/27_io/basic_filebuf/sgetn/char/2-in.cc: Likewise.
	* testsuite/27_io/basic_filebuf/sgetn/char/2-io.cc: Likewise.
	* testsuite/27_io/basic_istream/readsome/char/6476-2.cc: Likewise.
	* testsuite/27_io/objects/char/9.cc: Likewise.
	* testsuite/ext/stdio_filebuf/char/10063-2.cc: Likewise.

... looks like it was made into an autoconf test, so it'll presumably be on by
default for cygwin/newlib.

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


--
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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-12-31  2:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1104440185.41d46b7970546@imap-serv.inrialpes.fr>
2004-12-30 21:42 ` gcc-3.3.3 :fpclassify Gerrit P. Haase
2004-12-30 23:01 ` Dave Korn
2004-12-31  1:36   ` Gerrit P. Haase
2004-12-31  2:05     ` Dave Korn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).