Patchwork [ada] Use Ada output of gnatbind for building tools

login
register
mail settings
Submitter Tristan Gingold
Date March 28, 2011, 9:26 a.m.
Message ID <5E53263E-38A0-4AFE-BC25-6D9EC706DFEE@adacore.com>
Download mbox | patch
Permalink /patch/88584/
State New
Headers show

Comments

Tristan Gingold - March 28, 2011, 9:26 a.m.
Hi,

gnatbind can generate Ada or C output.  The C output is being deprecated so it shouldn't be used to build the tools.
This patch updates the Makefiles so that the Ada output is used instead.

Ok for trunk ?

Tristan.

gcc/ada
2011-03-28  Tristan Gingold  <gingold@adacore.com>

	* gcc-interface/Make-lang.in (ada/b_gnat1.adb):  Replaces
	ada/b_gnat1.c. Use ada output of gnatbind.
	(ada/b_gnatb.adb): Ditto.
	(ada/b_gnat1.o, ada/b_gnatb.o): New rules.
	(ada.mostlyclean, ada.stage1)
	(ada.stage2, ada.stage3, ada.stage4, ada.stageprofile)
	(ada.stagefeedback): Adjust.

	* gcc-interface/Makefile.in (b_gnatl.adb): Replaces b_gnatl.c
	Use ada output of gnatbind.
	(b_gnatm.adb): Ditto.
	(b_gnatl.o, b_gnatm.o): New rules.
Eric Botcazou - March 28, 2011, 9:31 a.m.
> gnatbind can generate Ada or C output.  The C output is being deprecated so
> it shouldn't be used to build the tools. This patch updates the Makefiles
> so that the Ada output is used instead.

Great!  Please mention PR ada/44431 in the ChangeLog.
Arnaud Charlet - March 28, 2011, 9:32 a.m.
> gnatbind can generate Ada or C output.  The C output is being deprecated so it
> shouldn't be used to build the tools.
> This patch updates the Makefiles so that the Ada output is used instead.
> 
> Ok for trunk ?

OK, thanks.

Patch

diff --git gcc/ada/gcc-interface/Make-lang.in gcc/ada/gcc-interface/Make-lang.in
index 637a686..2c5fdf4 100644
--- gcc/ada/gcc-interface/Make-lang.in
+++ gcc/ada/gcc-interface/Make-lang.in
@@ -938,7 +938,7 @@  ada.uninstall:
 # We just have to delete files specific to us.
 
 ada.mostlyclean:
-       -$(RM) ada/*$(objext) ada/*.ali ada/b_*.c
+       -$(RM) ada/*$(objext) ada/*.ali ada/b_gnat*.ads ada/b_gnat*.adb
        -$(RM) ada/*$(coverageexts)
        -$(RM) ada/sdefault.adb ada/stamp-sdefault ada/stamp-snames
        -$(RMDIR) ada/tools
@@ -974,22 +974,22 @@  ada.maintainer-clean:
 # The main makefile has already created stage?/ada
 
 ada.stage1: stage1-start
-       -$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stage1/ada
+       -$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stage1/ada
        -$(MV) ada/stamp-* stage1/ada
 ada.stage2: stage2-start
-       -$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stage2/ada
+       -$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stage2/ada
        -$(MV) ada/stamp-* stage2/ada
 ada.stage3: stage3-start
-       -$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stage3/ada
+       -$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stage3/ada
        -$(MV) ada/stamp-* stage3/ada
 ada.stage4: stage4-start
-       -$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stage4/ada
+       -$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stage4/ada
        -$(MV) ada/stamp-* stage4/ada
 ada.stageprofile: stageprofile-start
-       -$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stageprofile/ada
+       -$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stageprofile/ada
        -$(MV) ada/stamp-* stageprofile/ada
 ada.stagefeedback: stagefeedback-start
-       -$(MV) ada/*$(objext) ada/*.ali ada/b_*.c stagefeedback/ada
+       -$(MV) ada/*$(objext) ada/*.ali ada/b_gnat*.ad* stagefeedback/ada
        -$(MV) ada/stamp-* stagefeedback/ada
 
 lang_checks += check-gnat
@@ -1086,19 +1086,28 @@  gnatstage2: force
 
 # Note that dependencies on obstack.h are not written
 # because that file is not part of GCC.
-# Dependencies on gvarargs.h are not written
-# because all that file does, when not compiling with GCC,
-# is include the system varargs.h.
 
 # Ada language specific files.
 
-ada/b_gnat1.c : $(GNAT1_ADA_OBJS)
-       $(GNATBIND) -C $(ADA_INCLUDES) -o ada/b_gnat1.c -n ada/gnat1drv.ali
-ada/b_gnat1.o : ada/b_gnat1.c
-
-ada/b_gnatb.c : $(GNATBIND_OBJS) ada/gnatbind.o ada/interfac.o
-       $(GNATBIND) -C $(ADA_INCLUDES) -o ada/b_gnatb.c ada/gnatbind.ali
-ada/b_gnatb.o : ada/b_gnatb.c
+ada/b_gnat1.adb : $(GNAT1_ADA_OBJS)
+        # Old gnatbind do not allow a path for -o.
+       $(GNATBIND) $(ADA_INCLUDES) -o b_gnat1.adb -n ada/gnat1drv.ali
+       $(MV) b_gnat1.adb b_gnat1.ads ada/
+
+ada/b_gnat1.o : ada/b_gnat1.adb
+        # Do not use ADAFLAGS to get rid of -gnatg which generates a lot
+        # of style messages.
+       $(CC) -c $(CFLAGS) $(ADA_CFLAGS) -gnatp -gnatws $(ADA_INCLUDES) \
+           $< $(OUTPUT_OPTION)
+
+ada/b_gnatb.adb : $(GNATBIND_OBJS) ada/gnatbind.o ada/interfac.o
+        # Old gnatbind do not allow a path for -o.
+       $(GNATBIND) $(ADA_INCLUDES) -o b_gnatb.adb ada/gnatbind.ali
+       $(MV) b_gnatb.adb b_gnatb.ads ada/
+
+ada/b_gnatb.o : ada/b_gnatb.adb
+       $(CC) -c $(CFLAGS) $(ADA_CFLAGS) -gnatp -gnatws $(ADA_INCLUDES) \
+           $< $(OUTPUT_OPTION)
 
 include $(srcdir)/ada/Make-generated.in
 
diff --git gcc/ada/gcc-interface/Makefile.in gcc/ada/gcc-interface/Makefile.in
index b64ba55..71c00e2 100644
--- gcc/ada/gcc-interface/Makefile.in
+++ gcc/ada/gcc-interface/Makefile.in
@@ -2687,13 +2687,19 @@  gnat-cross: force
 # because all that file does, when not compiling with GCC,
 # is include the system varargs.h.
 
-b_gnatl.c : $(GNATLINK_OBJS)
-       $(GNATBIND) -C $(ADA_INCLUDES) -o b_gnatl.c gnatlink.ali
-b_gnatl.o : b_gnatl.c
+b_gnatl.adb : $(GNATLINK_OBJS)
+       $(GNATBIND) $(ADA_INCLUDES) -o b_gnatl.adb gnatlink.ali
 
-b_gnatm.c : $(GNATMAKE_OBJS)
-       $(GNATBIND) -C $(ADA_INCLUDES) -o b_gnatm.c gnatmake.ali
-b_gnatm.o : b_gnatm.c
+b_gnatl.o : b_gnatl.adb
+       $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) -gnatws -gnatyN \
+           $< $(OUTPUT_OPTION)
+
+b_gnatm.adb : $(GNATMAKE_OBJS)
+       $(GNATBIND) $(ADA_INCLUDES) -o b_gnatm.adb gnatmake.ali
+
+b_gnatm.o : b_gnatm.adb
+       $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) -gnatws -gnatyN \
+           $< $(OUTPUT_OPTION)
 
 ADA_INCLUDE_DIR = $(libsubdir)/adainclude
 ADA_RTL_OBJ_DIR = $(libsubdir)/adalib