types: make nlen field volatile

Compilers might try to be smart and optimize
additional reads from a const field away,
even if the non-const union member was modified.
I do not actually know whether this is the case,
but it won't hurt to declare it volatile anyway.
This commit is contained in:
anna 2021-07-19 13:09:27 +02:00
parent d033a5df9d
commit 080c5e6195
Signed by: fef
GPG key ID: EC22E476DC2D3D84

View file

@ -43,10 +43,10 @@ typedef long double f128;
*
* @param name: field name, will be of type `usize`
*/
#define NLEN_FIELD(name) \
union { \
usize name; \
const usize __neo_nlen; \
#define NLEN_FIELD(name) \
union { \
usize name; \
volatile const usize __neo_nlen; \
}
struct _neo_nref {