From 5b6e6af3932ece0c656cf4438100f4e213ea91b6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 10 Aug 2023 10:53:31 +0200 Subject: Bug 1450: Widen ConstantDefinition.isConstantExpression() to include 'patternCPPOperand' i.e. all supported operands used for constant-expression of define macros. --- src/java/com/jogamp/gluegen/ConstantDefinition.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/java/com/jogamp') diff --git a/src/java/com/jogamp/gluegen/ConstantDefinition.java b/src/java/com/jogamp/gluegen/ConstantDefinition.java index d579da1..f9296a7 100644 --- a/src/java/com/jogamp/gluegen/ConstantDefinition.java +++ b/src/java/com/jogamp/gluegen/ConstantDefinition.java @@ -129,6 +129,7 @@ public class ConstantDefinition extends AliasedSymbolImpl implements AliasedSema return String.valueOf(f) + ( !isDouble ? "f" : ""); } } + @Override public final String toString() { final StringBuilder sb = new StringBuilder(); sb.append("["); @@ -506,8 +507,9 @@ public class ConstantDefinition extends AliasedSymbolImpl implements AliasedSema } // Find constant expressions like (1 << 3) // if found just pass them through, they will most likely work in java too - // expressions containing identifiers are currently ignored (casts too) - final String[] values = value.split("[\\s\\(\\)]"); // [ whitespace '(' ')' ] + // expressions containing identifiers are currently ignored (casts too). + // The pattern includes 'patternCPPOperand', i.e. all supported operands used for constant-expression of define macros + final String[] values = value.split("[\\s\\+\\-\\*\\/\\|\\&\\(\\)]|(\\<\\<)|(\\>\\>)|(\\~)"); // [ whitespace '(' ')' ] int numberCount = 0; for (final String s : values) { if( s.length() > 0 ) { -- cgit v1.2.3