Skip to content

CI: fix C code causing false positives in lint API checker

Detailed Description

This MR will hopefully fix a few C code constructions that are causing false positives in the CI lint jobs that check for API changes:

  • In lal/lib/support/UserInputParse.h some functions are declared using a macro. The API checker is tripping over the macros and therefore thinks these functions don't exist/have been newly created. This MR removes the macro and gives the function declarations explicitly.
  • In lalinference/lib/LALInferenceHDF5.h some strings as declared as const char[]. Because the strings are constant, at some point these types are translated to fixed-length arrays (e.g. const char [<STRING-LENGTH>]) which the API checker thinks as an API change. This MR instead declares the strings as const char *const, which should be treated as an equivalent type, but without the explicit array.

API Changes

Please tick one of the following options:

  • These changes do not modify the API.
  • These changes do modify the API, and are backwards compatible.
  • These changes do modify the API, and are backwards incompatible.

For examples of changes that do not modify the API and/or are considered backwards (in)compatible, please see the contributing guide.

Justification for Changes being Backward Compatible

I tried compiling the following test code:

void A(const char x[]) {
  return;
}

void B(const char *const y) {
  return;
}

int main() {

  const char x[] = "ABC";

  const char *const y = "XYZ";

  A(x);
  A(y);

  B(x);
  B(y);

  return 0;

}

gcc -Wall does not complain about differences in type between x and y, so hopefully that means that C compilers in general treat them as equivalent. In that case these changes do not modify the API and are backward compatible.

Justification for Backwards Incompatible Changes

n/a

Review Status

n/a

Merge request reports

Loading