Hi!

On Sun, Oct 12, 2025 at 12:23:21PM +0200, Jose E. Marchesi wrote:
> Some code in the rs6000 port relies on parsing the language name.
> This commit makes that code to recognize "GNU Algol 68".
> 
> Signed-off-by: Jose E. Marchesi <[email protected]>

This is okay for trunk, and for whatever backport you may want as well.
Thank you!

(It is nice if you could find a language code used by other toolchains
already for Algol.  0 (meaning "C") is a reasonable fallback, but
automatically using 0 for everything we do not yet explicitly handle is
just wrong, there are many languages that *do* have assigned codes that
however we do not yet handle!  And marking all those as "C" would be
causing incompatible things in the field :-( )


Segher


> gcc/ChangeLog
> 
>       * config/rs6000/rs6000-logue.cc (rs6000_output_function_epilogue):
>       Handle "GNU Algol 68" in language_string.
> ---
>  gcc/config/rs6000/rs6000-logue.cc | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/gcc/config/rs6000/rs6000-logue.cc 
> b/gcc/config/rs6000/rs6000-logue.cc
> index 5377ad6cee6..0005039733b 100644
> --- a/gcc/config/rs6000/rs6000-logue.cc
> +++ b/gcc/config/rs6000/rs6000-logue.cc
> @@ -5332,18 +5332,18 @@ rs6000_output_function_epilogue (FILE *file)
>        /* Tbtab format type.  Use format type 0.  */
>        fputs ("\t.byte 0,", file);
>  
> -      /* Language type.  Unfortunately, there does not seem to be any
> -      official way to discover the language being compiled, so we
> -      use language_string.
> -      C is 0.  Fortran is 1.  Ada is 3.  Modula-2 is 8.  C++ is 9.
> -      Java is 13.  Objective-C is 14.  Objective-C++ isn't assigned
> -      a number, so for now use 9.  LTO, Go, D, and JIT aren't assigned
> -      numbers either, so for now use 0.  */
> +      /* Language type.  Unfortunately, there does not seem to be any 
> official
> +      way to discover the language being compiled, so we use
> +      language_string.  C is 0.  Fortran is 1.  Ada is 3.  Modula-2 is 8.
> +      C++ is 9.  Java is 13.  Objective-C is 14.  Objective-C++ isn't
> +      assigned a number, so for now use 9.  LTO, Go, D, Algol 68 and JIT
> +      aren't assigned numbers either, so for now use 0.  */
>        if (lang_GNU_C ()
>         || ! strcmp (language_string, "GNU GIMPLE")
>         || ! strcmp (language_string, "GNU Go")
>         || ! strcmp (language_string, "GNU D")
>         || ! strcmp (language_string, "GNU Rust")
> +       || ! strcmp (language_string, "GNU Algol 68")
>         || ! strcmp (language_string, "libgccjit"))
>       i = 0;
>        else if (! strcmp (language_string, "GNU F77")
> -- 
 2.30.2

Reply via email to