[cfe-commits] r142481 - in /cfe/trunk/test/Sema: format-strings-fixit-ssize_t.c format-strings-fixit.c

Hans Wennborg hans at hanshq.net
Wed Oct 19 00:55:50 PDT 2011


Author: hans
Date: Wed Oct 19 02:55:50 2011
New Revision: 142481

URL: http://llvm.org/viewvc/llvm-project?rev=142481&view=rev
Log:
Break out ssize_t test from Sema/format-strings-fixit.c

Move to a separate test that sets a specific target triple
so that the type of ssize_t is known.

Added:
    cfe/trunk/test/Sema/format-strings-fixit-ssize_t.c
Modified:
    cfe/trunk/test/Sema/format-strings-fixit.c

Added: cfe/trunk/test/Sema/format-strings-fixit-ssize_t.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/format-strings-fixit-ssize_t.c?rev=142481&view=auto
==============================================================================
--- cfe/trunk/test/Sema/format-strings-fixit-ssize_t.c (added)
+++ cfe/trunk/test/Sema/format-strings-fixit-ssize_t.c Wed Oct 19 02:55:50 2011
@@ -0,0 +1,18 @@
+// RUN: cp %s %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -pedantic -Wall -fixit %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -pedantic -Wall -Werror %t
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -E -o - %t | FileCheck %s
+
+/* This is a test of the various code modification hints that are
+   provided as part of warning or extension diagnostics. All of the
+   warnings will be fixed by -fixit, and the resulting file should
+   compile cleanly with -Werror -pedantic. */
+
+int printf(char const *, ...);
+
+void test() {
+  typedef signed long int ssize_t;
+  printf("%f", (ssize_t) 42);
+}
+
+// CHECK: printf("%zd", (ssize_t) 42);

Modified: cfe/trunk/test/Sema/format-strings-fixit.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/format-strings-fixit.c?rev=142481&r1=142480&r2=142481&view=diff
==============================================================================
--- cfe/trunk/test/Sema/format-strings-fixit.c (original)
+++ cfe/trunk/test/Sema/format-strings-fixit.c Wed Oct 19 02:55:50 2011
@@ -48,14 +48,12 @@
   printf("%X", val);
 
   typedef __SIZE_TYPE__ size_t;
-  typedef signed long int ssize_t; // FIXME: Figure out the right typedef.
   typedef __INTMAX_TYPE__ intmax_t;
   typedef __UINTMAX_TYPE__ uintmax_t;
   typedef __PTRDIFF_TYPE__ ptrdiff_t;
 
   // size_t, etc.
   printf("%f", (size_t) 42);
-  //printf("%f", (ssize_t) 42);
   printf("%f", (intmax_t) 42);
   printf("%f", (uintmax_t) 42);
   printf("%f", (ptrdiff_t) 42);





More information about the cfe-commits mailing list