[PATCH] D35652: [clang] Fix handling of "%zd" format specifier in scanf

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 20 07:43:20 PDT 2017


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM with a small testing nit.



================
Comment at: test/Sema/format-strings-scanf.c:1
-// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral %s
+// RUN: %clang_cc1 -std=c11 -fsyntax-only -verify -Wformat-nonliteral %s
 
----------------
alexshap wrote:
> c11 is necessary for _Generic below.
> I have not found a more reliable way to define ssize_t
> which doesn't require a large number of #ifdef ...
Ugh, that is pretty nasty, but I cannot think of a better way to define it in a generic manner.


================
Comment at: test/Sema/format-strings-scanf.c:198
+  scanf("%zn", &d3); // expected-warning-re{{format specifies type 'ssize_t *' (aka '{{.+}}') but the argument has type 'double *'}}
+}
+
----------------
Can you add a passing test for `%zn`?


Repository:
  rL LLVM

https://reviews.llvm.org/D35652





More information about the cfe-commits mailing list