Skip to content
Snippets Groups Projects
  • Torbjörn SVENSSON's avatar
    1e4664b9
    libstdc++: /dev/null is not accessible on Windows · 1e4664b9
    Torbjörn SVENSSON authored
    
    When running the DejaGNU testsuite on a toolchain built for native
    Windows, the path /dev/null can't be used to open a stream to void.
    On native Windows, the resource is instead named "nul".
    
    In 17_intro/tag_type_explicit_ctor.cc, the following statement would
    fail to match when the DejaGNU testsuite is running in cygwin with a
    native toolchain.
    // dg-error 53 "explicit" "" { target hosted }
    
    The "target hosted"-check is using cpp to verify if _GLIBCXX_HOSTED is
    defined and discards the output by simply redirecting it to /dev/null.
    In v3_target_compile, it's overridden to "nul" for MinGW targets, but
    the same rule applies when host is cygwin, so replace the condition
    with a check for Windows.
    
    The error in the log would look like this for the "target hosted" check:
    cc1plus.exe: fatal error: opening output file /dev/null: No such file or directory
    
    The tag_type_explicit_ctor.cc test fails with this on Windows:
    .../tag_type_explicit_ctor.cc:53: error: converting to 'std::defer_lock_t' from initializer list would use explicit constructor 'constexpr std::defer_lock_t::defer_lock_t()'
    .../tag_type_explicit_ctor.cc:54: error: converting to 'std::try_to_lock_t' from initializer list would use explicit constructor 'constexpr std::try_to_lock_t::try_to_lock_t()'
    .../tag_type_explicit_ctor.cc:55: error: converting to 'std::try_to_lock_t' from initializer list would use explicit constructor 'constexpr std::try_to_lock_t::try_to_lock_t()'
    .../tag_type_explicit_ctor.cc:67: error: converting to 'std::defer_lock_t' from initializer list would use explicit constructor 'constexpr std::defer_lock_t::defer_lock_t()'
    .../tag_type_explicit_ctor.cc:68: error: converting to 'std::try_to_lock_t' from initializer list would use explicit constructor 'constexpr std::try_to_lock_t::try_to_lock_t()'
    .../tag_type_explicit_ctor.cc:69: error: converting to 'std::adopt_lock_t' from initializer list would use explicit constructor 'constexpr std::adopt_lock_t::adopt_lock_t()'
    
    Patch has been verified on Windows and Linux.
    
    libstdc++-v3:
    
    	* testsuite/lib/libstdc++.exp: Use "nul" for Windows, "/dev/null"
    	for other environments.
    
    Signed-off-by: default avatarTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
    1e4664b9
    History
    libstdc++: /dev/null is not accessible on Windows
    Torbjörn SVENSSON authored
    
    When running the DejaGNU testsuite on a toolchain built for native
    Windows, the path /dev/null can't be used to open a stream to void.
    On native Windows, the resource is instead named "nul".
    
    In 17_intro/tag_type_explicit_ctor.cc, the following statement would
    fail to match when the DejaGNU testsuite is running in cygwin with a
    native toolchain.
    // dg-error 53 "explicit" "" { target hosted }
    
    The "target hosted"-check is using cpp to verify if _GLIBCXX_HOSTED is
    defined and discards the output by simply redirecting it to /dev/null.
    In v3_target_compile, it's overridden to "nul" for MinGW targets, but
    the same rule applies when host is cygwin, so replace the condition
    with a check for Windows.
    
    The error in the log would look like this for the "target hosted" check:
    cc1plus.exe: fatal error: opening output file /dev/null: No such file or directory
    
    The tag_type_explicit_ctor.cc test fails with this on Windows:
    .../tag_type_explicit_ctor.cc:53: error: converting to 'std::defer_lock_t' from initializer list would use explicit constructor 'constexpr std::defer_lock_t::defer_lock_t()'
    .../tag_type_explicit_ctor.cc:54: error: converting to 'std::try_to_lock_t' from initializer list would use explicit constructor 'constexpr std::try_to_lock_t::try_to_lock_t()'
    .../tag_type_explicit_ctor.cc:55: error: converting to 'std::try_to_lock_t' from initializer list would use explicit constructor 'constexpr std::try_to_lock_t::try_to_lock_t()'
    .../tag_type_explicit_ctor.cc:67: error: converting to 'std::defer_lock_t' from initializer list would use explicit constructor 'constexpr std::defer_lock_t::defer_lock_t()'
    .../tag_type_explicit_ctor.cc:68: error: converting to 'std::try_to_lock_t' from initializer list would use explicit constructor 'constexpr std::try_to_lock_t::try_to_lock_t()'
    .../tag_type_explicit_ctor.cc:69: error: converting to 'std::adopt_lock_t' from initializer list would use explicit constructor 'constexpr std::adopt_lock_t::adopt_lock_t()'
    
    Patch has been verified on Windows and Linux.
    
    libstdc++-v3:
    
    	* testsuite/lib/libstdc++.exp: Use "nul" for Windows, "/dev/null"
    	for other environments.
    
    Signed-off-by: default avatarTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>