AdaCore / AdaCore/libadalang

warnings when parsing projects with C

Open
#334 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Ada
Stars
171
Forks
48
PR merge metrics
No merged PRs in 30d

Description

I am not trying to parse C files :-)

But I have a few projects in the closure that include both C and Ada files, via the Languages attribute in the .gpr file. When I parse those projects via lal.UnitProvider.for_project, I get warnings on stdout (or stderr, not sure):

cjson.gpr:8:25: language unknown for "cJSON.c"

Obviously, libadalang cannot do anything with the C files, but it would be nice to just ignore them.
If I remember right, GNATCOLL.Projects supports this, but you need some initialization to register the language extensions. So maybe for_project needs a parameter like a dictionary mapping language names to extensions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at lal.UnitProvider.for_project and inspect how the .gpr Languages attribute is handled, including the GNATCOLL.Projects language-extension initialization mentioned in the report. Reproduce the warning with cjson.gpr, which contains both C and Ada files; done means C entries are ignored without warnings while Ada parsing still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.