| Summary: | Fix C Parser Constant Expression (Number) and JCPP constant-definition (macro) detection | ||
|---|---|---|---|
| Product: | [JogAmp] Gluegen | Reporter: | Sven Gothel <sgothel> |
| Component: | core | Assignee: | Sven Gothel <sgothel> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | mfery |
| Priority: | P4 | ||
| Version: | 2.5.0 | ||
| Hardware: | All | ||
| OS: | all | ||
| Type: | DEFECT | SCM Refs: |
gluegen b5ec911572aa0c07228fcb02976a8e848cc90391
gluegen f8752c59945205b717c4b21ceeb4044ae9a0e9df
gluegen 5b6e6af3932ece0c656cf4438100f4e213ea91b6
gluegen c30f0db4b785f21288f9cc5f7fd65393781d93c3
gluegen a7e62d106b1ba89d0973e5ccb00982e8ae8df9e4
jogl 1442d8dc875af3e945e656509105c89e394647c3
|
| Workaround: | --- | ||
|
Description
Sven Gothel
2023-08-09 15:23:43 CEST
Following code exposed a bug within our GnuCParser.g syntax, i.e. 'Number' rule.
+++
typedef enum SomeEnum {
ConstEnumValue00 = 16,
ConstEnumValue01 = (1 << ConstEnumValue00) - 1,
ConstEnumValue02 = (10-1),
ConstEnumValue03 = (10 - 2),
ConstEnumValue04 = ( 10 - 3 ),
ConstEnumValue05 = 10-4,
ConstEnumValue06 = 10 - 11,
ConstEnumValue07 = -2,
ConstEnumValue08 = - 2,
ConstEnumValueXX = 0
} SomeEnum;
+++
In GlueGen commit 10032c0115f2794a254cffc2a1cd5e48ca8ff0b8 in branch JOGL_2_SANDBOX
Ken hacked in consuming a '-' prefix to have negative numbers covered by 'Number'.
This is wrong, as it breaks deduction of `additiveExpr` and 'unaryExpr' rules,
which want to consume '-' and '+'.
The latter is used to completely resolve constant expressions
starting from the 'constExpr' rule.
See ISO 9899:202x Programming Language - C
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2596.pdf
This is reverted with commit f8752c59945205b717c4b21ceeb4044ae9a0e9df
+++
Note: Today we retrieve the 'define' constant expressions from JCPP.
Widen ConstantDefinition.isConstantExpression() to include 'patternCPPOperand', i.e. all supported operands used for constant-expression of define macros. Commit 5b6e6af3932ece0c656cf4438100f4e213ea91b6 Bug 1450: Be more verbose w/ JavaEmitter comment lines for enums and defines, include native expression Commit c30f0db4b785f21288f9cc5f7fd65393781d93c3 Bug 1450: Add test snippets covering the issues: test2.h for Bindingtest2, TestJCPP and new TestCParser Commit Bug 1450: Remove nativewindow's drm-gbm GlueGen config's manual constant definitions, now properly passed from GlueGen JOGL commit 1442d8dc875af3e945e656509105c89e394647c3 Further manual validation.. I ran JOGL's make/scripts/cmpOld2New.sh of the current master tip against build v2.5.0-rc-20230523. No changes in regards to constant definition, hence all OK! |