From 1328657ef00a6f1849265dc57e91a94fd732ef88 Mon Sep 17 00:00:00 2001 From: "James K. Lowden" <jklowden@symas.com> Date: Tue, 17 Dec 2024 17:10:16 -0500 Subject: [PATCH] first_statement excludes declaratives --- gcc/cobol/parse_ante.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/cobol/parse_ante.h b/gcc/cobol/parse_ante.h index 422567fa2523..a799aa0a5e1e 100644 --- a/gcc/cobol/parse_ante.h +++ b/gcc/cobol/parse_ante.h @@ -2136,6 +2136,8 @@ static class current_t { return symbol_index(symbol_elem_of(section)); } + bool doing_declaratives() const { return in_declaratives; } + cbl_label_t *doing_declaratives( bool begin ) { if( begin ) { in_declaratives = true; @@ -3598,7 +3600,7 @@ static size_t statement_begin( const YYLTYPE& loc, int token ); static void ast_first_statement( int first_line ) { static bool first = true; - if( first ) { + if( first && ! current.doing_declaratives() ) { parser_first_statement(first_line); first = false; } -- GitLab