X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <4B46E171.4060603@users.sourceforge.net> Date: Fri, 08 Jan 2010 01:40:33 -0600 From: "Yaakov (Cygwin/X)" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: gcc4: OpenMP vs. Content-Type: multipart/mixed; boundary="------------060003000709000700020909" Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --------------060003000709000700020909 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit POSIX allows for 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 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 as well, and no, it doesn't help to #include , 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? Yaakov --------------060003000709000700020909 Content-Type: text/plain; name="openmp.cxx" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="openmp.cxx" // http://en.wikipedia.org/wiki/OpenMP#Hello_World // with an #include // if you also #include , this *really* blows up #include #include #include int main (int argc, char *argv[]) { int th_id, nthreads; #pragma omp parallel private(th_id) { th_id = omp_get_thread_num(); std::cout << "Hello World from thread" << th_id << "\n"; #pragma omp barrier if ( th_id == 0 ) { nthreads = omp_get_num_threads(); std::cout << "There are " << nthreads << " threads\n"; } } return 0; } --------------060003000709000700020909 Content-Type: text/plain; charset=us-ascii -- 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 --------------060003000709000700020909--