[PATCH] D88833: [clang-tidy] Do not warn on pointer decays in system macros

Elvis Stansvik via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 6 13:05:00 PST 2022


estan added a comment.

Yep thanks a lot for that @carlosgalvezp, getting the system macros sorted out will get rid of many warnings we were getting in our code base (seems the qDebug / qWarning macros in the Qt version we're are using violate this check on their own).

Regarding decay in calls to functions in system headers, it's unfortunately many different functions involved, and often they are member functions of some class. VTK is an old slow-moving library and has many API functions like:

  void vtkInformation::Get(vtkInformationDoubleVectorKey* key, double* value);
  void vtkPiecewiseFunction::GetNodeValue(int index, double val[4]);
  void vtkCamera::GetPosition(double[3]);
  void vtkCamera::GetFocalPoint(double[3]);
  void vtkInteractorObserver::ComputeDisplayToWorld(double x, double y, double z, double worldPt[4]);
  ...

These were just some examples of functions we use in our code base, but VTK is full of APIs like these.

We also use the Qwt and ed25519 library, which have functions like:

  void QwtPlotCurve::setSamples(const float* xData, const float* yData, int size);
  int ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key);
  ...

I don't think it's uncommon when working with libraries that are not modern C++ to run into a lot of APIs like these, so would be nice to be able to avoid the decay warning when calling into them, without sprinking casts and wrappers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88833



More information about the cfe-commits mailing list