Re: Fix file descriptor leak in swig

2017-04-10 Thread Jonathan Gray
On Mon, Apr 10, 2017 at 02:50:50PM +0200, Mark Kettenis wrote:
> > Date: Mon, 10 Apr 2017 21:42:11 +1000
> > From: Jonathan Gray 
> > 
> > On Mon, Apr 10, 2017 at 01:35:57PM +0200, Mark Kettenis wrote:
> > > Looking into arm_neon.h.  This header file is supposed to be generated
> > > using the clang_tablegen tool, which is why we missed it.
> > 
> > Index: Makefile
> > ===
> > RCS file: /cvs/src/gnu/usr.bin/clang/include/clang/intrin/Makefile,v
> > retrieving revision 1.6
> > diff -u -p -r1.6 Makefile
> > --- Makefile24 Jan 2017 08:44:47 -  1.6
> > +++ Makefile10 Apr 2017 11:39:51 -
> > @@ -4,6 +4,8 @@
> >  
> >  LLVM_V=4.0.0
> >  CLANG_INTR_INCDIR= /usr/lib/clang/${LLVM_V}/include
> > +TBLGEN= ${.OBJDIR}/../../../clang-tblgen/clang-tblgen
> > +CLANG_INC=${.CURDIR}/../../../../../llvm/tools/clang/include
> >  
> >  .PATH: ${.CURDIR}/../../../../../llvm/tools/clang/lib/Headers
> >  
> > @@ -16,7 +18,8 @@ HEADERS=  stdalign.h \
> > module.modulemap \
> >  
> >  .if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "arm"
> > -HEADERS+=  arm_acle.h
> > +HEADERS+=  arm_acle.h \
> > +   arm_neon.h
> >  .elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
> >  HEADERS+=  adxintrin.h \
> > ammintrin.h \
> > @@ -73,6 +76,10 @@ HEADERS+=altivec.h \
> >  .endif
> >  
> >  all:   ${HEADERS}
> > +
> > +arm_neon.h: ${CLANG_INC}/clang/Basic/arm_neon.td
> > +   ${TBLGEN} -I${CLANG_INC} -gen-arm-neon \
> > +   -o ${.TARGET} ${.ALLSRC}   
> >  
> >  depend:
> > # Nothing here so far ...
> > 
> 
> Here's a slightly better version that removes the generated header
> file when you do "make clean":

ok jsg@

> 
> Index: gnu/usr.bin/clang/include/clang/intrin/Makefile
> ===
> RCS file: /cvs/src/gnu/usr.bin/clang/include/clang/intrin/Makefile,v
> retrieving revision 1.6
> diff -u -p -r1.6 Makefile
> --- gnu/usr.bin/clang/include/clang/intrin/Makefile   24 Jan 2017 08:44:47 
> -  1.6
> +++ gnu/usr.bin/clang/include/clang/intrin/Makefile   10 Apr 2017 12:48:05 
> -
> @@ -5,8 +5,12 @@
>  LLVM_V=  4.0.0
>  CLANG_INTR_INCDIR=   /usr/lib/clang/${LLVM_V}/include
>  
> +TBLGEN= ${.OBJDIR}/../../../clang-tblgen/clang-tblgen
> +CLANG_INC=${.CURDIR}/../../../../../llvm/tools/clang/include
> +
>  .PATH:   ${.CURDIR}/../../../../../llvm/tools/clang/lib/Headers
>  
> +GEN=
>  HEADERS= stdalign.h \
>   stdatomic.h \
>   stdnoreturn.h \
> @@ -16,7 +20,8 @@ HEADERS=stdalign.h \
>   module.modulemap \
>  
>  .if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "arm"
> -HEADERS+=arm_acle.h
> +GEN+=arm_neon.h
> +HEADERS+=arm_acle.h ${GEN}
>  .elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
>  HEADERS+=adxintrin.h \
>   ammintrin.h \
> @@ -78,12 +83,15 @@ depend:
>   # Nothing here so far ...
>  
>  clean cleandir:
> - # Nothing here so far ...
> + rm -f ${GEN}
>  
>  install includes: ${HEADERS}
>   ${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m ${DIRMODE} \
>   ${DESTDIR}${CLANG_INTR_INCDIR}
>   ${INSTALL} ${INSTALL_COPY} -m 444 ${.ALLSRC} \
>   ${DESTDIR}${CLANG_INTR_INCDIR}
> +
> +arm_neon.h: ${CLANG_INC}/clang/Basic/arm_neon.td
> + ${TBLGEN} -gen-arm-neon -o ${.TARGET} ${.ALLSRC}
>  
>  .include 
> 



Re: Fix file descriptor leak in swig

2017-04-10 Thread Mark Kettenis
> Date: Mon, 10 Apr 2017 21:42:11 +1000
> From: Jonathan Gray 
> 
> On Mon, Apr 10, 2017 at 01:35:57PM +0200, Mark Kettenis wrote:
> > Looking into arm_neon.h.  This header file is supposed to be generated
> > using the clang_tablegen tool, which is why we missed it.
> 
> Index: Makefile
> ===
> RCS file: /cvs/src/gnu/usr.bin/clang/include/clang/intrin/Makefile,v
> retrieving revision 1.6
> diff -u -p -r1.6 Makefile
> --- Makefile  24 Jan 2017 08:44:47 -  1.6
> +++ Makefile  10 Apr 2017 11:39:51 -
> @@ -4,6 +4,8 @@
>  
>  LLVM_V=  4.0.0
>  CLANG_INTR_INCDIR=   /usr/lib/clang/${LLVM_V}/include
> +TBLGEN= ${.OBJDIR}/../../../clang-tblgen/clang-tblgen
> +CLANG_INC=${.CURDIR}/../../../../../llvm/tools/clang/include
>  
>  .PATH:   ${.CURDIR}/../../../../../llvm/tools/clang/lib/Headers
>  
> @@ -16,7 +18,8 @@ HEADERS=stdalign.h \
>   module.modulemap \
>  
>  .if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "arm"
> -HEADERS+=arm_acle.h
> +HEADERS+=arm_acle.h \
> + arm_neon.h
>  .elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
>  HEADERS+=adxintrin.h \
>   ammintrin.h \
> @@ -73,6 +76,10 @@ HEADERS+=  altivec.h \
>  .endif
>  
>  all: ${HEADERS}
> +
> +arm_neon.h: ${CLANG_INC}/clang/Basic/arm_neon.td
> + ${TBLGEN} -I${CLANG_INC} -gen-arm-neon \
> + -o ${.TARGET} ${.ALLSRC}   
>  
>  depend:
>   # Nothing here so far ...
> 

Here's a slightly better version that removes the generated header
file when you do "make clean":

Index: gnu/usr.bin/clang/include/clang/intrin/Makefile
===
RCS file: /cvs/src/gnu/usr.bin/clang/include/clang/intrin/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- gnu/usr.bin/clang/include/clang/intrin/Makefile 24 Jan 2017 08:44:47 
-  1.6
+++ gnu/usr.bin/clang/include/clang/intrin/Makefile 10 Apr 2017 12:48:05 
-
@@ -5,8 +5,12 @@
 LLVM_V=4.0.0
 CLANG_INTR_INCDIR= /usr/lib/clang/${LLVM_V}/include
 
+TBLGEN= ${.OBJDIR}/../../../clang-tblgen/clang-tblgen
+CLANG_INC=${.CURDIR}/../../../../../llvm/tools/clang/include
+
 .PATH: ${.CURDIR}/../../../../../llvm/tools/clang/lib/Headers
 
+GEN=
 HEADERS=   stdalign.h \
stdatomic.h \
stdnoreturn.h \
@@ -16,7 +20,8 @@ HEADERS=  stdalign.h \
module.modulemap \
 
 .if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "arm"
-HEADERS+=  arm_acle.h
+GEN+=  arm_neon.h
+HEADERS+=  arm_acle.h ${GEN}
 .elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
 HEADERS+=  adxintrin.h \
ammintrin.h \
@@ -78,12 +83,15 @@ depend:
# Nothing here so far ...
 
 clean cleandir:
-   # Nothing here so far ...
+   rm -f ${GEN}
 
 install includes: ${HEADERS}
${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m ${DIRMODE} \
${DESTDIR}${CLANG_INTR_INCDIR}
${INSTALL} ${INSTALL_COPY} -m 444 ${.ALLSRC} \
${DESTDIR}${CLANG_INTR_INCDIR}
+
+arm_neon.h: ${CLANG_INC}/clang/Basic/arm_neon.td
+   ${TBLGEN} -gen-arm-neon -o ${.TARGET} ${.ALLSRC}
 
 .include