https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114520

--- Comment #2 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Created attachment 57832
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57832&action=edit
Proposed fix

The error recovery causes misleading error messages to appear if an EXPORT
and IMPORT statement are in the wrong order.  This patch detects the
incorrect order and issues an error message and prevents error recovery.
The fix should be improved and made more general if another similar
case is required.

gcc/m2/ChangeLog:

        * gm2-compiler/P0SyntaxCheck.bnf (DetectImport): New procedure.
        (EnableImportCheck): New boolean.
        (Expect): Call DetectImport.
        (Export): Set EnableImportCheck TRUE before ';' and FALSE
        afterwards.

Reply via email to