Consultor Eletrônico



Kbase P123075: Compile preprocess breaks the comment
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   6/9/2010
Status: Unverified

SYMPTOM(s):

4GL/ABL: COMPILE statement with the PREPROCESS option breaks comments

When compiling code with the preprocess option, in some cases, the first slash of an added comment may be removed. This will cause the preprocessed code to return errors when compiled and run again.

Doing 'compile filename.p preprocess' using following code:

disp "ABC".

&if defined (A1) &then
&if defined (A2) &then &else

do while "A" = "D": /* <- if You insert space before ':', it works */
end.

&endif
&endif /* this comment causes problem */

will result in following code:

disp "ABC".
* this comment causes problem */

Given the following proicedure program.p:
/* this comment will be broken by the COMPILE PREPROCESS option */
DEFINE TEMP-TABLE ttName
FIELD fName AS CHAR.
FOR EACH ttName WHERE fName = "search_string":
END.
If we run the following two compile statements twice in the procedure editor. the COMPILE SAVE statement will fail in the second and times:
COMPILE "C:\temp\compile_test\program.p" PREPROCESS "C:\temp\compile_test\program.tmp" NO-ERROR.
COMPILE "C:\temp\compile_test\program.tmp" SAVE INTO "C:\temp\compile_test".
If we examine the program.tmp, we will see that the COMPILE PREPROCESS statement broke the comment as follows:
* this comment will be broken by the COMPILE PREPROCESS option */
DEFINE TEMP-TABLE ttName
FIELD fName AS CHAR.
FOR EACH ttName WHERE fName = "search_string":
END.

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.1D
OpenEdge 10.1B

CAUSE:

The problem is caused by a failure to correctly process the colon ':' character of a DO, a FOR block etc. unless the colon ':' character is preceded by a space character.

CAUSE:

Bug# OE00148230

FIX:

Upgrade to OpenEdge 10.11B02 or higher. If upgrading to OpenEdge 10.1C or higher is not feasible, a workaround is to ensure that the colon ':' character associated with any DO, FOR, etc block is preceded by a space character. For example, the COMPILE PREPROCESS option would not fail if the offending lines in the above code were rewritten with a space preceding the colon ':' character. That is if the line:
do while "A" = "D":
was rewritten as:
do while "A" = "D" :
and the line:
FOR EACH ttName WHERE fName = "search_string":
was rewritten as:
FOR EACH ttName WHERE fName = "search_string" :