[libcxx-commits] [libcxx] 45ce3f3 - [libc++] Silence new deprecation warnings for C functions in tests
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 5 07:27:17 PDT 2022
Author: Louis Dionne
Date: 2022-04-05T10:26:32-04:00
New Revision: 45ce3f325240417200a7bf89ac6f6c72b190ccbb
URL: https://github.com/llvm/llvm-project/commit/45ce3f325240417200a7bf89ac6f6c72b190ccbb
DIFF: https://github.com/llvm/llvm-project/commit/45ce3f325240417200a7bf89ac6f6c72b190ccbb.diff
LOG: [libc++] Silence new deprecation warnings for C functions in tests
Added:
Modified:
libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp
libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp
index f8bd7b9afafd5..effb633b596aa 100644
--- a/libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp
+++ b/libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp
@@ -134,14 +134,22 @@ int main(int, char**)
static_assert((std::is_same<decltype(printf("\n")), int>::value), "");
static_assert((std::is_same<decltype(scanf("\n")), int>::value), "");
static_assert((std::is_same<decltype(snprintf(cp,0,"p")), int>::value), "");
+ TEST_DIAGNOSTIC_PUSH
+ TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+ TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
static_assert((std::is_same<decltype(sprintf(cp," ")), int>::value), "");
+ TEST_DIAGNOSTIC_POP
static_assert((std::is_same<decltype(sscanf("","")), int>::value), "");
static_assert((std::is_same<decltype(vfprintf(fp,"",va)), int>::value), "");
static_assert((std::is_same<decltype(vfscanf(fp,"",va)), int>::value), "");
static_assert((std::is_same<decltype(vprintf(" ",va)), int>::value), "");
static_assert((std::is_same<decltype(vscanf("",va)), int>::value), "");
static_assert((std::is_same<decltype(vsnprintf(cp,0," ",va)), int>::value), "");
+ TEST_DIAGNOSTIC_PUSH
+ TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+ TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
static_assert((std::is_same<decltype(vsprintf(cp," ",va)), int>::value), "");
+ TEST_DIAGNOSTIC_POP
static_assert((std::is_same<decltype(vsscanf("","",va)), int>::value), "");
static_assert((std::is_same<decltype(fgetc(fp)), int>::value), "");
static_assert((std::is_same<decltype(fgets(cp,0,fp)), char*>::value), "");
diff --git a/libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp b/libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
index b0b76b5491142..d18af90fec1c3 100644
--- a/libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
+++ b/libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
@@ -102,12 +102,20 @@ int main(int, char**)
static_assert((std::is_same<decltype(std::fprintf(fp," ")), int>::value), "");
static_assert((std::is_same<decltype(std::fscanf(fp," ")), int>::value), "");
static_assert((std::is_same<decltype(std::snprintf(cp,0," ")), int>::value), "");
+ TEST_DIAGNOSTIC_PUSH
+ TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+ TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
static_assert((std::is_same<decltype(std::sprintf(cp," ")), int>::value), "");
+ TEST_DIAGNOSTIC_POP
static_assert((std::is_same<decltype(std::sscanf(""," ")), int>::value), "");
static_assert((std::is_same<decltype(std::vfprintf(fp," ",va)), int>::value), "");
static_assert((std::is_same<decltype(std::vfscanf(fp," ",va)), int>::value), "");
static_assert((std::is_same<decltype(std::vsnprintf(cp,0," ",va)), int>::value), "");
+ TEST_DIAGNOSTIC_PUSH
+ TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+ TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
static_assert((std::is_same<decltype(std::vsprintf(cp," ",va)), int>::value), "");
+ TEST_DIAGNOSTIC_POP
static_assert((std::is_same<decltype(std::vsscanf(""," ",va)), int>::value), "");
static_assert((std::is_same<decltype(std::fgetc(fp)), int>::value), "");
static_assert((std::is_same<decltype(std::fgets(cp,0,fp)), char*>::value), "");
@@ -138,16 +146,15 @@ int main(int, char**)
static_assert((std::is_same<decltype(std::rename("","")), int>::value), "");
static_assert((std::is_same<decltype(std::tmpfile()), std::FILE*>::value), "");
- // disable deprecated warnings from the C library
TEST_DIAGNOSTIC_PUSH
TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
+ TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
static_assert((std::is_same<decltype(std::tmpnam(cp)), char*>::value), "");
TEST_DIAGNOSTIC_POP
static_assert((std::is_same<decltype(std::getchar()), int>::value), "");
#if TEST_STD_VER <= 11
TEST_DIAGNOSTIC_PUSH
- // disable the warning from the C library
TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
TEST_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations")
static_assert((std::is_same<decltype(std::gets(cp)), char*>::value), "");
More information about the libcxx-commits
mailing list