[Bug libstdc++/89023] libstdc++ test failure; can't find omp.h with --disable-libgomp

2019-02-11 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89023

Jonathan Wakely  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |9.0

--- Comment #3 from Jonathan Wakely  ---
Should be fixed now.

We could also do something like the following, but I don't think it's worth
bothering with:

diff --git a/libstdc++-v3/include/bits/algorithmfwd.h
b/libstdc++-v3/include/bits/algorithmfwd.h
index 40e051aa9e3..72b37026836 100644
--- a/libstdc++-v3/include/bits/algorithmfwd.h
+++ b/libstdc++-v3/include/bits/algorithmfwd.h
@@ -847,7 +847,11 @@ _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std

 #ifdef _GLIBCXX_PARALLEL
-# include 
+# if __has_include()
+#  include 
+# else
+#  warning "_GLIBCXX_PARALLEL is defined, but libgomp is not enabled"
+# endif
 #endif

 #endif
diff --git a/libstdc++-v3/include/bits/stl_algobase.h
b/libstdc++-v3/include/bits/stl_algobase.h
index 2b69e658fe8..463d89b7123 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -1456,7 +1456,11 @@ _GLIBCXX_END_NAMESPACE_VERSION
 // of getting the base algorithms. So, make sure that parallel bits
 // come in too if requested.
 #ifdef _GLIBCXX_PARALLEL
-# include 
+# if __has_include()
+#  include 
+# else
+#  warning "_GLIBCXX_PARALLEL is defined, but libgomp is not enabled"
+# endif
 #endif

 #endif
diff --git a/libstdc++-v3/include/experimental/functional
b/libstdc++-v3/include/experimental/functional
index 90f2652c29b..bcaf9f80ca9 100644
--- a/libstdc++-v3/include/experimental/functional
+++ b/libstdc++-v3/include/experimental/functional
@@ -40,7 +40,7 @@
 #include 
 #include 
 #include 
-#ifdef _GLIBCXX_PARALLEL
+#if defined _GLIBCXX_PARALLEL && __has_include()
 # include  // For std::__parallel::search
 #endif
 #include 

[Bug libstdc++/89023] libstdc++ test failure; can't find omp.h with --disable-libgomp

2019-02-11 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89023

--- Comment #2 from Jonathan Wakely  ---
Author: redi
Date: Mon Feb 11 12:56:59 2019
New Revision: 268769

URL: https://gcc.gnu.org/viewcvs?rev=268769=gcc=rev
Log:
PR libstdc++/89023 fix test that fails when  not available

Instead of a single test that only checks whether  can be
included in Parallel Mode, add tests for each of C++11/C++14/C++17 that
check whether  is compatible with _GLIBCXX_PARALLEL.
This increases the coverage to (almost) all headers.

If  is not available then the tests will trivially pass, because
we don't care about compatibility with _GLIBCXX_PARALLEL in that case.

PR libstdc++/89023
* testsuite/17_intro/headers/c++2011/parallel_mode.cc: New test.
* testsuite/17_intro/headers/c++2014/parallel_mode.cc: New test.
* testsuite/17_intro/headers/c++2017/parallel_mode.cc: New test.
* testsuite/28_regex/headers/regex/parallel_mode.cc: Remove.

Added:
trunk/libstdc++-v3/testsuite/17_intro/headers/c++2011/parallel_mode.cc
  - copied, changed from r268767,
trunk/libstdc++-v3/testsuite/28_regex/headers/regex/parallel_mode.cc
trunk/libstdc++-v3/testsuite/17_intro/headers/c++2014/parallel_mode.cc
  - copied, changed from r268767,
trunk/libstdc++-v3/testsuite/28_regex/headers/regex/parallel_mode.cc
trunk/libstdc++-v3/testsuite/17_intro/headers/c++2017/parallel_mode.cc
  - copied, changed from r268767,
trunk/libstdc++-v3/testsuite/28_regex/headers/regex/parallel_mode.cc
Removed:
trunk/libstdc++-v3/testsuite/28_regex/headers/regex/parallel_mode.cc
Modified:
trunk/libstdc++-v3/ChangeLog

[Bug libstdc++/89023] libstdc++ test failure; can't find omp.h with --disable-libgomp

2019-01-24 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89023

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-01-24
 Ever confirmed|0   |1

--- Comment #1 from Jonathan Wakely  ---
(In reply to sandra from comment #0)
> Is there some reason this test is conditionalized differently than, say, 
> 28_regex/headers/regex/parallel_mode.cc ??  That one is properly recognized
> as unsupported on this target.

That's the same header :-)

I think it should probably be the same as
25_algorithms/headers/algorithm/algorithm_parallel_mode.cc i.e.

// { dg-require-parallel-mode "" }
// { dg-options "-D_GLIBCXX_PARALLEL -fopenmp" { target *-*-* } }

(Although that will mean it almost never gets tested, as nobody runs make
check-parallel routinely ... not that it really matters, as nobody uses
parallel mode either, and it will be deprecated soon).

> Also, the underlying failure seems related to pr35887.  Why is libstdc++
> even installing headers that depend on omp.h with --disable-libgomp?

Probably because it was easier that way. They only depend on omp.h if you
explicitly request it by defining _GLIBCXX_PARALLEL, and if you do that without
libgomp that's your fault. The test that does that needs to be fixed.