[libcxx] r192538 - Implement national body comment GB9: remove std::gets

Marshall Clow mclow.lists at gmail.com
Sat Oct 12 12:09:48 PDT 2013


Author: marshall
Date: Sat Oct 12 14:09:47 2013
New Revision: 192538

URL: http://llvm.org/viewvc/llvm-project?rev=192538&view=rev
Log:
Implement national body comment GB9: remove std::gets

Added:
    libcxx/trunk/test/input.output/file.streams/c.files/gets.fail.cpp
Modified:
    libcxx/trunk/include/cstdio
    libcxx/trunk/test/input.output/file.streams/c.files/cstdio.pass.cpp

Modified: libcxx/trunk/include/cstdio
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstdio?rev=192538&r1=192537&r2=192538&view=diff
==============================================================================
--- libcxx/trunk/include/cstdio (original)
+++ libcxx/trunk/include/cstdio Sat Oct 12 14:09:47 2013
@@ -74,7 +74,7 @@ int fputc(int c, FILE* stream);
 int fputs(const char* restrict s, FILE* restrict stream);
 int getc(FILE* stream);
 int getchar(void);
-char* gets(char* s);
+char* gets(char* s);  // removed in C++14
 int putc(int c, FILE* stream);
 int putchar(int c);
 int puts(const char* s);
@@ -158,7 +158,9 @@ using ::fputc;
 using ::fputs;
 using ::getc;
 using ::getchar;
+#if _LIBCPP_STD_VER <= 11
 using ::gets;
+#endif
 using ::putc;
 using ::putchar;
 using ::puts;

Modified: libcxx/trunk/test/input.output/file.streams/c.files/cstdio.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/c.files/cstdio.pass.cpp?rev=192538&r1=192537&r2=192538&view=diff
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/c.files/cstdio.pass.cpp (original)
+++ libcxx/trunk/test/input.output/file.streams/c.files/cstdio.pass.cpp Sat Oct 12 14:09:47 2013
@@ -118,7 +118,9 @@ int main()
     static_assert((std::is_same<decltype(std::fputs("",fp)), int>::value), "");
     static_assert((std::is_same<decltype(std::getc(fp)), int>::value), "");
     static_assert((std::is_same<decltype(std::getchar()), int>::value), "");
+#if _LIBCPP_STD_VER <= 11
     static_assert((std::is_same<decltype(std::gets(cp)), char*>::value), "");
+#endif
     static_assert((std::is_same<decltype(std::putc(0,fp)), int>::value), "");
     static_assert((std::is_same<decltype(std::putchar(0)), int>::value), "");
     static_assert((std::is_same<decltype(std::puts("")), int>::value), "");

Added: libcxx/trunk/test/input.output/file.streams/c.files/gets.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/input.output/file.streams/c.files/gets.fail.cpp?rev=192538&view=auto
==============================================================================
--- libcxx/trunk/test/input.output/file.streams/c.files/gets.fail.cpp (added)
+++ libcxx/trunk/test/input.output/file.streams/c.files/gets.fail.cpp Sat Oct 12 14:09:47 2013
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+// test <cstdio>
+
+// gets 
+
+#include <cstdio>
+
+int main()
+{
+#if _LIBCPP_STD_VER > 11
+    (void) std::gets((char *) NULL);
+#else
+#error
+#endif
+}





More information about the cfe-commits mailing list