Skip to content

Feature: PETSC_ATTRIBUTE_NODEREF

Jacob Faibussowitsch requested to merge jacobf/2021-09-30/attribute-no-deref into main

__attribute__((noderef)) makes the compiler warn about de-referencing a pointer. The pointer is still allowed to participate in pointer arithmetic, but one cannot access it's value.

int __attribute__((noderef)) *p;
int x = *p;  // warning

int __attribute__((noderef)) **p2;
x = **p2;  // warning

int * __attribute__((noderef)) *p3;
p = *p3;  // warning

This may be useful in debugging device-related pointer snafus.

This MR also re-enables the mpi attribute checking which was locked behind some esoteric works_with_const_which_is_not_true define. I couldn't find anything about it online...

Edited by Jacob Faibussowitsch

Merge request reports