diff options
Diffstat (limited to 'test/libcxx/input.output/file.streams')
14 files changed, 114 insertions, 65 deletions
diff --git a/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp b/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp index 31a37229b..1c2c329c2 100644 --- a/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp +++ b/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/fopen.fail.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -11,7 +10,9 @@ #include <cstdio> -int main() { +int main(int, char**) { // fopen is not available on systems without a global filesystem namespace. std::fopen("", ""); + + return 0; } diff --git a/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp b/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp index 248ab4d67..61ef15d17 100644 --- a/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp +++ b/test/libcxx/input.output/file.streams/c.files/no.global.filesystem.namespace/rename.fail.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -11,7 +10,9 @@ #include <cstdio> -int main() { +int main(int, char**) { // rename is not available on systems without a global filesystem namespace. std::rename("", ""); + + return 0; } diff --git a/test/libcxx/input.output/file.streams/c.files/version_ccstdio.pass.cpp b/test/libcxx/input.output/file.streams/c.files/version_ccstdio.pass.cpp index 0d7fc5605..d8ff6a7ac 100644 --- a/test/libcxx/input.output/file.streams/c.files/version_ccstdio.pass.cpp +++ b/test/libcxx/input.output/file.streams/c.files/version_ccstdio.pass.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -15,6 +14,8 @@ #error _LIBCPP_VERSION not defined #endif -int main() +int main(int, char**) { + + return 0; } diff --git a/test/libcxx/input.output/file.streams/c.files/version_cinttypes.pass.cpp b/test/libcxx/input.output/file.streams/c.files/version_cinttypes.pass.cpp index bfd379e43..23cecf9cb 100644 --- a/test/libcxx/input.output/file.streams/c.files/version_cinttypes.pass.cpp +++ b/test/libcxx/input.output/file.streams/c.files/version_cinttypes.pass.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -15,6 +14,8 @@ #error _LIBCPP_VERSION not defined #endif -int main() +int main(int, char**) { + + return 0; } diff --git a/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp b/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp index 84045cf3c..91b678d1d 100644 --- a/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp +++ b/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.fail.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -16,9 +15,11 @@ #include <fstream> -int main() +int main(int, char**) { std::basic_filebuf<char, std::char_traits<wchar_t> > f; // expected-error-re@streambuf:* {{static_assert failed{{.*}} "traits_type::char_type must be the same type as CharT"}} + + return 0; } diff --git a/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp b/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp new file mode 100644 index 000000000..6af876981 --- /dev/null +++ b/test/libcxx/input.output/file.streams/fstreams/fstream.close.pass.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// <fstream> + +// template <class charT, class traits = char_traits<charT> > +// class basic_fstream + +// close(); + +// Inspired by PR#38052 - std::fstream still good after closing and updating content + +#include <fstream> +#include <cassert> +#include "platform_support.h" + +int main(int, char**) +{ + std::string temp = get_temp_file_name(); + + std::fstream ofs(temp, std::ios::out | std::ios::trunc); + ofs << "Hello, World!\n"; + assert( ofs.good()); + ofs.close(); + assert( ofs.good()); + ofs << "Hello, World!\n"; + assert(!ofs.good()); + + std::remove(temp.c_str()); + + return 0; +} diff --git a/test/libcxx/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp b/test/libcxx/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp index 9808d1c09..19442da51 100644 --- a/test/libcxx/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp +++ b/test/libcxx/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -18,7 +17,7 @@ #include <cassert> #include "platform_support.h" -int main() +int main(int, char**) { #ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR std::wstring temp = get_wide_temp_file_name(); @@ -43,4 +42,6 @@ int main() } _wremove(temp.c_str()); #endif + + return 0; } diff --git a/test/libcxx/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp b/test/libcxx/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp index 131b58763..0dead68c9 100644 --- a/test/libcxx/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp +++ b/test/libcxx/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -18,7 +17,7 @@ #include <cassert> #include "platform_support.h" -int main() +int main(int, char**) { #ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR std::wstring temp = get_wide_temp_file_name(); @@ -49,4 +48,6 @@ int main() } _wremove(temp.c_str()); #endif + + return 0; } diff --git a/test/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp b/test/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp index 84a2bf992..178c7d69a 100644 --- a/test/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp +++ b/test/libcxx/input.output/file.streams/fstreams/ifstream.cons/wchar_pointer.pass.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -17,7 +16,7 @@ #include <fstream> #include <cassert> -int main() +int main(int, char**) { #ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR { @@ -39,4 +38,6 @@ int main() // test/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp // which creates writable files. #endif + + return 0; } diff --git a/test/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp b/test/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp index 81351b557..2e8b3620e 100644 --- a/test/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp +++ b/test/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -17,7 +16,7 @@ #include <fstream> #include <cassert> -int main() +int main(int, char**) { #ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR { @@ -45,4 +44,6 @@ int main() assert(c == L'r'); } #endif + + return 0; } diff --git a/test/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp b/test/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp index 6741e75ce..7d6304cc9 100644 --- a/test/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp +++ b/test/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -18,7 +17,7 @@ #include <cassert> #include "platform_support.h" -int main() +int main(int, char**) { #ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR std::wstring temp = get_wide_temp_file_name(); @@ -57,4 +56,6 @@ int main() } _wremove(temp.c_str()); #endif + + return 0; } diff --git a/test/libcxx/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp b/test/libcxx/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp index 8c2e62308..58f08b865 100644 --- a/test/libcxx/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp +++ b/test/libcxx/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -18,7 +17,7 @@ #include <cassert> #include "platform_support.h" -int main() +int main(int, char**) { #ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR std::wstring temp = get_wide_temp_file_name(); @@ -57,4 +56,6 @@ int main() } _wremove(temp.c_str()); #endif + + return 0; } diff --git a/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp b/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp index c843b7e98..432cfccac 100644 --- a/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp +++ b/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.fail.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -16,7 +15,7 @@ #include <fstream> -int main() +int main(int, char**) { std::basic_fstream<char, std::char_traits<wchar_t> > f; // expected-error-re@ios:* {{static_assert failed{{.*}} "traits_type::char_type must be the same type as CharT"}} @@ -26,5 +25,7 @@ int main() // exception specifications for types which are already invalid for one reason or another. // For now we tolerate this diagnostic. // expected-error@ostream:* 0-1 {{exception specification of overriding function is more lax than base version}} + + return 0; } diff --git a/test/libcxx/input.output/file.streams/fstreams/version.pass.cpp b/test/libcxx/input.output/file.streams/fstreams/version.pass.cpp index 44b851416..515324088 100644 --- a/test/libcxx/input.output/file.streams/fstreams/version.pass.cpp +++ b/test/libcxx/input.output/file.streams/fstreams/version.pass.cpp @@ -1,9 +1,8 @@ //===----------------------------------------------------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -15,6 +14,8 @@ #error _LIBCPP_VERSION not defined #endif -int main() +int main(int, char**) { + + return 0; } |