libstdc++: Remove special-case include path for pb_ds testsuite support files
Checks
Commit Message
For unknown reasons three of the testsuite support files for pb_ds tests
use #include <util/foo/bar.hpp> whereas other testsuite support files do
not use the 'util/' prefix to find e.g. <testsuite_hooks.h>.
Both forms work, because the testsuite_flags script always adds
-I$srcdir/testsuite/util to the compilation flags, and proc
v3-build-support adds incdir=$srcdir/testsuite when compiling the
support files. But there's no reason to be inconsistent here and require
the extra incdir option just for those three files.
This change makes those three files just use #include "bar.hpp" so that
the header is found in the same dir as the source file including it.
That means we can drop the incdir option in v3-build-support.
libstdc++-v3/ChangeLog:
* testsuite/lib/libstdc++.exp (v3-build_support): Remove incdir
option to v3_target_compile commands for testsuite support
objects.
* testsuite/util/io/prog_bar.cc: Use "" form for header include.
* testsuite/util/io/verified_cmd_line_input.cc: Likewise.
* testsuite/util/performance/time/elapsed_timer.cc: Likewise.
---
This isn't important, just a minor simplification.
Tested x86_64-linux
libstdc++-v3/testsuite/lib/libstdc++.exp | 4 ++--
libstdc++-v3/testsuite/util/io/prog_bar.cc | 2 +-
libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc | 2 +-
libstdc++-v3/testsuite/util/performance/time/elapsed_timer.cc | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
Comments
On Wed, Sep 30, 2026 at 7:24 PM Jonathan Wakely <jwakely@redhat.com> wrote:
> For unknown reasons three of the testsuite support files for pb_ds tests
> use #include <util/foo/bar.hpp> whereas other testsuite support files do
> not use the 'util/' prefix to find e.g. <testsuite_hooks.h>.
>
> Both forms work, because the testsuite_flags script always adds
> -I$srcdir/testsuite/util to the compilation flags, and proc
> v3-build-support adds incdir=$srcdir/testsuite when compiling the
> support files. But there's no reason to be inconsistent here and require
> the extra incdir option just for those three files.
>
> This change makes those three files just use #include "bar.hpp" so that
> the header is found in the same dir as the source file including it.
> That means we can drop the incdir option in v3-build-support.
>
> libstdc++-v3/ChangeLog:
>
> * testsuite/lib/libstdc++.exp (v3-build_support): Remove incdir
> option to v3_target_compile commands for testsuite support
> objects.
> * testsuite/util/io/prog_bar.cc: Use "" form for header include.
> * testsuite/util/io/verified_cmd_line_input.cc: Likewise.
> * testsuite/util/performance/time/elapsed_timer.cc: Likewise.
> ---
>
> This isn't important, just a minor simplification.
>
LGTM.
>
> Tested x86_64-linux
>
> libstdc++-v3/testsuite/lib/libstdc++.exp | 4 ++--
> libstdc++-v3/testsuite/util/io/prog_bar.cc | 2 +-
> libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc | 2 +-
> libstdc++-v3/testsuite/util/performance/time/elapsed_timer.cc | 2 +-
> 4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp
> b/libstdc++-v3/testsuite/lib/libstdc++.exp
> index b2b1934a5240..3e8240d73a53 100644
> --- a/libstdc++-v3/testsuite/lib/libstdc++.exp
> +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
> @@ -845,7 +845,7 @@ proc v3-build_support { } {
> # do not prevent compilation.
> # Disable LTO so that ar/ranlib don't need the LTO plugin.
> if { [v3_target_compile $srcdir/util/$f $object_file "object" \
> - [list "incdir=$srcdir" "additional_flags=-w -fno-lto
> -fno-freestanding"]]
> + [list "additional_flags=-w -fno-lto -fno-freestanding"]]
> != "" } {
> error "could not compile $f"
> }
> @@ -884,7 +884,7 @@ proc v3-build_support { } {
> # Compile with "-w" so that warnings issued by the compiler
> # do not prevent compilation.
> if { [v3_target_compile $srcdir/util/$f $object_file
> "sharedlib" \
> - [list "incdir=$srcdir" "additional_flags=-fno-inline -w
> -shared -fPIC -DPIC -std=gnu++98 -fno-freestanding"]]
> + [list "additional_flags=-fno-inline -w -shared -fPIC -DPIC
> -std=gnu++98 -fno-freestanding"]]
> != "" } {
> error "could not compile $f"
> }
> diff --git a/libstdc++-v3/testsuite/util/io/prog_bar.cc
> b/libstdc++-v3/testsuite/util/io/prog_bar.cc
> index 86f20b3bed54..a2d431cc86dd 100644
> --- a/libstdc++-v3/testsuite/util/io/prog_bar.cc
> +++ b/libstdc++-v3/testsuite/util/io/prog_bar.cc
> @@ -34,7 +34,7 @@
> * Contains a progress bar - idea taken from boost::timer by Beman Dawes.
> */
>
> -#include <util/io/prog_bar.hpp>
> +#include "prog_bar.hpp"
>
> namespace __gnu_pbds
> {
> diff --git a/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc
> b/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc
> index a1d5fc7282e1..efbe622eeb54 100644
> --- a/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc
> +++ b/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc
> @@ -34,7 +34,7 @@
> * Contains definitions for tests - verified command line input.
> */
>
> -#include <util/io/verified_cmd_line_input.hpp>
> +#include "verified_cmd_line_input.hpp"
> #include <limits.h>
> #include <utility>
> #include <stdlib.h>
> diff --git a/libstdc++-v3/testsuite/util/performance/time/elapsed_timer.cc
> b/libstdc++-v3/testsuite/util/performance/time/elapsed_timer.cc
> index db48362a59e0..ae189df59656 100644
> --- a/libstdc++-v3/testsuite/util/performance/time/elapsed_timer.cc
> +++ b/libstdc++-v3/testsuite/util/performance/time/elapsed_timer.cc
> @@ -34,7 +34,7 @@
> * Contains utilities for tests.
> */
>
> -#include <util/performance/time/elapsed_timer.hpp>
> +#include "elapsed_timer.hpp"
>
> namespace __gnu_pbds
> {
> --
> 2.55.0
>
>
@@ -845,7 +845,7 @@ proc v3-build_support { } {
# do not prevent compilation.
# Disable LTO so that ar/ranlib don't need the LTO plugin.
if { [v3_target_compile $srcdir/util/$f $object_file "object" \
- [list "incdir=$srcdir" "additional_flags=-w -fno-lto -fno-freestanding"]]
+ [list "additional_flags=-w -fno-lto -fno-freestanding"]]
!= "" } {
error "could not compile $f"
}
@@ -884,7 +884,7 @@ proc v3-build_support { } {
# Compile with "-w" so that warnings issued by the compiler
# do not prevent compilation.
if { [v3_target_compile $srcdir/util/$f $object_file "sharedlib" \
- [list "incdir=$srcdir" "additional_flags=-fno-inline -w -shared -fPIC -DPIC -std=gnu++98 -fno-freestanding"]]
+ [list "additional_flags=-fno-inline -w -shared -fPIC -DPIC -std=gnu++98 -fno-freestanding"]]
!= "" } {
error "could not compile $f"
}
@@ -34,7 +34,7 @@
* Contains a progress bar - idea taken from boost::timer by Beman Dawes.
*/
-#include <util/io/prog_bar.hpp>
+#include "prog_bar.hpp"
namespace __gnu_pbds
{
@@ -34,7 +34,7 @@
* Contains definitions for tests - verified command line input.
*/
-#include <util/io/verified_cmd_line_input.hpp>
+#include "verified_cmd_line_input.hpp"
#include <limits.h>
#include <utility>
#include <stdlib.h>
@@ -34,7 +34,7 @@
* Contains utilities for tests.
*/
-#include <util/performance/time/elapsed_timer.hpp>
+#include "elapsed_timer.hpp"
namespace __gnu_pbds
{