This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH,fortran] *The* ISO C Binding patch
On Sun, Jun 24, 2007 at 08:37:45PM +0200, FX Coudert wrote:
> >>+NAMED_CHARCST (ISOCBINDING_NULL_CHAR, "c_null_char", '\0')
> >>+NAMED_CHARCST (ISOCBINDING_ALERT, "c_alert", '\a')
> >>+NAMED_CHARCST (ISOCBINDING_BACKSPACE, "c_backspace", '\b')
> >>+NAMED_CHARCST (ISOCBINDING_FORM_FEED, "c_form_feed", '\f')
> >>+NAMED_CHARCST (ISOCBINDING_NEW_LINE, "c_new_line", '\n')
> >>+NAMED_CHARCST (ISOCBINDING_CARRIAGE_RETURN, "c_carriage_return",
> >>'\r')
> >>+NAMED_CHARCST (ISOCBINDING_HORIZONTAL_TAB, "c_horizontal_tab", '\t')
> >>+NAMED_CHARCST (ISOCBINDING_VERTICAL_TAB, "c_vertical_tab", '\v')
> >
> >Shouldn't those use the target character set?
>
> Indeed they should. I thought I had taken care of it when I worked on
> the F-E branch, but apparently I never committed it (or never got it
> fully working).
>
> For Steve : first, I'm sorry that I don't have time to deal with it
> myself; second, the function you need for the translation is
> lang_hooks.to_target_charset, you can see it used in trans-expr.c
> (gfc_trans_string_copy), it's simply a matter of replacing '\b' with
> lang_hooks.to_target_charset('\b'), and possibly #include
> "langhooks.h" at the beginning of the file concerned.
>
There are only 5 uses on lang_hooks.to_target_charset in the
entire GCC repository. One appears in trans-expr.c. None
involve any of the above special chars. Andreas pointed me
to libcpp/charset.c. This contains convert_escape, but that's
a static function and it deals with more than the above set.
There is cpp_host_to_exec_charset(), which might do the trick,
except that it is implemented in terms of opaque types declared
as part of cpp.
--
Steve