[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

Mital Ashok via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 7 11:31:46 PDT 2023


MitalAshok added inline comments.


================
Comment at: clang/test/Sema/format-pointer.c:39
+  printf("%p", np);
+  scanf("%p", &np);  // expected-warning {{format specifies type 'void **' but the argument has type 'nullptr_t *'}}
+  scanf("%p", &npp);  // pedantic-warning {{format specifies type 'void **' but the argument has type 'nullptr_t **'}}
----------------
Should this be a pedantic warning?

If this reads a non-null pointer, the bit pattern of `np` will be messed up but `np` will still read as a nullptr.
If it reads a null pointer, it should be fine.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156054/new/

https://reviews.llvm.org/D156054



More information about the cfe-commits mailing list