[Ada] Add support for .c output file
authorArnaud Charlet <charlet@adacore.com>
Thu, 29 Oct 2020 09:41:22 +0000 (10:41 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 26 Nov 2020 08:39:58 +0000 (03:39 -0500)
gcc/ada/

* osint-c.adb (Set_Output_Object_File_Name): Add support for
.c output file.

gcc/ada/osint-c.adb

index 8ef8b8b..4fc0998 100644 (file)
@@ -475,15 +475,14 @@ package body Osint.C is
 
    begin
       --  Make sure that the object file has the expected extension
+      --  Allow for either .o or .c (for C code generation)
 
       if NL <= EL
          or else
-          (Name (NL - EL + Name'First .. Name'Last) /= Ext
+          (not Generate_Asm
+             and then Name (NL - EL + Name'First .. Name'Last) /= Ext
              and then Name (NL - 2 + Name'First .. Name'Last) /= ".o"
-             and then not Generate_Asm
-             and then
-               (not Generate_C_Code
-                  or else Name (NL - 2 + Name'First .. Name'Last) /= ".c"))
+             and then Name (NL - 2 + Name'First .. Name'Last) /= ".c")
       then
          Fail ("incorrect object file extension");
       end if;