-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
Hi,
first of all, very cool project. Some ASN.1 specifications define reserved words as part of an enum. e.g, this is from cellular network specs (RRC):
TimingMaintainedSynchInd ::= ENUMERATED { false }This generates code with asn1scc --field-prefix AUTO that looks something like this:
typedef enum {
false = 0
} TimingMaintainedSynchInd;If you try to compile this, you'll get an error like this:
file.c:11:
file.h:1312:5: error: expected identifier
1312 | false = 0
| ^
/usr/lib/llvm-17/lib/clang/17/include/stdbool.h:22:15: note: expanded from macro 'false'
22 | #define false 0
| ^
In file included from /data/asn1scc_DL-DataToUL-ACK-DCI-1-2-r17_uper.c:12:
file.h:1312:5: error: expected identifierI think this issue may expand to other named values in enums that are reserved words, but I did not test. I suggest making the field prefix CLI argument also prefix enum values to resolve the issue, but this may cause backward compatibility problems.
The full list of reserved words for C is here: https://en.cppreference.com/w/c/keyword.html
Metadata
Metadata
Assignees
Labels
No labels