I am working on porting legacy code from a PowerPC onto an ARM. The original developer used bitfields throughout a very important piece of the code. When I cross-compile with the ARM toolchain, I get
warning: multiple accesses to volatile structure member because of packed attribute [- fstrict-volatile-bitfields]
This is apparently due to the way the bitfield is packed and offset, which appears to be incompatible with the ARM toolchain. I see that a patch for GCC was released, but it doesn't look like it actually fixed the issue (I personally have not tried the patch yet).
For example, the bitfield is defined in the header file
typedef struct
{
T8 BitFieldOffset; //current bit offset value
Tsv32 Data; //extracted bit field (may be exp_golomb- unsigned or signed)
} __pack__ TExtractBits;
Tn8* extractBitField (Tn8 *pBuf, TExtractBits *pExtractBits, T32 numFieldBits);
Then in the .cpp,
TExtractBits teb;
teb.BitFieldOffset = 0;
pBuf = extractBitField(pBuf, &teb, 1); TimeCode_DropFrame = teb.Data;
pBuf = extractBitField(pBuf, &teb, 5); TimeCode_Hours = teb.Data;
pBuf = extractBitField(pBuf, &teb, 6); TimeCode_Minutes = teb.Data;
Is their a clever way of making this code more cross-platform friendly? I would like to make as few direct changes to this code as possible.
Thanks for the help