delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/01/08/06:09:45

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 8 Jan 2010 12:09:21 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: gcc4: OpenMP vs. <math.h>
Message-ID: <20100108110921.GD27916@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <4B46E171 DOT 4060603 AT users DOT sourceforge DOT net>
MIME-Version: 1.0
In-Reply-To: <4B46E171.4060603@users.sourceforge.net>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Jan  8 01:40, Yaakov S wrote:
> POSIX allows for <math.h> functions to also be defined as macros.
> Currently, only log2 and log2f are so defined.
> 
> These macros pose problems with a few projects which define their
> own static/inline/template log2() (off the top of my head, I can
> think of 2: the CRAN rgl module, and OpenCV; both are C++).  Of
> course, those can be fixed with an #undef log2 after the #include's.
> 
> However, I just encountered tonight a much larger conflict:
> OpenMP/C++ and <math.h> are incompatible.  STC attached:
> 
> $ g++ -D_GLIBCXX_PARALLEL -fopenmp openmp.cxx -lgomp
> In file included from
> /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/parallel/algobase.h:46,
>                  from /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/stl_algobase.h:1137,
>                  from
> /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/bits/char_traits.h:46,
>                  from /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/ios:46,
>                  from
> /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/ostream:45,
>                  from
> /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/iostream:45,
>                  from openmp.cxx:7:
> /usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/parallel/base.h:112:
> error: expected `)' before ?/? token
> 
> It gets even worse if you #include <algorithm> as well, and no, it
> doesn't help to #include <cmath>, although moving the math include
> after all other includes does work.
> 
> I see two possible solutions:
> 
> 1) Make the log2 macros dependent on #ifndef __cplusplus;
> 2) Make the parallel/* headers #undef log2 and log2f.
> 
> Thoughts?

Sounds good to me, but that's really one for the newlib list since that
affects all platforms.  Would you mind to repost it there?


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019