[PATCH] D93999: [clang] Fix message text for `-Wpointer-sign` to account for plain char

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 3 13:37:10 PST 2021


hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: aaron.ballman, rsmith.
Herald added subscribers: jfb, jvesely.
hubert.reinterpretcast requested review of this revision.
Herald added a project: clang.

The `-Wpointer-sign` warning text is inappropriate for describing the incompatible pointer conversion between plain `char` and explicitly `signed`/`unsigned` `char` (whichever plain `char` has the same range as) and vice versa.

Specifically, in part, it reads "converts between pointers to integer types with different sign". This patch changes that portion to read instead as "converts between pointers to integer types that differ by signed/unsigned/plain variation".

C17 subclause 6.5.16.1 indicates that the conversions resulting in `-Wpointer-sign` warnings in assignment-like contexts are constraint violations. This means that strict conformance requires a diagnostic for the case where the message text is wrong before this patch. The lack of an even more specialized warning group is consistent with GCC.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93999

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/test/Sema/incompatible-sign.c
  clang/test/Sema/incompatible-sign.cpp
  clang/test/Sema/vector-ops.c
  clang/test/SemaObjC/objc-cf-audited-warning.m
  clang/test/SemaOpenCL/builtins-amdgcn-error.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93999.314302.patch
Type: text/x-patch
Size: 9145 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210103/6ff43f92/attachment.bin>


More information about the cfe-commits mailing list