Ghidra is a software reverse engineering (SRE) framework
emteere-Bitfields updated bitfield parsing for unamed bitfields
emteere0afe11ab8762
diff --git a/Ghidra/Features/Base/src/main/javacc/ghidra/app/util/cparser/C/C.jj b/Ghidra/Features/Base/src/main/javacc/ghidra/app/util/cparser/C/C.jjindex 021a493766..d11b7a3c90 100644--- a/Ghidra/Features/Base/src/main/javacc/ghidra/app/util/cparser/C/C.jj+++ b/Ghidra/Features/Base/src/main/javacc/ghidra/app/util/cparser/C/C.jj@@ -1809,19 +1809,14 @@ void StructDeclarator(Declaration dt, Composite comp, CompositeHandler composite(LOOKAHEAD(3)dec= Declarator(dt, comp) [ ":" bitSizeObj = ConstantExpression() {- Integer bitSize = getConstantValue(bitSizeObj,0);- if (bitSize != null) {- dec.setBitFieldSize(bitSize);- }+ Integer bitSize = getConstantValue(bitSizeObj,-1);+ dec.setBitFieldSize(bitSize);}]|":" bitSizeObj = ConstantExpression() {- Integer bitSize = getConstantValue(bitSizeObj,0);- if (bitSize != 0) {- throw new ParseException("invalid bit-field declaration: ':" + bitSize);- }- dec = new Declaration(dt);- dec.setBitFieldSize(0);+ Integer bitSize = getConstantValue(bitSizeObj,-1);+ dec = new Declaration(dt);+ dec.setBitFieldSize(bitSize);}){