<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>1450</bug_id>
          
          <creation_ts>2023-08-09 15:23:43 +0200</creation_ts>
          <short_desc>Fix C Parser Constant Expression (Number) and JCPP constant-definition (macro) detection</short_desc>
          <delta_ts>2023-08-14 17:01:14 +0200</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Gluegen</product>
          <component>core</component>
          <version>2.5.0</version>
          <rep_platform>All</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P4</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sven Gothel">sgothel</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          <cc>mfery</cc>
          
          <cf_type>DEFECT</cf_type>
          <cf_scm_refs>gluegen b5ec911572aa0c07228fcb02976a8e848cc90391
gluegen f8752c59945205b717c4b21ceeb4044ae9a0e9df
gluegen 5b6e6af3932ece0c656cf4438100f4e213ea91b6
gluegen c30f0db4b785f21288f9cc5f7fd65393781d93c3
gluegen a7e62d106b1ba89d0973e5ccb00982e8ae8df9e4
jogl 1442d8dc875af3e945e656509105c89e394647c3</cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>6841</commentid>
    <comment_count>0</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2023-08-09 15:23:43 +0200</bug_when>
    <thetext>Investigate and resolve remaining C parser issues.

One in discussion is a resulting negative line number having a &apos;-&apos; in included C header files via the &apos;#line ..&apos; artifact.

We will change the title of this bug report with more clarity.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6842</commentid>
    <comment_count>1</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2023-08-10 10:48:53 +0200</bug_when>
    <thetext>Following code exposed a bug within our GnuCParser.g syntax, i.e. &apos;Number&apos; rule.

+++
typedef enum SomeEnum {
  ConstEnumValue00 = 16,
  ConstEnumValue01 = (1 &lt;&lt; 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 &apos;-&apos; prefix to have negative numbers covered by &apos;Number&apos;.

This is wrong, as it breaks deduction of `additiveExpr` and &apos;unaryExpr&apos; rules, 
which want to consume &apos;-&apos; and &apos;+&apos;.
The latter is used to completely resolve constant expressions 
starting from the &apos;constExpr&apos; 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 &apos;define&apos; constant expressions from JCPP.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6843</commentid>
    <comment_count>2</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2023-08-10 10:53:40 +0200</bug_when>
    <thetext>Widen ConstantDefinition.isConstantExpression() to include &apos;patternCPPOperand&apos;,
i.e. all supported operands used for constant-expression of define macros.

Commit 5b6e6af3932ece0c656cf4438100f4e213ea91b6</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6844</commentid>
    <comment_count>3</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2023-08-10 10:55:55 +0200</bug_when>
    <thetext>Bug 1450: Be more verbose w/ JavaEmitter comment lines for enums and defines, include native expression

Commit c30f0db4b785f21288f9cc5f7fd65393781d93c3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6845</commentid>
    <comment_count>4</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2023-08-10 11:02:15 +0200</bug_when>
    <thetext>Bug 1450: Add test snippets covering the issues: test2.h for Bindingtest2, TestJCPP and new TestCParser

Commit</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6846</commentid>
    <comment_count>5</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2023-08-10 11:13:58 +0200</bug_when>
    <thetext>Bug 1450: Remove nativewindow&apos;s drm-gbm GlueGen config&apos;s manual constant definitions, now properly passed from GlueGen

JOGL commit 1442d8dc875af3e945e656509105c89e394647c3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6847</commentid>
    <comment_count>6</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2023-08-10 11:24:21 +0200</bug_when>
    <thetext>Further manual validation..

I ran JOGL&apos;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!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>