public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: Remove ccwrap
@ 2020-10-19 15:40 Jon TURNEY
  0 siblings, 0 replies; only message in thread
From: Jon TURNEY @ 2020-10-19 15:40 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b55e3f1916edcb457bc4cc91d74e2c8dfa85e57e

commit b55e3f1916edcb457bc4cc91d74e2c8dfa85e57e
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sat Oct 3 14:41:58 2020 +0100

    Cygwin: Remove ccwrap
    
    ccwrap massages the compiler's standard include directories to remove
    '/usr/include/w32api', with the intent of allowing it to be overriden by
    '--with-windows-headers' (See 4c36016b).
    
    I'm not 100% convinced that this is always working as desired, since in
    some places w32api includes are done using <w32api/something.h>, which
    will find them via the path /usr/include.
    
    If this does turn out to be needed, this could also be implemented by
    constructing the appropriate compiler flags once, rather than on every
    compiler invocation.

Diff:
---
 winsup/Makefile.common       |  4 ++--
 winsup/acinclude.m4          | 16 +++++++-------
 winsup/c++wrap               |  6 ------
 winsup/ccwrap                | 51 --------------------------------------------
 winsup/configure             | 16 ++++++--------
 winsup/configure.cygwin      | 10 ---------
 winsup/cygserver/Makefile.in |  9 +-------
 winsup/cygserver/aclocal.m4  | 16 +++++++-------
 winsup/cygserver/configure   | 16 ++++++--------
 winsup/cygwin/Makefile.in    | 13 +++--------
 winsup/cygwin/aclocal.m4     | 16 +++++++-------
 winsup/cygwin/configure      | 16 ++++++--------
 winsup/cygwin/gentls_offsets |  2 +-
 winsup/utils/Makefile.in     | 11 +---------
 winsup/utils/aclocal.m4      | 16 +++++++-------
 winsup/utils/configure       | 16 ++++++--------
 16 files changed, 68 insertions(+), 166 deletions(-)

diff --git a/winsup/Makefile.common b/winsup/Makefile.common
index a04d8e1de..69cac9b43 100644
--- a/winsup/Makefile.common
+++ b/winsup/Makefile.common
@@ -21,8 +21,8 @@ opt=$(filter -O%,${CFLAGS}) $(filter -g%,${CFLAGS})
 override CXXFLAGS:=${filter-out -g%,$(filter-out -O%,${CXXFLAGS})} ${opt}
 
 cflags_common:=-Wall -Wstrict-aliasing -Wwrite-strings -fno-common -pipe -fbuiltin -fmessage-length=0
-COMPILE.cc=c++wrap ${CXXFLAGS} -fno-rtti -fno-exceptions -fno-use-cxa-atexit ${cflags_common}
-COMPILE.c=ccwrap ${CFLAGS} ${cflags_common}
+COMPILE.cc=${CXX} ${INCLUDES} ${CXXFLAGS} -fno-rtti -fno-exceptions -fno-use-cxa-atexit ${cflags_common}
+COMPILE.c=${CC} ${INCLUDES} ${CFLAGS} ${cflags_common}
 
 top_srcdir:=$(call justdir,${winsup_srcdir})
 top_builddir:=$(call justdir,${target_builddir})
diff --git a/winsup/acinclude.m4 b/winsup/acinclude.m4
index 865ef8b5d..5f71871ec 100644
--- a/winsup/acinclude.m4
+++ b/winsup/acinclude.m4
@@ -29,7 +29,6 @@ AC_SUBST(windows_libdir)
 )
 
 AC_DEFUN([AC_CYGWIN_INCLUDES], [
-addto_CPPFLAGS -nostdinc
 : ${ac_cv_prog_CXX:=$CXX}
 : ${ac_cv_prog_CC:=$CC}
 
@@ -56,13 +55,14 @@ else
 	AC_MSG_ERROR([cannot find windows header files])
     fi
 fi
-CC=$ac_cv_prog_CC
-CXX=$ac_cv_prog_CXX
-export CC
-export CXX
-AC_SUBST(windows_headers)
-AC_SUBST(newlib_headers)
-AC_SUBST(cygwin_headers)
+
+INCLUDES="-I${srcdir}/../cygwin -I${target_builddir}/winsup/cygwin"
+INCLUDES="${INCLUDES} -isystem ${cygwin_headers}"
+for h in ${newlib_headers}; do
+    INCLUDES="${INCLUDES} -isystem $h"
+done
+INCLUDES="${INCLUDES} -isystem ${windows_headers}"
+AC_SUBST(INCLUDES)
 ])
 
 AC_DEFUN([AC_CONFIGURE_ARGS], [
diff --git a/winsup/c++wrap b/winsup/c++wrap
deleted file mode 100755
index 987acb8c5..000000000
--- a/winsup/c++wrap
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use File::Basename;
-my $pgm = basename($0);
-(my $wrapper = $pgm) =~ s/\+\+/c/o;
-exec $wrapper, '++', @ARGV;
diff --git a/winsup/ccwrap b/winsup/ccwrap
deleted file mode 100755
index 900fc4ae5..000000000
--- a/winsup/ccwrap
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/perl
-use Cwd;
-use strict;
-my $cxx;
-my $ccorcxx;
-if ($ARGV[0] ne '++') {
-    $ccorcxx = 'CC';
-    $cxx = 0;
-} else {
-    shift @ARGV;
-    $ccorcxx = 'CXX';
-    $cxx = 1;
-}
-die "$0: $ccorcxx environment variable does not exist\n" unless exists $ENV{$ccorcxx};
-$ENV{'LANG'} = 'C';
-my @compiler = split ' ', $ENV{$ccorcxx};
-if ("@ARGV" !~ / -nostdinc/o) {
-    my $fd;
-    push @compiler, ($cxx ? '-xc++' : '-xc');
-    if (!open $fd, '-|') {
-	open STDERR, '>&', \*STDOUT;
-	exec @compiler, '/dev/null', '-v', '-E', '-o', '/dev/null' or die "*** error execing $compiler[0] - $!\n";
-    }
-    $compiler[1] =~ s/xc/nostdinc/o;
-    push @compiler, '-nostdinc' if $cxx;
-    push @compiler, '-I' . $_ for split ' ', $ENV{CCWRAP_HEADERS};
-    push @compiler, '-isystem', $_ for split ' ', $ENV{CCWRAP_SYSTEM_HEADERS};
-    my $finding_paths = 0;
-    while (<$fd>) {
-	if (/^\*\*\*/o) {
-	    print;
-	} elsif ($_ eq "#include <...> search starts here:\n") {
-	    $finding_paths = 1;
-	} elsif (!$finding_paths) {
-	    next;
-	} elsif ($_ eq "End of search list.\n") {
-	    last;
-	} elsif (!m%w32api%o) {
-	    chomp;
-	    s/^\s+//;
-	    push @compiler, '-isystem', Cwd::abs_path($_);
-	}
-    }
-    push @compiler, '-isystem', $_ for split ' ', $ENV{CCWRAP_DIRAFTER_HEADERS};
-    close $fd;
-}
-
-push @compiler, @ARGV;
-
-print join(' ', '+', @compiler), "\n" if $ENV{CCWRAP_VERBOSE};
-exec @compiler or die "$0: $compiler[0] failed to execute\n";
diff --git a/winsup/configure b/winsup/configure
index e70b27783..6bfd2781f 100755
--- a/winsup/configure
+++ b/winsup/configure
@@ -590,9 +590,7 @@ enable_option_checking=no
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 subdirs
-cygwin_headers
-newlib_headers
-windows_headers
+INCLUDES
 windows_libdir
 CPP
 ac_ct_CXX
@@ -3407,7 +3405,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
 
-addto_CPPFLAGS -nostdinc
 : ${ac_cv_prog_CXX:=$CXX}
 : ${ac_cv_prog_CC:=$CC}
 
@@ -3434,12 +3431,13 @@ else
 	as_fn_error $? "cannot find windows header files" "$LINENO" 5
     fi
 fi
-CC=$ac_cv_prog_CC
-CXX=$ac_cv_prog_CXX
-export CC
-export CXX
-
 
+INCLUDES="-I${srcdir}/../cygwin -I${target_builddir}/winsup/cygwin"
+INCLUDES="${INCLUDES} -isystem ${cygwin_headers}"
+for h in ${newlib_headers}; do
+    INCLUDES="${INCLUDES} -isystem $h"
+done
+INCLUDES="${INCLUDES} -isystem ${windows_headers}"
 
 
 
diff --git a/winsup/configure.cygwin b/winsup/configure.cygwin
index 06df92211..ff1f749c4 100755
--- a/winsup/configure.cygwin
+++ b/winsup/configure.cygwin
@@ -1,13 +1,3 @@
-addto_CPPFLAGS() {
-    local f
-    for f; do
-	case " $CPPFLAGS " in
-	    *\ $f\ *) ;;
-	    *) CPPFLAGS="$CPPFLAGS $f" ;;
-	esac
-    done
-}
-
 realdirpath() {
     [ -z "$1" ] && return 1
     (cd "$1" 2>/dev/null && pwd)
diff --git a/winsup/cygserver/Makefile.in b/winsup/cygserver/Makefile.in
index 70f38233c..e360d8fd0 100644
--- a/winsup/cygserver/Makefile.in
+++ b/winsup/cygserver/Makefile.in
@@ -11,22 +11,15 @@ target_builddir:=@target_builddir@
 winsup_srcdir:=@winsup_srcdir@
 configure_args=@configure_args@
 
-export CC:=@CC@
-export CXX:=@CXX@
-
 CFLAGS:=@CFLAGS@
 override CXXFLAGS=@CXXFLAGS@
 override CXXFLAGS+=-MMD -Wimplicit-fallthrough=5 -Werror -D__OUTSIDE_CYGWIN__ -DSYSCONFDIR="\"$(sysconfdir)\""
+INCLUDES:=@INCLUDES@
 
 include ${srcdir}/../Makefile.common
 
 cygwin_build:=${target_builddir}/winsup/cygwin
 
-# environment variables used by ccwrap
-export CCWRAP_HEADERS:=$(dir ${srcdir})/cygwin ${cygwin_build}
-export CCWRAP_SYSTEM_HEADERS:=@cygwin_headers@ @newlib_headers@
-export CCWRAP_DIRAFTER_HEADERS:=@windows_headers@
-
 DESTDIR=
 prefix:=${DESTDIR}@prefix@
 exec_prefix:=${DESTDIR}@exec_prefix@
diff --git a/winsup/cygserver/aclocal.m4 b/winsup/cygserver/aclocal.m4
index 4c041613d..2a9d9c6db 100644
--- a/winsup/cygserver/aclocal.m4
+++ b/winsup/cygserver/aclocal.m4
@@ -43,7 +43,6 @@ AC_SUBST(windows_libdir)
 )
 
 AC_DEFUN([AC_CYGWIN_INCLUDES], [
-addto_CPPFLAGS -nostdinc
 : ${ac_cv_prog_CXX:=$CXX}
 : ${ac_cv_prog_CC:=$CC}
 
@@ -70,13 +69,14 @@ else
 	AC_MSG_ERROR([cannot find windows header files])
     fi
 fi
-CC=$ac_cv_prog_CC
-CXX=$ac_cv_prog_CXX
-export CC
-export CXX
-AC_SUBST(windows_headers)
-AC_SUBST(newlib_headers)
-AC_SUBST(cygwin_headers)
+
+INCLUDES="-I${srcdir}/../cygwin -I${target_builddir}/winsup/cygwin"
+INCLUDES="${INCLUDES} -isystem ${cygwin_headers}"
+for h in ${newlib_headers}; do
+    INCLUDES="${INCLUDES} -isystem $h"
+done
+INCLUDES="${INCLUDES} -isystem ${windows_headers}"
+AC_SUBST(INCLUDES)
 ])
 
 AC_DEFUN([AC_CONFIGURE_ARGS], [
diff --git a/winsup/cygserver/configure b/winsup/cygserver/configure
index b36f4cfe4..14d8deab8 100755
--- a/winsup/cygserver/configure
+++ b/winsup/cygserver/configure
@@ -598,9 +598,7 @@ AS
 AR
 install_host
 all_host
-cygwin_headers
-newlib_headers
-windows_headers
+INCLUDES
 windows_libdir
 CPP
 ac_ct_CXX
@@ -3409,7 +3407,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
 
-addto_CPPFLAGS -nostdinc
 : ${ac_cv_prog_CXX:=$CXX}
 : ${ac_cv_prog_CC:=$CC}
 
@@ -3436,12 +3433,13 @@ else
 	as_fn_error $? "cannot find windows header files" "$LINENO" 5
     fi
 fi
-CC=$ac_cv_prog_CC
-CXX=$ac_cv_prog_CXX
-export CC
-export CXX
-
 
+INCLUDES="-I${srcdir}/../cygwin -I${target_builddir}/winsup/cygwin"
+INCLUDES="${INCLUDES} -isystem ${cygwin_headers}"
+for h in ${newlib_headers}; do
+    INCLUDES="${INCLUDES} -isystem $h"
+done
+INCLUDES="${INCLUDES} -isystem ${windows_headers}"
 
 
 
diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index 8ab654e9b..01c2f72a3 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -14,19 +14,12 @@ target_builddir:=@target_builddir@
 winsup_srcdir:=@winsup_srcdir@
 configure_args=@configure_args@
 
-export CC:=@CC@
-export CXX:=@CXX@
-
 CFLAGS?=@CFLAGS@
 CXXFLAGS?=@CXXFLAGS@
+INCLUDES?=@INCLUDES@
 
 include ${srcdir}/../Makefile.common
 
-# environment variables used by ccwrap
-export CCWRAP_HEADERS:=. ${srcdir}
-export CCWRAP_SYSTEM_HEADERS:=@cygwin_headers@ @newlib_headers@
-export CCWRAP_DIRAFTER_HEADERS:=@windows_headers@
-
 VPATH+=$(srcdir)/regex $(srcdir)/lib $(srcdir)/libc $(srcdir)/math $(srcdir)/tzcode
 
 target_cpu:=@target_cpu@
@@ -788,7 +781,7 @@ src_files := $(foreach dir,$(VPATH),$(find_src_files))
 # second, so version.cc is always older than winver.o
 version.cc: mkvers.sh include/cygwin/version.h winver.rc $(src_files)
 	@echo "Making version.cc and winver.o";\
-	/bin/sh ${word 1,$^} ${word 2,$^} ${word 3,$^} $(WINDRES) ${CFLAGS} $(addprefix -I,${CCWRAP_SYSTEM_HEADERS} ${CCWRAP_DIRAFTER_HEADERS})
+	/bin/sh ${word 1,$^} ${word 2,$^} ${word 3,$^} $(WINDRES) ${CFLAGS} -I${srcdir}/include
 $(VERSION_OFILES): version.cc
 
 Makefile: ${srcdir}/Makefile.in
@@ -815,7 +808,7 @@ CTAGS:
 	ctags -R --c++-kinds=+p --fields=+iaS --extra=+q \
 	--regex-C++='/EXPORT_ALIAS *\([a-zA-Z0-9_]*, *([a-zA-Z0-9_]*)\)/\1/' \
 	--regex-C++='/__ASMNAME *\("([a-zA-Z0-9_]+)"\)/\1/' \
-	@newlib_headers@ .
+	.
 
 deps:=${wildcard *.d}
 ifneq (,$(deps))
diff --git a/winsup/cygwin/aclocal.m4 b/winsup/cygwin/aclocal.m4
index 4adb9c03d..88de6cbf8 100644
--- a/winsup/cygwin/aclocal.m4
+++ b/winsup/cygwin/aclocal.m4
@@ -42,7 +42,6 @@ AC_SUBST(windows_libdir)
 )
 
 AC_DEFUN([AC_CYGWIN_INCLUDES], [
-addto_CPPFLAGS -nostdinc
 : ${ac_cv_prog_CXX:=$CXX}
 : ${ac_cv_prog_CC:=$CC}
 
@@ -69,13 +68,14 @@ else
 	AC_MSG_ERROR([cannot find windows header files])
     fi
 fi
-CC=$ac_cv_prog_CC
-CXX=$ac_cv_prog_CXX
-export CC
-export CXX
-AC_SUBST(windows_headers)
-AC_SUBST(newlib_headers)
-AC_SUBST(cygwin_headers)
+
+INCLUDES="-I${srcdir}/../cygwin -I${target_builddir}/winsup/cygwin"
+INCLUDES="${INCLUDES} -isystem ${cygwin_headers}"
+for h in ${newlib_headers}; do
+    INCLUDES="${INCLUDES} -isystem $h"
+done
+INCLUDES="${INCLUDES} -isystem ${windows_headers}"
+AC_SUBST(INCLUDES)
 ])
 
 AC_DEFUN([AC_CONFIGURE_ARGS], [
diff --git a/winsup/cygwin/configure b/winsup/cygwin/configure
index ce1749399..0aa134218 100755
--- a/winsup/cygwin/configure
+++ b/winsup/cygwin/configure
@@ -606,9 +606,7 @@ AS
 AR
 install_host
 all_host
-cygwin_headers
-newlib_headers
-windows_headers
+INCLUDES
 windows_libdir
 CPP
 ac_ct_CXX
@@ -3419,7 +3417,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
 
-addto_CPPFLAGS -nostdinc
 : ${ac_cv_prog_CXX:=$CXX}
 : ${ac_cv_prog_CC:=$CC}
 
@@ -3446,12 +3443,13 @@ else
 	as_fn_error $? "cannot find windows header files" "$LINENO" 5
     fi
 fi
-CC=$ac_cv_prog_CC
-CXX=$ac_cv_prog_CXX
-export CC
-export CXX
-
 
+INCLUDES="-I${srcdir}/../cygwin -I${target_builddir}/winsup/cygwin"
+INCLUDES="${INCLUDES} -isystem ${cygwin_headers}"
+for h in ${newlib_headers}; do
+    INCLUDES="${INCLUDES} -isystem $h"
+done
+INCLUDES="${INCLUDES} -isystem ${windows_headers}"
 
 
 
diff --git a/winsup/cygwin/gentls_offsets b/winsup/cygwin/gentls_offsets
index 59080c331..ef78d449a 100755
--- a/winsup/cygwin/gentls_offsets
+++ b/winsup/cygwin/gentls_offsets
@@ -89,7 +89,7 @@ EOF
 close TMP;
 my @avoid_headers = qw'-D_XMMINTRIN_H_INCLUDED -D_ADXINTRIN_H_INCLUDED -D_EMMINTRIN_H_INCLUDED -D_X86INTRIN_H_INCLUDED';
 my @cmd = (@ARGV, @avoid_headers, '-o', "/tmp/$$-1.cc", '-E', "/tmp/$$.cc");
-$ENV{CCWRAP_VERBOSE}=1;
+
 system @cmd;
 system 'g++', "$tgt_opt", '-o', "/tmp/$$.a.out", "/tmp/$$-1.cc" and
 ($? == 127 && system 'c++', "$tgt_opt", '-o', "/tmp/$$.a.out", "/tmp/$$-1.cc") and
diff --git a/winsup/utils/Makefile.in b/winsup/utils/Makefile.in
index 889fdaab3..bd17d6862 100644
--- a/winsup/utils/Makefile.in
+++ b/winsup/utils/Makefile.in
@@ -11,12 +11,10 @@ target_builddir:=@target_builddir@
 winsup_srcdir:=@winsup_srcdir@
 configure_args=@configure_args@
 
-export CC:=@CC@
-export CXX:=@CXX@
-
 CFLAGS_COMMON=-Wimplicit-fallthrough=4 -Werror
 CFLAGS:=@CFLAGS@
 CXXFLAGS:=@CXXFLAGS@
+INCLUDES:=@INCLUDES@
 override CFLAGS+=${CFLAGS_COMMON}
 override CXXFLAGS+=-fno-exceptions -fno-rtti ${CFLAGS_COMMON}
 
@@ -24,13 +22,6 @@ include ${srcdir}/../Makefile.common
 
 cygwin_build:=${target_builddir}/winsup/cygwin
 
-cygwin_headers:=@cygwin_headers@
-
-# environment variables used by ccwrap
-export CCWRAP_HEADERS:=. ${srcdir} $(call justdir,${cygwin_headers})
-export CCWRAP_SYSTEM_HEADERS:=${cygwin_headers} @newlib_headers@
-export CCWRAP_DIRAFTER_HEADERS:=@windows_headers@
-
 WINDOWS_LIBDIR:=@windows_libdir@
 
 prefix:=@prefix@
diff --git a/winsup/utils/aclocal.m4 b/winsup/utils/aclocal.m4
index 4adb9c03d..88de6cbf8 100644
--- a/winsup/utils/aclocal.m4
+++ b/winsup/utils/aclocal.m4
@@ -42,7 +42,6 @@ AC_SUBST(windows_libdir)
 )
 
 AC_DEFUN([AC_CYGWIN_INCLUDES], [
-addto_CPPFLAGS -nostdinc
 : ${ac_cv_prog_CXX:=$CXX}
 : ${ac_cv_prog_CC:=$CC}
 
@@ -69,13 +68,14 @@ else
 	AC_MSG_ERROR([cannot find windows header files])
     fi
 fi
-CC=$ac_cv_prog_CC
-CXX=$ac_cv_prog_CXX
-export CC
-export CXX
-AC_SUBST(windows_headers)
-AC_SUBST(newlib_headers)
-AC_SUBST(cygwin_headers)
+
+INCLUDES="-I${srcdir}/../cygwin -I${target_builddir}/winsup/cygwin"
+INCLUDES="${INCLUDES} -isystem ${cygwin_headers}"
+for h in ${newlib_headers}; do
+    INCLUDES="${INCLUDES} -isystem $h"
+done
+INCLUDES="${INCLUDES} -isystem ${windows_headers}"
+AC_SUBST(INCLUDES)
 ])
 
 AC_DEFUN([AC_CONFIGURE_ARGS], [
diff --git a/winsup/utils/configure b/winsup/utils/configure
index 3ad7c8a68..ec9bea17f 100755
--- a/winsup/utils/configure
+++ b/winsup/utils/configure
@@ -593,9 +593,7 @@ MINGW_CXX
 INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
-cygwin_headers
-newlib_headers
-windows_headers
+INCLUDES
 ac_ct_CXX
 CXXFLAGS
 CXX
@@ -3111,7 +3109,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-addto_CPPFLAGS -nostdinc
 : ${ac_cv_prog_CXX:=$CXX}
 : ${ac_cv_prog_CC:=$CC}
 
@@ -3138,12 +3135,13 @@ else
 	as_fn_error $? "cannot find windows header files" "$LINENO" 5
     fi
 fi
-CC=$ac_cv_prog_CC
-CXX=$ac_cv_prog_CXX
-export CC
-export CXX
-
 
+INCLUDES="-I${srcdir}/../cygwin -I${target_builddir}/winsup/cygwin"
+INCLUDES="${INCLUDES} -isystem ${cygwin_headers}"
+for h in ${newlib_headers}; do
+    INCLUDES="${INCLUDES} -isystem $h"
+done
+INCLUDES="${INCLUDES} -isystem ${windows_headers}"


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

only message in thread, other threads:[~2020-10-19 15:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 15:40 [newlib-cygwin] Cygwin: Remove ccwrap Jon TURNEY

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).