Patchwork Fix location where math-vector-fortran.h is installed.

login
register
mail settings
Submitter Martin Liška
Date Feb. 27, 2019, 8:09 a.m.
Message ID <e1bdc055-e8a8-d3a9-794e-1f722bc82f1e@suse.cz>
Download mbox | patch
Permalink /patch/31618/
State New
Headers show

Comments

Martin Liška - Feb. 27, 2019, 8:09 a.m.
On 2/26/19 10:41 PM, Zack Weinberg wrote:
> On Tue, Feb 26, 2019 at 4:16 PM Florian Weimer <fweimer@redhat.com> wrote:
>> * Martin Liška:
>>> On 2/26/19 7:05 PM, Joseph Myers wrote:
>>>> On Tue, 26 Feb 2019, Martin Liška wrote:
>>>>
>>>>> Hi.
>>>>>
>>>>> This is follow up patch where I fix location where the header
>>>>> is installed. I made a type as I was copying & pasting.
> 
> Do I understand correctly that the desired installation location is
> $(prefix)/include/finclude/math-vector-fortran.h ?

Yes.

> 
>> This causes test suite failures for me:
>>
>> math/check-installed-headers-c.out:
>>
>> In file included from /tmp/cih_test_C67G81.c:8:
>> ../sysdeps/x86/fpu/finclude/math-vector-fortran.h:1:1: error: expected identifie
>> r or ‘(’ before ‘!’ token
>>  ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*

I skipped that header explicitly.

> 
> Moving the file out of bits/ caused it to be newly subject to these tests.
> 
> If $(prefix)/include/finclude/ is intended to contain nothing but
> Fortran headers, we could add finclude to the list of subdirectories
> to skip in scripts/check*headers* ...
> 
> zw
> 

And for the check-wrapper-headers.py, I read a header file and skip files
with 'f90' file type.

Updated patch is attached.

Martin
Florian Weimer - Feb. 27, 2019, 10:12 a.m.
* Martin Liška:

>          is_nonsysdep_header = os.access(header, os.R_OK)
>          if is_nonsysdep_header:
> +            # Skip Fortran header files
> +            if '-*- f90 -*-' in open(header).readlines()[0]:
> +                continue

Please use “with” to close the file promptly, and do not read the entire
file, like this (untested):

    # Skip Fortran header files.
    with open(header) as inp:
        if '-*- f90 -*-' in next(inp):
            continue

Thanks,
Florian
Andreas Schwab - Feb. 27, 2019, 11:30 a.m.
On Feb 27 2019, Martin Liška <mliska@suse.cz> wrote:

> 2019-02-26  Martin Liska  <mliska@suse.cz>
>
> 	* math/Makefile: Change location where math-vector-fortran.h is
> 	installed.
> 	* finclude/math-vector-fortran.h: Move from bits/math-vector-fortran.h.

That file resides in math/.

Andreas.
Zack Weinberg - Feb. 27, 2019, 3 p.m.
On Wed, Feb 27, 2019 at 3:09 AM Martin Liška <mliska@suse.cz> wrote:
> On 2/26/19 10:41 PM, Zack Weinberg wrote:
> > On Tue, Feb 26, 2019 at 4:16 PM Florian Weimer <fweimer@redhat.com> wrote:
> >> * Martin Liška:
> >>> On 2/26/19 7:05 PM, Joseph Myers wrote:
> >>>> On Tue, 26 Feb 2019, Martin Liška wrote:
> >>>>
> >>>>> Hi.
> >>>>>
> >>>>> This is follow up patch where I fix location where the header
> >>>>> is installed. I made a type as I was copying & pasting.
> >
> > Do I understand correctly that the desired installation location is
> > $(prefix)/include/finclude/math-vector-fortran.h ?
>
> Yes.

Will there ever be C headers in $(prefix)/include/finclude ?

> >> In file included from /tmp/cih_test_C67G81.c:8:
> >> ../sysdeps/x86/fpu/finclude/math-vector-fortran.h:1:1: error: expected identifie
> >> r or ‘(’ before ‘!’ token
> >>  ! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 -*
>
> I skipped that header explicitly.
...
> +        # Skip Fortran header
> +        (finclude/math-vector-fortran.h)
> +            continue;;

To put the above question another way, is there a reason why this shouldn't be

+        # Skip Fortran headers
+        (finclude/*)
+            continue;;

?

> And for the check-wrapper-headers.py, I read a header file and skip files
> with 'f90' file type.

If you're going to do it this way, I recommend you copy the more
general Emacs modeline parser from
https://sourceware.org/ml/libc-alpha/2019-02/msg00539.html ... but if
we can just skip finclude/* that might be a better approach for both
scripts.

zw

Patch

From 597b7ec78b23f8bd76a4d8acfeaee265f06f2a1b Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 26 Feb 2019 18:17:36 +0100
Subject: [PATCH] Fix location where math-vector-fortran.h is installed.

ChangeLog:

2019-02-26  Martin Liska  <mliska@suse.cz>

	* math/Makefile: Change location where math-vector-fortran.h is
	installed.
	* finclude/math-vector-fortran.h: Move from bits/math-vector-fortran.h.
	* sysdeps/x86/fpu/finclude/math-vector-fortran.h: Move
	from sysdeps/x86/fpu/bits/math-vector-fortran.h.
	* scripts/check-installed-headers.sh: Skip Fortran header file.
	* scripts/check-wrapper-headers.py: Filter out f90 files.
---
 math/Makefile                                            | 2 +-
 {bits => math/finclude}/math-vector-fortran.h            | 0
 scripts/check-installed-headers.sh                       | 4 ++++
 scripts/check-wrapper-headers.py                         | 4 ++++
 sysdeps/x86/fpu/{bits => finclude}/math-vector-fortran.h | 0
 5 files changed, 9 insertions(+), 1 deletion(-)
 rename {bits => math/finclude}/math-vector-fortran.h (100%)
 rename sysdeps/x86/fpu/{bits => finclude}/math-vector-fortran.h (100%)

diff --git a/math/Makefile b/math/Makefile
index fc4191089d..cb4eaec6a9 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -26,7 +26,7 @@  headers		:= math.h bits/mathcalls.h bits/mathinline.h \
 		   fpu_control.h complex.h bits/cmathcalls.h fenv.h \
 		   bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h \
 		   bits/math-finite.h bits/math-vector.h \
-		   bits/math-vector-fortran.h \
+		   finclude/math-vector-fortran.h \
 		   bits/libm-simd-decl-stubs.h bits/iscanonical.h \
 		   bits/flt-eval-method.h bits/fp-fast.h bits/fp-logb.h \
 		   bits/long-double.h bits/mathcalls-helper-functions.h \
diff --git a/bits/math-vector-fortran.h b/math/finclude/math-vector-fortran.h
similarity index 100%
rename from bits/math-vector-fortran.h
rename to math/finclude/math-vector-fortran.h
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
index 8e7beffd82..937ed969ec 100644
--- a/scripts/check-installed-headers.sh
+++ b/scripts/check-installed-headers.sh
@@ -84,6 +84,10 @@  for header in "$@"; do
         (sys/elf.h)
             continue;;
 
+        # Skip Fortran header
+        (finclude/math-vector-fortran.h)
+            continue;;
+
 	# sys/sysctl.h is unsupported for x32.
 	(sys/sysctl.h)
             case "$is_x32" in
diff --git a/scripts/check-wrapper-headers.py b/scripts/check-wrapper-headers.py
index 094faa3ced..5c982c3eb4 100644
--- a/scripts/check-wrapper-headers.py
+++ b/scripts/check-wrapper-headers.py
@@ -75,6 +75,10 @@  def check_headers(args):
 
         is_nonsysdep_header = os.access(header, os.R_OK)
         if is_nonsysdep_header:
+            # Skip Fortran header files
+            if '-*- f90 -*-' in open(header).readlines()[0]:
+                continue
+
             include_path = os.path.join(args.root, INCLUDE, header)
             if not os.access(include_path, os.R_OK):
                 print('error: missing wrapper header {} for {}'.format(
diff --git a/sysdeps/x86/fpu/bits/math-vector-fortran.h b/sysdeps/x86/fpu/finclude/math-vector-fortran.h
similarity index 100%
rename from sysdeps/x86/fpu/bits/math-vector-fortran.h
rename to sysdeps/x86/fpu/finclude/math-vector-fortran.h
-- 
2.20.1