Hi,
Following the discussions in [1], I am updating the GNU gettext
support for 'gcc-internal-format' strings to the current state,
with the goal of having it completed and released in time for GCC 16.
There's a problem, though: The directive %C is defined in an incompatible
way in the C++ front-end and in the Fortran front-end.
In the C++ front-end, the %C directive consumes a tree code argument.
Example:
cp/mangle.cc:3898
sorry ("mangling %C", code);
Whereas in the Fortran front-end, the %C directive consumes no argument.
Example:
fortran/primary.cc:1617
gfc_error ("Syntax error in COMPLEX constant at %C");
I can't implement a proper checking of translations of format strings
if %C consumes an argument "sometimes". Testing for the the presence
of 'fortran/' among the source locations would be an unreliable hack,
because the source locations in a PO file are optional; they can be
filtered out without changing the semantics of the PO file.
Since there are many more uses of %C in the Fortran front-end than in
the C++ front-end: How about renaming the %C directive in the C++
front-end to something else? The directive letters
B G J K M N U W Y
are still available.
Alternatively, it would be possible to reintroduce 'gfc-internal-format'
as a variant of 'gcc-internal-format' (with 'gfc-internal-format' being
used for the Fortran front-end and 'gcc-internal-format' for the rest of
the GCC code), but that would require changes to po/exgettext and is
also more complicated in the long term.
Bruno
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119684