Does hyphen (-) have special meaning like in GNAT Ada source files ?
The title of your post mentions GPR project files, but your text says “GNAT Ada source files”. But in any case, the answer is “yes”. In Ada, “-” has the special meaning to be the binary or unary “minus” operator. Also, you can’t use “-” in identifiers, to avoid confusion between an identifier A-B
and the expression A - B
. Also, double hyphen --
is used for comments:
-- This is a comment
For GPR files I believe it’s identical, you can’t use hyphen in identifiers, and the syntax for comments is the same.
In case you mean “in GPR project file names”, then I think the answer is no; indeed, if you put a hyphen in a project file name, gprbuild will just complain that the name and the file name don’t match (and you can’t put a hyphen in the project name).
Actually
Like Ada units, GPR project can have child projects: 2. GNAT Project Manager — GPR Tools User's Guide 24.0w documentation
In which case you use a dash in the filename, like for Ada units. See here for example:
I was part of the initial design team for the project files, and I did not even know we could have child projects !
They do not seem to bring any semantics beside grouping related projects, which already is kind of nice. I might make changes in our code base to use them.
It might be like Ada 83; You can get a long way with nested packages; I found out eventually…!