public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-11] gfortran: Fix in-build-tree testing [PR101305,  PR101660]
@ 2021-08-20  3:06 Sandra Loosemore
  0 siblings, 0 replies; only message in thread
From: Sandra Loosemore @ 2021-08-20  3:06 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0a8af79817f5c633543d2aa32f4f0385af4cf22c

commit 0a8af79817f5c633543d2aa32f4f0385af4cf22c
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Wed Aug 11 19:18:42 2021 -0700

    gfortran: Fix in-build-tree testing [PR101305, PR101660]
    
    ISO_Fortran_binding.h is written in the build dir - hence, a previous commit
    added it as include directory for in-build-tree testing.  However,
    it turned out that -I$specdir/libgfortran interferes with reading .mod files
    as they are then no longer regareded as intrinsic modules.  Solution: Create
    an extra include/ directory in the libgfortran build dir and copy
    ISO_Fortran_binding.h to that directory.  As -B$specdir/libgfortran already
    causes gfortran to read that include subdirectory, the -I flag is no longer
    needed.
    
            PR libfortran/101305
            PR fortran/101660
            PR testsuite/101847
    
    libgfortran/ChangeLog:
    
            * Makefile.am (ISO_Fortran_binding.h): Create include/ in the build dir
            and copy the include file to it.
            (clean-local): Add for removing the 'include' directory.
            * Makefile.in: Regenerate.
    
    gcc/testsuite/ChangeLog:
    
            * lib/gfortran.exp (gfortran_init): Remove -I$specpath/libgfortran
            from the string used to set GFORTRAN_UNDER_TEST.
    
    (cherry picked from commit 2ba0376ac40447ce7ee09fcef00511c18db25dfa)

Diff:
---
 gcc/testsuite/ChangeLog.omp    | 13 +++++++++++++
 gcc/testsuite/lib/gfortran.exp |  2 +-
 libgfortran/ChangeLog.omp      | 14 ++++++++++++++
 libgfortran/Makefile.am        |  9 +++++++++
 libgfortran/Makefile.in        | 10 +++++++++-
 5 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp
index 9a1b2f9d425..4385c18ca7b 100644
--- a/gcc/testsuite/ChangeLog.omp
+++ b/gcc/testsuite/ChangeLog.omp
@@ -1,3 +1,16 @@
+2021-08-11  Sandra Loosemore  <sandra@codesourcery.com>
+
+	Backported from master:
+
+	2021-08-10  Tobias Burnus  <tobias@codesourcery.com>
+
+	PR libfortran/101305
+	PR fortran/101660
+	PR testsuite/101847
+
+	* lib/gfortran.exp (gfortran_init): Remove -I$specpath/libgfortran
+	from the string used to set GFORTRAN_UNDER_TEST.
+
 2021-08-11  Sandra Loosemore  <sandra@codesourcery.com>
 
 	Backported from master:
diff --git a/gcc/testsuite/lib/gfortran.exp b/gcc/testsuite/lib/gfortran.exp
index cae6738b4b8..43f4d4eda17 100644
--- a/gcc/testsuite/lib/gfortran.exp
+++ b/gcc/testsuite/lib/gfortran.exp
@@ -184,7 +184,7 @@ proc gfortran_init { args } {
 		    set specpath [get_multilibs]
 		}
 		set gfortran_init_set_GFORTRAN_UNDER_TEST 1
-		set GFORTRAN_UNDER_TEST [findfile $base_dir/../../gfortran "$base_dir/../../gfortran -B$base_dir/../../ -B$specpath/libgfortran/ -I$specpath/libgfortran" [findfile $base_dir/gfortran "$base_dir/gfortran -B$base_dir/" [transform gfortran]]]
+		set GFORTRAN_UNDER_TEST [findfile $base_dir/../../gfortran "$base_dir/../../gfortran -B$base_dir/../../ -B$specpath/libgfortran/" [findfile $base_dir/gfortran "$base_dir/gfortran -B$base_dir/" [transform gfortran]]]
 	    }
 	}
     }
diff --git a/libgfortran/ChangeLog.omp b/libgfortran/ChangeLog.omp
index 2f96fd20c07..ff31c38439a 100644
--- a/libgfortran/ChangeLog.omp
+++ b/libgfortran/ChangeLog.omp
@@ -1,3 +1,17 @@
+2021-08-11  Sandra Loosemore  <sandra@codesourcery.com>
+
+	Backported from master:
+
+	2021-08-10  Tobias Burnus  <tobias@codesourcery.com>
+
+	PR libfortran/101305
+	PR fortran/101660
+	PR testsuite/101847
+	* Makefile.am (ISO_Fortran_binding.h): Create include/ in the build dir
+	and copy the include file to it.
+	(clean-local): Add for removing the 'include' directory.
+	* Makefile.in: Regenerate.
+
 2021-08-11  Sandra Loosemore  <sandra@codesourcery.com>
 
 	Backported from master:
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 3546a3f3711..8d104321567 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -1076,6 +1076,9 @@ fpu-target.inc: fpu-target.h $(srcdir)/libgfortran.h
 	grep '^#define GFC_FPE_' < $(top_srcdir)/../gcc/fortran/libgfortran.h > $@ || true
 	grep '^#define GFC_FPE_' < $(srcdir)/libgfortran.h >> $@ || true
 
+# Place ISO_Fortran_binding.h also under include/ in the build directory such
+# that it can be used for in-built-tree testsuite runs without interference of
+# other files in the build dir - like intrinsic .mod files or other .h files.
 ISO_Fortran_binding.h: $(srcdir)/ISO_Fortran_binding-1-tmpl.h \
 		       $(srcdir)/ISO_Fortran_binding-2-tmpl.h \
 		       $(srcdir)/ISO_Fortran_binding-3-tmpl.h \
@@ -1085,6 +1088,9 @@ ISO_Fortran_binding.h: $(srcdir)/ISO_Fortran_binding-1-tmpl.h \
 	$(COMPILE) -E -dD $(srcdir)/ISO_Fortran_binding-2-tmpl.h \
 	| grep '^#define CFI_type' >> $@
 	cat $(srcdir)/ISO_Fortran_binding-3-tmpl.h >> $@
+	$(MKDIR_P) include
+	-rm -f include/ISO_Fortran_binding.h
+	cp $@ include/ISO_Fortran_binding.h
 
 ## A 'normal' build shouldn't need to regenerate these
 ## so we only include them in maintainer mode
@@ -1245,6 +1251,9 @@ $(gfor_misc_specifics): m4/misc_specifics.m4 m4/head.m4
 ## end of maintainer mode only rules
 endif
 
+clean-local:
+	-rm -rf include
+
 EXTRA_DIST = $(m4_files)
 
 # target overrides
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index a7d8e11b5e4..afe1ed17cb4 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -698,7 +698,6 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
-runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -7042,6 +7041,9 @@ fpu-target.inc: fpu-target.h $(srcdir)/libgfortran.h
 	grep '^#define GFC_FPE_' < $(top_srcdir)/../gcc/fortran/libgfortran.h > $@ || true
 	grep '^#define GFC_FPE_' < $(srcdir)/libgfortran.h >> $@ || true
 
+# Place ISO_Fortran_binding.h also under include/ in the build directory such
+# that it can be used for in-built-tree testsuite runs without interference of
+# other files in the build dir - like intrinsic .mod files or other .h files.
 ISO_Fortran_binding.h: $(srcdir)/ISO_Fortran_binding-1-tmpl.h \
 		       $(srcdir)/ISO_Fortran_binding-2-tmpl.h \
 		       $(srcdir)/ISO_Fortran_binding-3-tmpl.h \
@@ -7051,6 +7053,9 @@ ISO_Fortran_binding.h: $(srcdir)/ISO_Fortran_binding-1-tmpl.h \
 	$(COMPILE) -E -dD $(srcdir)/ISO_Fortran_binding-2-tmpl.h \
 	| grep '^#define CFI_type' >> $@
 	cat $(srcdir)/ISO_Fortran_binding-3-tmpl.h >> $@
+	$(MKDIR_P) include
+	-rm -f include/ISO_Fortran_binding.h
+	cp $@ include/ISO_Fortran_binding.h
 
 @MAINTAINER_MODE_TRUE@$(i_all_c): m4/all.m4 $(I_M4_DEPS2)
 @MAINTAINER_MODE_TRUE@	$(M4) -Dfile=$@ -I$(srcdir)/m4 all.m4 > $@
@@ -7205,6 +7210,9 @@ ISO_Fortran_binding.h: $(srcdir)/ISO_Fortran_binding-1-tmpl.h \
 @MAINTAINER_MODE_TRUE@$(gfor_misc_specifics): m4/misc_specifics.m4 m4/head.m4
 @MAINTAINER_MODE_TRUE@	$(M4) -Dfile=$@ -I$(srcdir)/m4 misc_specifics.m4 > $@
 
+clean-local:
+	-rm -rf include
+
 # target overrides
 -include $(tmake_file)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-20  3:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20  3:06 [gcc/devel/omp/gcc-11] gfortran: Fix in-build-tree testing [PR101305, PR101660] Sandra Loosemore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).