Skip to content

Avoid crash on private nested generic packages - #40

Closed
yrashk wants to merge 1 commit into
AdaCore:masterfrom
flyology-ada:fix-private-nested-generic
Closed

yrashk wants to merge 1 commit into
AdaCore:masterfrom
flyology-ada:fix-private-nested-generic

Conversation

@yrashk

@yrashk yrashk commented Sep 1, 2026

Copy link
Copy Markdown

Problem

When private documentation is disabled, Process_Children still inspects a package's private declarations to recover dispatching operations. A nested generic package is neither handled nor skipped by that traversal, so GNATdoc reaches Raise_Not_Implemented and reports an internal error.

The failure is reproduced by:

package Private_Nested_Generic is
private
   generic
   package G is
   end G;
end Private_Nested_Generic;

Solution

Treat Ada_Generic_Package_Decl like the other private declarations omitted during public documentation generation. Public generic packages and runs using --generate-private retain their existing traversal behavior.

Add the reproducer to the executable nocrash fixture so the maintained testsuite guards the failure.

Verification

  • Pristine GNATdoc 26.0.0 reproduced GNATDOC.NOT_IMPLEMENTED with GNAT 13.2.0, 14.2.0, 15.3.0, and 16.2.0.
  • Patched GNATdoc 26.0.0 completed without the internal error and generated index.html in all four compiler lanes.
  • The regression fixture fails with the pristine executable and passes with the patched executable.
  • The patched GNATdoc 26.0.0 source build completed successfully.
  • The maintained e3.testsuite suite passes: 31/31 tests.

GNATdoc traverses selected private declarations to recover dispatching operations even when private documentation is disabled. A nested generic package is not classified by that filter, so it raises GNATDOC.NOT_IMPLEMENTED instead of being omitted.

Solution: Skip private nested generic packages during public generation

Classify GenericPackageDecl with the other private declarations skipped in public mode and add the construct to the executable no-crash regression fixture.
@CLAassistant

CLAassistant commented Sep 1, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@godunko

godunko commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Thank you for contribution, pull request has been merged.

@godunko godunko closed this Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants