Project

General

Profile

Feature #11955

Preprocessor: enforce OpenEdge's 255-level include nesting limit

Added by Paula Păstrăguș 6 days ago. Updated 5 days ago.

Status:
Internal Test
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

50%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
reviewer:
production:
No
env_name:
topics:
4GL Preprocessor

Related issues

Related to Conversion Tools - Feature #11741: implement a fully featured Language Server Protocol (LSP) server for 4GL code WIP

History

#1 Updated by Paula Păstrăguș 6 days ago

  • Related to Feature #11741: implement a fully featured Language Server Protocol (LSP) server for 4GL code added

#2 Updated by Paula Păstrăguș 6 days ago

A 4GL include may pull itself in, directly or through other includes. OpenEdge allows this, and stops it only at its nesting limit. FWD's preprocessor has no limit: an include which references itself with no condition, or under one which never turns false, is expanded without end.

OpenEdge behaviour (checked in 11.6): Files may nest 255 levels deep, the program counted, so an include nests 254 deep at most.

#3 Updated by Paula Păstrăguș 6 days ago

Testcase:

depth.i:

&IF LENGTH("{1}") = {2} &THEN
MESSAGE "depth.i reached level {2}".
&ELSE
{pmp-test/depth.i {1}x {2}}
&ENDIF

depth-main.p:

{pmp-test/depth.i x 255}

When a value >= 255 is passed to depth.i, OE shows an error, and it doesn't preprocess the main program, explicitly saying that the File has compilation errors.

#4 Updated by Paula Păstrăguș 5 days ago

  • Status changed from New to WIP
  • Assignee set to Paula Păstrăguș
  • % Done changed from 0 to 50
  • reviewer Greg Shah added

Committed the solution as rev 16795 / branch 11955a.

Next, I'll create some testcases to fully validate the solution, but so far, the one mentioned in my prev rev is working now, and if 10000 is passed for example, this will be shown in the conversion log:

     [java] Error in ./abl/pmp-test/depth.i#4:282 ==> Nested recursion limit of 255 exceeded in preprocessor expansion.
     [java] 
     [java] com.goldencode.p2j.preproc.PreprocessorException: Nested recursion limit of 255 exceeded in preprocessor expansion.

Please note that the stack trace was reduced, otherwise the conversion output would have been filled with a lot of unnecessary calls.

#5 Updated by Greg Shah 5 days ago

  • topics 4GL Preprocessor added

#6 Updated by Greg Shah 5 days ago

  • Status changed from WIP to Internal Test

Code Review Task Branch 11955a Revision 16795

I'm good with the change.

#7 Updated by Greg Shah 5 days ago

Please commit your testcases and update Preprocessor Testcases. You'll have to compare versus trunk (the results in the wiki page may relate to 11747a right now).

Also available in: Atom PDF